01: /**
02: * Wizard Framework
03: * Copyright 2004 - 2005 Andrew Pietsch
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: *
19: * $Id: SimplePath.java,v 1.6 2005/05/16 23:07:01 pietschy Exp $
20: */package org.pietschy.wizard.models;
21:
22: import org.pietschy.wizard.WizardStep;
23:
24: import java.util.ArrayList;
25: import java.util.Collection;
26:
27: /**
28: * A SimplePath represents a sequence of {@link WizardStep wizard steps} whose next path is determined
29: * at compile time. That is, SimplePaths can't branch.
30: * @see #setNextPath
31: * @see #addStep
32: */
33: public class SimplePath extends Path {
34: private Path nextPath;
35:
36: public SimplePath() {
37: }
38:
39: /**
40: * Creates a new SimplePath that is initialized with the specified step.
41: * @param step the first step of the path.
42: */
43: public SimplePath(WizardStep step) {
44: addStep(step);
45: }
46:
47: protected Path getNextPath(MultiPathModel model) {
48: return nextPath;
49: }
50:
51: public Path getNextPath() {
52: return nextPath;
53: }
54:
55: public void setNextPath(Path nextPath) {
56: this .nextPath = nextPath;
57: }
58:
59: public void acceptVisitor(PathVisitor visitor) {
60: visitor.visitPath(this );
61: }
62:
63: public void visitNextPath(PathVisitor visitor) {
64: if (nextPath != null)
65: nextPath.acceptVisitor(visitor);
66: }
67:
68: }
|