001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/presentation/api/src/java/org/theospi/portfolio/presentation/model/PresentationPageRegion.java $
003: * $Id: PresentationPageRegion.java 10835 2006-06-17 03:25:03Z lance@indiana.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.theospi.portfolio.presentation.model;
021:
022: import java.io.Serializable;
023: import java.util.ArrayList;
024: import java.util.Iterator;
025: import java.util.List;
026:
027: import org.sakaiproject.metaobj.shared.model.Id;
028: import org.sakaiproject.metaobj.shared.model.IdentifiableObject;
029:
030: public class PresentationPageRegion extends IdentifiableObject
031: implements Serializable {
032:
033: private Id id;
034: private PresentationPage page;
035: private String regionId;
036: private List items = new ArrayList();
037: private String type = "text";
038: private String helpText;
039:
040: public Id getId() {
041: return id;
042: }
043:
044: public void setId(Id id) {
045: this .id = id;
046: }
047:
048: public List getItems() {
049: return items;
050: }
051:
052: public void setItems(List items) {
053: this .items = items;
054: }
055:
056: public PresentationPage getPage() {
057: return page;
058: }
059:
060: public void setPage(PresentationPage page) {
061: this .page = page;
062: }
063:
064: public String getRegionId() {
065: return regionId;
066: }
067:
068: public void setRegionId(String regionId) {
069: this .regionId = regionId;
070: }
071:
072: public void reorderItems() {
073: int index = 0;
074: for (Iterator i = getItems().iterator(); i.hasNext();) {
075: PresentationPageItem item = (PresentationPageItem) i.next();
076: item.setRegionItemSeq(index);
077: index++;
078: }
079: }
080:
081: public void addBlank() {
082: PresentationPageItem item = new PresentationPageItem();
083: item.setRegion(this );
084: item.setLayoutRegionId(this .getRegionId());
085: item.setType(getType());
086: item.setValue(getHelpText());
087: getItems().add(item);
088: reorderItems();
089: }
090:
091: public String getType() {
092: return type;
093: }
094:
095: public void setType(String type) {
096: this .type = type;
097: }
098:
099: public String getHelpText() {
100: return helpText;
101: }
102:
103: public void setHelpText(String helpText) {
104: this .helpText = helpText;
105: }
106:
107: public int hashCode() {
108: if (id != null) {
109: return super.hashCode();
110: } else {
111: return regionId.hashCode();
112: }
113: }
114: }
|