java.lang.Object
org.apache.wicket.extensions.wizard.AbstractWizardModel
org.apache.wicket.extensions.wizard.WizardModel
- All Implemented Interfaces:
Serializable
,IWizardModel
,IClusterable
Default implementation of
IWizardModel
, which models a semi-static wizard. This means
that all steps should be known upfront, and added to the model on construction. Steps can be
optional by using WizardModel.ICondition
. The wizard is initialized with a wizard model through
calling method Wizard.init(IWizardModel)
.
Steps can be added to this model directly using either the normal add
method
or the conditional add method
.
Swing Wizard Framework served as a valuable source of inspiration.
- Author:
- Eelco Hillenius
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Interface for conditional displaying of wizard steps. -
Field Summary
Modifier and TypeFieldDescriptionstatic final WizardModel.ICondition
Condition that always evaluates true. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(IWizardStep step) Adds the next step to the wizard.void
add
(IWizardStep step, WizardModel.ICondition condition) Adds an optional step to the model.protected final boolean
Returns true if all the steps in the wizard return true fromIWizardStep.isComplete()
.protected final IWizardStep
Finds the last step in this model.protected final IWizardStep
Finds the next visible step based on the active step.final IWizardStep
Gets the current active step the wizard should display.Gets conditions.boolean
Checks if the last button should be enabled.boolean
isLastStep
(IWizardStep step) Gets whether the specified step is the last step in the wizard.boolean
Checks if the next button should be enabled.boolean
Checks if the previous button should be enabled.void
last()
Takes the model to the last step in the wizard.void
next()
Increments the model to the next step.void
previous()
Takes the model to the previous step.This method must only be called ifIWizardModel.isPreviousAvailable()
returns true.void
reset()
Resets the model, setting it to the first step.void
setActiveStep
(IWizardStep step) Sets the active step.Returns an iterator over all the steps in the model.Methods inherited from class org.apache.wicket.extensions.wizard.AbstractWizardModel
addListener, cancel, finish, fireActiveStepChanged, fireWizardCancelled, fireWizardFinished, isCancelVisible, isLastVisible, removeListener, setCancelVisible, setLastVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.wicket.extensions.wizard.IWizardModel
isFinishAvailable
-
Field Details
-
TRUE
Condition that always evaluates true.
-
-
Constructor Details
-
WizardModel
public WizardModel()Construct.
-
-
Method Details
-
add
Adds the next step to the wizard. If theWizardStep
implementsWizardModel.ICondition
, then this method is equivalent to callingadd(step, (ICondition)step)
.- Parameters:
step
- the step to added.
-
add
Adds an optional step to the model. The step will only be displayed if the specified condition is met.- Parameters:
step
- The step to addcondition
- theWizardModel.ICondition
under which it should be included in the wizard.
-
getActiveStep
Gets the current active step the wizard should display.- Returns:
- the active step.
-
isLastAvailable
Checks if the last button should be enabled.- Returns:
- true if the last button should be enabled, false otherwise.
- See Also:
-
isLastStep
Description copied from interface:IWizardModel
Gets whether the specified step is the last step in the wizard.- Parameters:
step
- the step to check- Returns:
- True if its the final step in the wizard, false otherwise.
- See Also:
-
isNextAvailable
Checks if the next button should be enabled.- Returns:
- true if the next button should be enabled, false otherwise.
- See Also:
-
isPreviousAvailable
Checks if the previous button should be enabled.- Returns:
- true if the previous button should be enabled, false otherwise.
- See Also:
-
last
Description copied from interface:IWizardModel
Takes the model to the last step in the wizard. This method must only be called ifIWizardModel.isLastAvailable()
returns true. Implementors should notifylisteners
through callingIWizardModelListener.onActiveStepChanged(IWizardStep)
.- See Also:
-
next
Description copied from interface:IWizardModel
Increments the model to the next step. This method must only be called ifIWizardModel.isNextAvailable()
returns true. Implementors should notifylisteners
through callingIWizardModelListener.onActiveStepChanged(IWizardStep)
.- See Also:
-
previous
Description copied from interface:IWizardModel
Takes the model to the previous step.This method must only be called ifIWizardModel.isPreviousAvailable()
returns true. Implementors should notifylisteners
through callingIWizardModelListener.onActiveStepChanged(IWizardStep)
.- See Also:
-
reset
Description copied from interface:IWizardModel
Resets the model, setting it to the first step. Implementors should notifylisteners
through callingIWizardModelListener.onActiveStepChanged(IWizardStep)
.- See Also:
-
setActiveStep
Sets the active step.- Parameters:
step
- the new active step step.
-
stepIterator
Description copied from interface:IWizardModel
Returns an iterator over all the steps in the model. The iteration order is not guaranteed to the be the order of visit. This is an optional operation; dynamic models can just return null, and should call init the first time a step is encountered right before rendering it.- Returns:
- an iterator over all the steps of the model or null if the wizard model is not static
- See Also:
-
allStepsComplete
Returns true if all the steps in the wizard return true fromIWizardStep.isComplete()
. This is primarily used to determine if the last button can be enabled.- Returns:
- true if all the steps in the wizard are complete, false otherwise.
-
findLastStep
Finds the last step in this model.- Returns:
- The last step
-
findNextVisibleStep
Finds the next visible step based on the active step.- Returns:
- The next visible step based on the active step
-
getConditions
Gets conditions.- Returns:
- unmodifiable list of conditions
-