net.jspcontrols.wizard.intf
Interface IWizard

All Known Implementing Classes:
Wizard

public interface IWizard

This interface defines an Easy Wizard controller. The wizard controller contains references to wizard steps and transitions, and allows to move from one step to another.


Method Summary
 void addListener(IWizardListener listener)
          Adds a listener for state change event.
 boolean back()
          Attempts to move to the previous step.
 void clearWizardErrors()
          Clean wizard errors.
 boolean forward()
          Attempts to move to the next step.
 IWizardStep getCurrentStep()
          Locates the current step of this wizard.
 java.lang.String getCurrentStepName()
          Returns a mapping name for a wizard panel.
 IWizardStep getSourceStep()
          Locates the initial step of this wizard.
 IWizardStep getStepByName(java.lang.String name)
          Locates a step by its name.
 java.util.Map getWizardErrors()
          Returns errors for current wizard state.
 boolean isCompleted()
          Returns wizard completion status.
 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.
 

Method Detail

addListener

public void addListener(IWizardListener listener)
Adds a listener for state change event.


back

public boolean back()
Attempts to move to the previous step. If the previous step does not exist or the current step is the initial step of the wizard, stays on the current step. Transition is not validated while traversing back.

Returns:
true if was able to move to a previous step, false otherwise

clearWizardErrors

public void clearWizardErrors()
Clean wizard errors. Just in case. Usually Wizard Manager cleans errors if needed.


forward

public boolean forward()
Attempts to move to the next step. If it is not possible, stays on the current step.

Easy Wizard does not blindly choose a transition based on input command or event. Instead, it iterates over all transitions defined for current step, validates them, and chooses th one which is valid. If several transitions happen to be valid, the first one is chosen.

Returns:
true if was able to move to a next step, false otherwise
See Also:
IWizardStep.addOutgoingTransition(IWizardTransition)

getCurrentStep

public IWizardStep getCurrentStep()
Locates the current step of this wizard.

Returns:
the current step of this wizard

getCurrentStepName

public java.lang.String getCurrentStepName()
Returns a mapping name for a wizard panel. Usually wizard step name is used as mapping name.

Returns:
mapping name for a wizard view, usually path to JSP page

getSourceStep

public IWizardStep getSourceStep()
Locates the initial step of this wizard.

Returns:
the initial step of this wizard

getStepByName

public IWizardStep getStepByName(java.lang.String name)
Locates a step by its name. Step name is used by clients of wizard controller, for example by Dialog Manager to refer to a corresponding view.

Parameters:
name - step name
Returns:
the first step found traversing forward from the initial step, having passed name; or null if the step not found.

getWizardErrors

public java.util.Map getWizardErrors()
Returns errors for current wizard state.

Returns:
error messages for current wizard state

isCompleted

public boolean isCompleted()
Returns wizard completion status. This method is redundant, but is defined to hide Wizard instance from WizardAction.

Returns:
true is wizard was successfully completed and disposed; false if wizard is still active or has not been initialized yet.

removeAllListeners

public void removeAllListeners()
Removes all wizard listeners for state change event.


removeListener

public void removeListener(IWizardListener listener)
Removes a listener for state change event.


wizardReset

public void wizardReset()
Resets certain wizard fields, like booleans. Called with every user input. The primary reason for this method is older frameworks like Struts, which use default HTTP handling of boolean properties, and do not notifiy a property when it is cleared.