Class DynamicWizardModel
- java.lang.Object
-
- org.apache.wicket.extensions.wizard.AbstractWizardModel
-
- org.apache.wicket.extensions.wizard.dynamic.DynamicWizardModel
-
- All Implemented Interfaces:
Serializable
,IWizardModel
,IClusterable
public class DynamicWizardModel extends AbstractWizardModel
Wizard model that is specialized on dynamic wizards. Unlike the default, staticwizard model
, this model isn't very intelligent, but rather delegates much of the work and knowledge to thedynamic wizard steps
it uses.- Author:
- eelcohillenius
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DynamicWizardModel(IDynamicWizardStep startStep)
Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IDynamicWizardStep
getActiveStep()
Gets the current active step the wizard should display.IDynamicWizardStep
getStartStep()
boolean
isFinishAvailable()
Gets whether the finish button should be enabled.boolean
isLastAvailable()
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
isNextAvailable()
Gets whether the next button should be enabled.boolean
isPreviousAvailable()
Gets whether 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.protected void
setActiveStep(IDynamicWizardStep step)
Sets the active step.Iterator<IWizardStep>
stepIterator()
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
-
-
-
-
Constructor Detail
-
DynamicWizardModel
public DynamicWizardModel(IDynamicWizardStep startStep)
Construct.- Parameters:
startStep
- first step in the wizard
-
-
Method Detail
-
getActiveStep
public IDynamicWizardStep getActiveStep()
Description copied from interface:IWizardModel
Gets the current active step the wizard should display.- Returns:
- the active step.
- See Also:
IWizardModel.getActiveStep()
-
getStartStep
public final IDynamicWizardStep getStartStep()
- Returns:
- the step this wizard was constructed with (starts the wizard). Will be used for
resetting the wizard, unless you override
reset()
.
-
isLastAvailable
public boolean isLastAvailable()
Description copied from interface:IWizardModel
Checks if the last button should be enabled.- Returns:
- true if the last button should be enabled, false otherwise.
- See Also:
IWizardModel.isLastAvailable()
-
isLastStep
public boolean isLastStep(IWizardStep step)
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:
IWizardModel.isLastStep(org.apache.wicket.extensions.wizard.IWizardStep)
-
isNextAvailable
public boolean isNextAvailable()
Description copied from interface:IWizardModel
Gets whether the next button should be enabled.- Returns:
- True if the next button should be enabled, false otherwise.
- See Also:
IWizardModel.isNextAvailable()
-
isPreviousAvailable
public boolean isPreviousAvailable()
Description copied from interface:IWizardModel
Gets whether the previous button should be enabled.- Returns:
- True if the previous button should be enabled, false otherwise.
- See Also:
IWizardModel.isPreviousAvailable()
-
isFinishAvailable
public boolean isFinishAvailable()
Description copied from interface:IWizardModel
Gets whether the finish button should be enabled.By default the finish button is available for the last step only.
- Returns:
- True if the finish button should be enabled, false otherwise.
- See Also:
IWizardModel.isLastStep(IWizardStep)
,IWizardModel.finish()
-
last
public void 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:
IWizardModel.last()
-
next
public void 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:
IWizardModel.next()
-
previous
public void 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:
IWizardModel.previous()
-
reset
public void reset()
Description copied from interface:IWizardModel
Resets the model, setting it to the first step. Implementors should notifylisteners
through callingIWizardModelListener.onActiveStepChanged(IWizardStep)
.- See Also:
IWizardModel.reset()
-
stepIterator
public Iterator<IWizardStep> 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:
IWizardModel.stepIterator()
-
setActiveStep
protected final void setActiveStep(IDynamicWizardStep step)
Sets the active step.- Parameters:
step
- the new active step step.
-
-