|
||||||||||
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.DynamicModel
The DynamicModel is very similar to the static model, except that steps can be dynamically removed from the wizard flow.
// create a subclass of DynamicModel MyDynamicModel model = new MyDynamicModel(); // add the first step.. model.add(new MyFirstStep()); // add an optional step.. model.add(new MyOptionalStep(), new Condition() { public boolean evaluate(WizardModel model) { return ((MyDynamicModel) model).isOptionalRequired(); } }); // add the last step. model.add(new MyLastStep()); // now create the wizard and use it.. Wizard wizard = new Wizard(model);It is also worth noting that steps that implement
Condition
can be added using the basic
add(WizardStep)
and the model will automatically add them as an optional step.
add(WizardStep)
,
add(WizardStep, Condition)
Field Summary | |
static Condition |
TRUE_CONDITION
An implementation of Condition that always returns true. |
Constructor Summary | |
DynamicModel()
Creates a new DynamicModel. |
Method Summary | |
void |
add(WizardStep step)
Adds the next step to the wizard. |
void |
add(WizardStep step,
Condition condition)
Adds an optional step to the model. |
boolean |
allStepsComplete()
Returns true if all included steps in the wizard return true from WizardStep.isComplete() . |
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()
Forces the model to re-evaluate it's current state. |
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 |
Field Detail |
public static final Condition TRUE_CONDITION
Condition
that always returns true.
Constructor Detail |
public DynamicModel()
Method Detail |
public void add(WizardStep step)
WizardStep
implements Condition
, then this method is
equivalent to calling add(step, (Condition)step)
, other wise it is equivalent to
calling add(step, TRUE_CONDITION)
.
This allows the easy use of WizardStep
s that determine the condition under which they are displayed.
step
- the step to added.public void add(WizardStep step, Condition condition)
step
- the WizardStep
to add.condition
- the Condition
under which it should be included in the wizard.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()
Condition.evaluate(org.pietschy.wizard.WizardModel)
.
Subclasses that override this method must be sure to invoke super.refreshModelState().
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.
Please note that this method ignores all steps for which their Condition
returns false.
public java.util.Iterator stepIterator()
WizardModel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |