001: /*
002: * $Id: org.eclipse.jdt.ui.prefs 5004 2006-03-17 20:47:08 -0800 (Fri, 17 Mar
003: * 2006) eelco12 $ $Revision: 5004 $ $Date: 2006-03-17 20:47:08 -0800 (Fri, 17
004: * Mar 2006) $
005: *
006: * ==============================================================================
007: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
008: * use this file except in compliance with the License. You may obtain a copy of
009: * the License at
010: *
011: * http://www.apache.org/licenses/LICENSE-2.0
012: *
013: * Unless required by applicable law or agreed to in writing, software
014: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
015: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
016: * License for the specific language governing permissions and limitations under
017: * the License.
018: */
019: package wicket.extensions.wizard;
020:
021: import java.io.Serializable;
022: import java.util.Iterator;
023:
024: /**
025: * This interface defines the model for wizards. This model knows about the
026: * wizard's steps and the transitions between them, and it holds a reference to
027: * the currently active step. It might function as a generic state holder for
028: * the wizard too, though you might find it more convenient to use the wizard
029: * component itself for that, or even an external model.
030: *
031: * <p>
032: * {@link IWizardModelListener wizard model listeners} can be registered to be
033: * notified of important events (changing the active step) using the
034: * {@link #addListener(IWizardModelListener) add listener} method.
035: * </p>
036: *
037: * <p>
038: * Typically, you would use
039: * {@link WizardModel the default implementation of this interface}, but if you
040: * need to do more sophisticated stuff, like branching etc, you can consider
041: * creating your own implementation.
042: * </p>
043: *
044: * <p>
045: * <a href="https://wizard-framework.dev.java.net/">Swing Wizard Framework</a>
046: * served as a valuable source of inspiration.
047: * </p>
048: *
049: * @see WizardModel
050: *
051: * @author Eelco Hillenius
052: */
053: public interface IWizardModel extends Serializable {
054: /**
055: * Adds a wizard model listener.
056: *
057: * @param listener
058: * The wizard model listener to add
059: */
060: void addListener(IWizardModelListener listener);
061:
062: /**
063: * Cancels further processing. Implementations may clean up and reset the
064: * model. Implementations should notify the registered
065: * {@link IWizardModelListener#onCancel() model listeners}.
066: */
067: void cancel();
068:
069: /**
070: * Instructs the wizard to finish succesfully. Typically, implementations
071: * check whether this option is available at all. Implementations may clean
072: * up and reset the model. Implementations should notify the registered
073: * {@link IWizardModelListener#onFinish() model listeners}.
074: */
075: void finish();
076:
077: /**
078: * Gets the current active step the wizard should display.
079: *
080: * @return the active step.
081: */
082: IWizardStep getActiveStep();
083:
084: /**
085: * Gets whether the cancel button should be displayed.
086: *
087: * @return True if the cancel button should be displayed
088: */
089: boolean isCancelVisible();
090:
091: /**
092: * Checks if the last button should be enabled.
093: *
094: * @return <tt>true</tt> if the last button should be enabled,
095: * <tt>false</tt> otherwise.
096: * @see #isLastVisible
097: */
098: boolean isLastAvailable();
099:
100: /**
101: * Gets whether the specified step is the last step in the wizard.
102: *
103: * @param step
104: * the step to check
105: * @return True if its the final step in the wizard, false< otherwise.
106: */
107: boolean isLastStep(IWizardStep step);
108:
109: /**
110: * Gets whether the last button should be displayed. This method should only
111: * return true if the {@link #isLastAvailable} will return true at any
112: * point. Returning false will prevent the last button from appearing on the
113: * wizard at all.
114: *
115: * @return True if the last button should be displayed, False otherwise.
116: */
117: boolean isLastVisible();
118:
119: /**
120: * Gets whether the next button should be enabled.
121: *
122: * @return True if the next button should be enabled, false otherwise.
123: */
124: boolean isNextAvailable();
125:
126: /**
127: * Gets whether the previous button should be enabled.
128: *
129: * @return True if the previous button should be enabled, false otherwise.
130: */
131: boolean isPreviousAvailable();
132:
133: /**
134: * Takes the model to the last step in the wizard. This method must only be
135: * called if {@link #isLastAvailable} returns <tt>true</tt>.
136: */
137: void lastStep();
138:
139: /**
140: * Increments the model the the next step. This method must only be called
141: * if {@link #isNextAvailable} returns <tt>true</tt>.
142: */
143: void next();
144:
145: /**
146: * Takes the model to the previous step.This method must only be called if
147: * {@link #isPreviousAvailable} returns <tt>true</tt>.
148: */
149: void previous();
150:
151: /**
152: * Removes a wizard model listener.
153: *
154: * @param listener
155: * The listener to remove
156: */
157: void removeListener(IWizardModelListener listener);
158:
159: /**
160: * Resets the model, setting it to the first step.
161: */
162: void reset();
163:
164: /**
165: * Returns an iterator over all the steps in the model. The iteration order
166: * is not guarenteed to the be the order of traversal.
167: *
168: * @return an iterator over all the steps of the model
169: */
170: Iterator stepIterator();
171: }
|