|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pietschy.wizard.AbstractWizardModel
org.pietschy.wizard.models.MultiPathModel
MultiPathModels are built from a joined set of Paths
that each contain one or more
WizardSteps
. Two types of Path
are available, SimplePath
and
BranchingPath
. The paths must be fully constructed before the model is instantiated.
// Construct each of the paths involved in the wizard. BranchingPath firstPath = new BranchingPath(); SimplePath optionalPath = new SimplePath(); SimplePath lastPath = new SimplePath(); firstPath.addStep(stepOne); firstPath.addStep(stepTwo); optionalPath.addStep(optionalStepOne); optionalPath.addStep(optionalStepTwo); optionalPath.addStep(optionalStepThree); lastPath.addStep(lastStep); // Now bind all the paths together, first the branching path then the optional path. // add the optional path and the condition that determines when it should be followed firstPath.addBranch(optionalPath, new Condition() { public boolean evaluate(WizardModel model) { return ((MyModel)model).includeOptional(); } }); // add the end path and the condition that determines when it should be followed firstPath.addBranch(lastPath, new Condition() { public boolean evaluate(WizardModel model) { return !((MyModel)model).includeOptional(); } }); // the optional path proceeds directly to the lastPath optionalPath.setNextPath(lastPath); // Now create the model and wizard. MultiPathModel model = new MultiPathModel(firstPath); Wizard wizard = new Wizard(model);During the initialization the wizard will scan all the paths to determine the ending path. The end path is an instance of
SimplePath
that is reachable from the
firstPath
and for whom SimplePath.getNextPath(org.pietschy.wizard.models.MultiPathModel)
returns null. If no
matching path is found or more than one is found the model will throw an exception.
Constructor Summary | |
MultiPathModel(Path firstPath)
Creates a new MultiPathModel. |
Method Summary | |
boolean |
allStepsComplete()
Returns true if all the steps in the wizard return true from WizardStep.isComplete() . |
Path |
getFirstPath()
|
Path |
getLastPath()
|
protected Path |
getPathForStep(WizardStep step)
|
boolean |
isLastStep(WizardStep step)
Checks if the specified step is the last step in the wizard. |
void |
lastStep()
Takes the model to the last step in the wizard and fires the appropriate property change events. |
void |
nextStep()
Increments the model the the next step and fires the appropriate property change events. |
void |
previousStep()
Takes the model back to the previsou step and fires the appropriate property change events. |
void |
refreshModelState()
This is an empty method that is intended for subclasses to override to update their various properties based on the active step. |
void |
reset()
Takes the model back to the first step and fires the appropriate property change events. |
java.util.Iterator |
stepIterator()
Returns an iterator over all the steps in the model. |
Methods inherited from class org.pietschy.wizard.AbstractWizardModel |
addCompleteListener, addPropertyChangeListener, addPropertyChangeListener, getActiveStep, isLastAvailable, isLastVisible, isNextAvailable, isPreviousAvailable, removePropertyChangeListener, removePropertyChangeListener, setActiveStep, setCancelAvailable, setLastAvailable, setLastVisible, setNextAvailable, setPreviousAvailable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MultiPathModel(Path firstPath)
During the initialization the wizard will scan all the paths to determine the ending path. The
end path is an instance of SimplePath
that is reachable from the
firstPath
and for whom SimplePath.getNextPath(org.pietschy.wizard.models.MultiPathModel)
returns null. If no
matching path is found or more than one is found the model will throw an exception.
firstPath
- the starting path of the model. The paths must be populated with their
steps
and be linked before the this constructor is called.Method Detail |
public Path getFirstPath()
public Path getLastPath()
public void nextStep()
WizardModel
WizardModel.isNextAvailable()
returns true.
public void previousStep()
WizardModel
WizardModel.isPreviousAvailable()
returns true.
public void lastStep()
WizardModel
WizardModel.isLastAvailable()
returns true.
public void reset()
WizardModel
public boolean isLastStep(WizardStep step)
WizardModel
step
- the step to check
public void refreshModelState()
AbstractWizardModel
refreshModelState
in interface WizardModel
refreshModelState
in class AbstractWizardModel
public boolean allStepsComplete()
WizardStep.isComplete()
. This is primarily used to determine if the last button
can be enabled.
public java.util.Iterator stepIterator()
WizardModel
protected Path getPathForStep(WizardStep step)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |