java.lang.Objectnet.jspcontrols.wizard.impl.Wizard
This class containts base implementation of wizard controller and handles
wizard traversal. The wizard controller contains references to wizard states
and transitions, and allows to move from one state to another.
The UI specifics like reporting of error messages should be handled by
descendant classes.
| Field Summary | |
protected IWizardStep |
currentState
Current state of this wizard. |
protected java.util.Map |
errors
Error list. |
protected java.util.Map |
listeners
Listeners, checking for state transition |
protected IWizardStep |
sourceState
The intial state of this wizard. |
| Constructor Summary | |
Wizard()
|
|
| Method Summary | |
void |
addListener(IWizardListener listener)
Adds a listener for state change event. |
boolean |
back()
Tries to move to the previous state. |
protected boolean |
canLeave(int event)
Executed after the forward transition is chosen, but before the state is changed. |
void |
clearWizardErrors()
Clear wizard errors. |
static IWizardStep |
findNode(IWizardStep state,
java.lang.String name)
Finds a state by its name. |
boolean |
forward()
Tries to move to the next state. |
IWizardStep |
getCurrentStep()
Returns current state of this wizard; on wizard startup is the same as source state. |
java.lang.String |
getCurrentStepName()
Returns a name which is used to display proper wizard panel. |
java.util.Map |
getListeners()
Returns all current listeners for wizard event |
IWizardStep |
getSourceStep()
Returns source state of this wizard. |
IWizardStep |
getStepByName(java.lang.String name)
Locates a state in this wizard by its name |
java.util.Map |
getWizardErrors()
Standard implementation returns a dummy map for error messages in case the concrete implementation generates messages externally and does not provide message placeholder. |
boolean |
isCompleted()
Returns true if wizard has been successfully completed. |
protected boolean |
isLastStep()
Verifies is current wizard step a last step. |
void |
removeAllListeners()
Removes all wizard listeners for state change event. |
void |
removeListener(IWizardListener listener)
Removes a listener for state change event. |
void |
wizardReset()
Resets certain wizard fields, like booleans. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected IWizardStep currentState
protected java.util.Map errors
Errors are initialized in backing bean when a wizard object is created. Reference to existing error object must be passed to this wizard controller from backing bean.
protected java.util.Map listeners
protected IWizardStep sourceState
| Constructor Detail |
public Wizard()
| Method Detail |
public void addListener(IWizardListener listener)
addListener in interface IWizardpublic boolean back()
back in interface IWizardprotected boolean canLeave(int event)
event - event that is occurring now, like moving to next step
public void clearWizardErrors()
clearWizardErrors in interface IWizard
public static IWizardStep findNode(IWizardStep state,
java.lang.String name)
Important: starting state itself is not checked
state - the state where to start search, this state itself is not
verified and must be checked outside this methodname - the name of the state to look for
public boolean forward()
forward in interface IWizardIWizardStep.addOutgoingTransition(IWizardTransition)public IWizardStep getCurrentStep()
getCurrentStep in interface IWizardpublic java.lang.String getCurrentStepName()
getCurrentStepName in interface IWizardpublic java.util.Map getListeners()
public IWizardStep getSourceStep()
getSourceStep in interface IWizardpublic IWizardStep getStepByName(java.lang.String name)
getStepByName in interface IWizardname - state name
public java.util.Map getWizardErrors()
Concrete implementation must provide a valid reference to message map, if it wants to return messages from Rule Engine.
getWizardErrors in interface IWizardpublic boolean isCompleted()
isCompleted in interface IWizardprotected boolean isLastStep()
public void removeAllListeners()
removeAllListeners in interface IWizardpublic void removeListener(IWizardListener listener)
removeListener in interface IWizardpublic void wizardReset()
IWizard
wizardReset in interface IWizard