001: /**********************************************************************************
002: * $URL:https://source.sakaiproject.org/svn/osp/trunk/wizard/api/src/java/org/theospi/portfolio/wizard/model/CompletedWizardCategory.java $
003: * $Id:CompletedWizardCategory.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.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.wizard.model;
021:
022: import java.util.ArrayList;
023: import java.util.Iterator;
024: import java.util.List;
025:
026: import org.sakaiproject.metaobj.shared.model.IdentifiableObject;
027:
028: /**
029: * Created by IntelliJ IDEA.
030: * User: John Ellis
031: * Date: Jan 23, 2006
032: * Time: 3:07:26 PM
033: * To change this template use File | Settings | File Templates.
034: */
035: public class CompletedWizardCategory extends IdentifiableObject {
036:
037: private WizardCategory category;
038: private CompletedWizard wizard;
039: private List childPages;
040: private List childCategories;
041: private int sequence;
042: private CompletedWizardCategory parentCategory;
043:
044: private boolean expanded = false;
045:
046: public CompletedWizardCategory() {
047: }
048:
049: public CompletedWizardCategory(CompletedWizard wizard,
050: WizardCategory category) {
051: this .wizard = wizard;
052: this .category = category;
053: setSequence(category.getSequence());
054: setChildPages(initChildPages());
055: setChildCategories(initChildCategories());
056: }
057:
058: protected List initChildCategories() {
059: List categories = new ArrayList();
060:
061: for (Iterator i = category.getChildCategories().iterator(); i
062: .hasNext();) {
063: WizardCategory category = (WizardCategory) i.next();
064: CompletedWizardCategory completed = new CompletedWizardCategory(
065: wizard, category);
066: completed.setParentCategory(this );
067: categories.add(completed);
068: }
069:
070: return categories;
071: }
072:
073: protected List initChildPages() {
074: List pages = new ArrayList();
075:
076: for (Iterator i = category.getChildPages().iterator(); i
077: .hasNext();) {
078: WizardPageSequence page = (WizardPageSequence) i.next();
079: CompletedWizardPage completedPage = new CompletedWizardPage(
080: page, this );
081: pages.add(completedPage);
082: }
083:
084: return pages;
085: }
086:
087: public WizardCategory getCategory() {
088: return category;
089: }
090:
091: public void setCategory(WizardCategory category) {
092: this .category = category;
093: }
094:
095: public CompletedWizard getWizard() {
096: return wizard;
097: }
098:
099: public void setWizard(CompletedWizard wizard) {
100: this .wizard = wizard;
101: }
102:
103: public boolean isExpanded() {
104: return expanded;
105: }
106:
107: public void setExpanded(boolean expanded) {
108: this .expanded = expanded;
109: }
110:
111: public List getChildPages() {
112: return childPages;
113: }
114:
115: public void setChildPages(List childPages) {
116: this .childPages = childPages;
117: }
118:
119: public List getChildCategories() {
120: return childCategories;
121: }
122:
123: public void setChildCategories(List childCategories) {
124: this .childCategories = childCategories;
125: }
126:
127: public int getSequence() {
128: return sequence;
129: }
130:
131: public void setSequence(int sequence) {
132: this .sequence = sequence;
133: }
134:
135: public CompletedWizardCategory getParentCategory() {
136: return parentCategory;
137: }
138:
139: public void setParentCategory(CompletedWizardCategory parentCategory) {
140: this.parentCategory = parentCategory;
141: }
142: }
|