01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/common/tool-lib/src/java/org/theospi/portfolio/shared/tool/BuilderTool.java $
03: * $Id: BuilderTool.java 14071 2006-08-28 17:44:04Z andersjb@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.theospi.portfolio.shared.tool;
21:
22: /**
23: * Created by IntelliJ IDEA.
24: * User: John Ellis
25: * Date: Jan 19, 2006
26: * Time: 1:26:29 PM
27: * To change this template use File | Settings | File Templates.
28: */
29: public abstract class BuilderTool extends HelperToolBase {
30:
31: private BuilderScreen currentScreen;
32: private BuilderScreen[] screens;
33:
34: protected String startBuilder() {
35: setCurrentScreen(screens[0]);
36: return getCurrentScreen().getNavigationKey();
37: }
38:
39: protected abstract void saveScreen(BuilderScreen screen);
40:
41: public BuilderScreen getCurrentScreen() {
42: return currentScreen;
43: }
44:
45: public void setCurrentScreen(BuilderScreen currentScreen) {
46: this .currentScreen = currentScreen;
47: }
48:
49: public BuilderScreen[] getScreens() {
50: return screens;
51: }
52:
53: public void setScreens(BuilderScreen[] screens) {
54: for (int i = 0; i < screens.length; i++) {
55: BuilderScreen screen = screens[i];
56: screen.setStep(i);
57: screen.setTool(this );
58: if (i > 0) {
59: screen.setPrev(screens[i - 1]);
60: }
61:
62: if (i + 1 < screens.length) {
63: screen.setNext(screens[i + 1]);
64: }
65: }
66: this.screens = screens;
67: }
68: }
|