net.jspcontrols.wizard.impl
Class WizardStep

java.lang.Object
  extended bynet.jspcontrols.wizard.impl.WizardStep
All Implemented Interfaces:
IWizardStep
Direct Known Subclasses:
StepConfirm, StepDetails, StepSignup

public abstract class WizardStep
extends java.lang.Object
implements IWizardStep

Represents a state of a wizard Finite State Machine (FSM). Contains common navigation methods. Derived concrete state should also contain setters/getters for domain data, relevant to this state.


Field Summary
protected  IWizardTransition incomingTransition
          Incoming transition.
protected  java.lang.String stateName
          The name of this state
protected  IWizard wizard
          Master wizard object; this reference can be used to access common data defined in the wizard object itself.
 
Constructor Summary
WizardStep(IWizard owner, java.lang.String name)
          Constructs the state, sets a name and stores a reference to the owner wizard object.
 
Method Summary
 void addOutgoingTransition(IWizardTransition value)
          Adds an outgoing transition.
static boolean checkTraverseBack(IWizardStep startState, IWizardStep searchState)
          Verifies if a state is included in the path to the current state
 IWizardTransition getIncomingTransition()
          Returns incoming transition for this state, used during actual wizard traversal
 IWizardTransition getOutgoingTransition()
          Returns a transition which will be chosen if a "next" command is selected for this node.
 IWizardTransition[] getOutgoingTransitions()
          Returns array of outgoing transitions in the same order in which they were added by addOutgoingTransition() method.
 java.lang.String getStateName()
          Returns the state name
 IWizard getWizard()
          Returns master wizard object
 boolean isCheckpoint()
          Returns true if this state is marked as checkpoint
 boolean isStateInPath()
          Verifies that this state is included in the path to the current state (the current state is past this state).
 void setCheckpoint(boolean checkpoint)
          Sets this state as checkpoint.
 void setIncomingTransition(IWizardTransition value)
          Sets incoming transition, used by wizard controller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.jspcontrols.wizard.intf.IWizardStep
resetBooleans
 

Field Detail

incomingTransition

protected IWizardTransition incomingTransition
Incoming transition.


stateName

protected java.lang.String stateName
The name of this state


wizard

protected IWizard wizard
Master wizard object; this reference can be used to access common data defined in the wizard object itself.

Constructor Detail

WizardStep

public WizardStep(IWizard owner,
                  java.lang.String name)
Constructs the state, sets a name and stores a reference to the owner wizard object.

Parameters:
owner - owner wizard object, cannot be null
name - name of this state, cannot be null, must be unique within the wizard
Method Detail

addOutgoingTransition

public void addOutgoingTransition(IWizardTransition value)
Adds an outgoing transition. Transitions must be added in the order of their weight, the edge with highest weight must be added first.

Future versions may support dynamic adjustment of weight, this version does not support it.

Specified by:
addOutgoingTransition in interface IWizardStep
Parameters:
value - outgoing transition

checkTraverseBack

public static boolean checkTraverseBack(IWizardStep startState,
                                        IWizardStep searchState)
Verifies if a state is included in the path to the current state

Parameters:
startState - the state where to start backward traversal
searchState - the state which we are looking for in the travseral path
Returns:
true if searchNode is found in the actual path while traversing back from startNode; false otherwise.

getIncomingTransition

public IWizardTransition getIncomingTransition()
Returns incoming transition for this state, used during actual wizard traversal

Specified by:
getIncomingTransition in interface IWizardStep
Returns:
incoming transition for this node

getOutgoingTransition

public IWizardTransition getOutgoingTransition()
Returns a transition which will be chosen if a "next" command is selected for this node.

All outbound transitions are validated in the order they were added to this state. The first valid transition is chosen.

Specified by:
getOutgoingTransition in interface IWizardStep
Returns:
a first valid outgoing transition or null if no valid transitions found

getOutgoingTransitions

public IWizardTransition[] getOutgoingTransitions()
Returns array of outgoing transitions in the same order in which they were added by addOutgoingTransition() method.

Specified by:
getOutgoingTransitions in interface IWizardStep
Returns:
array of outbound transitions, the transition with the most weight is returned first.

getStateName

public java.lang.String getStateName()
Returns the state name

Specified by:
getStateName in interface IWizardStep
Returns:
state name

getWizard

public IWizard getWizard()
Returns master wizard object

Specified by:
getWizard in interface IWizardStep
Returns:
master wizard object

isCheckpoint

public boolean isCheckpoint()
Returns true if this state is marked as checkpoint

Specified by:
isCheckpoint in interface IWizardStep
Returns:
true if this state is marked as checkpoint

isStateInPath

public boolean isStateInPath()
Verifies that this state is included in the path to the current state (the current state is past this state).

Specified by:
isStateInPath in interface IWizardStep
Returns:
true if this state is found in the actual path from the initial state to the current state; false otherwise.

setCheckpoint

public void setCheckpoint(boolean checkpoint)
Sets this state as checkpoint. This should be done before wizard is traversed back from this state.

Parameters:
checkpoint - true if this state should be marked as checkpoint

setIncomingTransition

public void setIncomingTransition(IWizardTransition value)
Sets incoming transition, used by wizard controller. Defined as public because it belongs to the IWizardStep interface.

Specified by:
setIncomingTransition in interface IWizardStep
Parameters:
value - incoming transition