001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/common/tool-lib/src/java/org/theospi/portfolio/shared/tool/BuilderScreen.java $
003: * $Id: BuilderScreen.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.shared.tool;
021:
022: /**
023: * Created by IntelliJ IDEA.
024: * User: John Ellis
025: * Date: Jan 19, 2006
026: * Time: 1:27:50 PM
027: * To change this template use File | Settings | File Templates.
028: */
029: public class BuilderScreen {
030:
031: private BuilderTool tool;
032: private String navigationKey;
033: private int step = 0;
034:
035: private BuilderScreen next;
036: private BuilderScreen prev;
037:
038: public BuilderScreen(String navigationKey) {
039: this .navigationKey = navigationKey;
040: }
041:
042: public String getNavigationKey() {
043: return navigationKey;
044: }
045:
046: public void setNavigationKey(String navigationKey) {
047: this .navigationKey = navigationKey;
048: }
049:
050: public BuilderScreen getNext() {
051: return next;
052: }
053:
054: public void setNext(BuilderScreen next) {
055: this .next = next;
056: }
057:
058: public BuilderScreen getPrev() {
059: return prev;
060: }
061:
062: public void setPrev(BuilderScreen prev) {
063: this .prev = prev;
064: }
065:
066: public BuilderTool getTool() {
067: return tool;
068: }
069:
070: public void setTool(BuilderTool tool) {
071: this .tool = tool;
072: }
073:
074: public int getStep() {
075: return step;
076: }
077:
078: public String getStepString() {
079: return "" + (step);
080: }
081:
082: public void setStep(int step) {
083: this .step = step;
084: }
085:
086: public BuilderScreen processActionSave(boolean forward) {
087: getTool().saveScreen(this );
088:
089: return forward ? getNext() : getPrev();
090: }
091:
092: public String processActionSaveNext() {
093: BuilderScreen next = processActionSave(true);
094: getTool().setCurrentScreen(next);
095: return next.getNavigationKey();
096: }
097:
098: public String processActionNext() {
099: BuilderScreen next = getNext();
100: getTool().setCurrentScreen(next);
101: return next.getNavigationKey();
102: }
103:
104: public String processActionSaveBack() {
105: BuilderScreen prev = processActionSave(false);
106: getTool().setCurrentScreen(prev);
107: return prev.getNavigationKey();
108: }
109:
110: public boolean isLast() {
111: return getNext() == null;
112: }
113:
114: public boolean isFirst() {
115: return getPrev() == null;
116: }
117:
118: }
|