Interface IWizardModel
-
- All Superinterfaces:
IClusterable
,Serializable
- All Known Implementing Classes:
AbstractWizardModel
,DynamicWizardModel
,WizardModel
public interface IWizardModel extends IClusterable
This interface defines the model for wizards. This model knows about the wizard's steps and the transitions between them, and it holds a reference to the currently active step. It might function as a generic state holder for the wizard too, though you might find it more convenient to use the wizard component itself for that, or even an external model.wizard model listeners
can be registered to be notified of important events (changing the active step) using theadd listener
method.Typically, you would use
the default implementation of this interface
, but if you need to do more sophisticated stuff, like branching etc, you can consider creating your own implementation. In that case, it is recommended you start by extending fromAbstractWizardModel
.Swing Wizard Framework served as a valuable source of inspiration.
- Author:
- Eelco Hillenius
- See Also:
AbstractWizardModel
,WizardModel
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addListener(IWizardModelListener listener)
Adds a wizard model listener.void
cancel()
Cancels further processing.void
finish()
Instructs the wizard to finish succesfully.IWizardStep
getActiveStep()
Gets the current active step the wizard should display.boolean
isCancelVisible()
Gets whether the cancel button should be displayed.default 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
isLastVisible()
Gets whether the last button should be displayed.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 ifisPreviousAvailable()
returns true.void
removeListener(IWizardModelListener listener)
Removes a wizard model listener.void
reset()
Resets the model, setting it to the first step.Iterator<IWizardStep>
stepIterator()
Returns an iterator over all the steps in the model.
-
-
-
Method Detail
-
addListener
void addListener(IWizardModelListener listener)
Adds a wizard model listener.- Parameters:
listener
- The wizard model listener to add
-
removeListener
void removeListener(IWizardModelListener listener)
Removes a wizard model listener.- Parameters:
listener
- The listener to remove
-
reset
void reset()
Resets the model, setting it to the first step. Implementors should notifylisteners
through callingIWizardModelListener.onActiveStepChanged(IWizardStep)
.
-
stepIterator
Iterator<IWizardStep> stepIterator()
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
-
isLastStep
boolean isLastStep(IWizardStep step)
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.
-
getActiveStep
IWizardStep getActiveStep()
Gets the current active step the wizard should display.- Returns:
- the active step.
-
isCancelVisible
boolean isCancelVisible()
Gets whether the cancel button should be displayed.- Returns:
- True if the cancel button should be displayed
- See Also:
cancel()
-
cancel
void cancel()
Cancels further processing. Implementations may clean up and reset the model. Implementations should notify the registeredmodel listeners
.
-
isPreviousAvailable
boolean isPreviousAvailable()
Gets whether the previous button should be enabled.- Returns:
- True if the previous button should be enabled, false otherwise.
- See Also:
previous()
-
previous
void previous()
Takes the model to the previous step.This method must only be called ifisPreviousAvailable()
returns true. Implementors should notifylisteners
through callingIWizardModelListener.onActiveStepChanged(IWizardStep)
.- See Also:
isPreviousAvailable()
-
isNextAvailable
boolean isNextAvailable()
Gets whether the next button should be enabled.- Returns:
- True if the next button should be enabled, false otherwise.
- See Also:
next()
-
next
void next()
Increments the model to the next step. This method must only be called ifisNextAvailable()
returns true. Implementors should notifylisteners
through callingIWizardModelListener.onActiveStepChanged(IWizardStep)
.- See Also:
isNextAvailable()
-
isLastVisible
boolean isLastVisible()
Gets whether the last button should be displayed. This method should only return true if theisLastAvailable()
will return true at any point. Returning false will prevent the last button from appearing on the wizard at all.- Returns:
- True if the last button should be displayed, False otherwise.
- See Also:
isLastAvailable()
,last()
-
isLastAvailable
boolean isLastAvailable()
Checks if the last button should be enabled.- Returns:
- true if the last button should be enabled, false otherwise.
- See Also:
isLastVisible()
,last()
-
last
void last()
Takes the model to the last step in the wizard. This method must only be called ifisLastAvailable()
returns true. Implementors should notifylisteners
through callingIWizardModelListener.onActiveStepChanged(IWizardStep)
.- See Also:
isLastVisible()
,isLastAvailable()
-
isFinishAvailable
default boolean isFinishAvailable()
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:
isLastStep(IWizardStep)
,finish()
-
finish
void finish()
Instructs the wizard to finish succesfully. Typically, implementations check whether this option is available at all. Implementations may clean up and reset the model. Implementations should notify the registeredmodel listeners
.
-
-