org.springframework.webflow.engine
Class TransitionableState

java.lang.Object
  extended by org.springframework.webflow.engine.AnnotatedObject
      extended by org.springframework.webflow.engine.State
          extended by org.springframework.webflow.engine.TransitionableState
All Implemented Interfaces:
Annotated, StateDefinition, TransitionableStateDefinition
Direct Known Subclasses:
ActionState, DecisionState, SubflowState, ViewState

public abstract class TransitionableState
extends State
implements TransitionableStateDefinition

Abstract superclass for states that can execute a transition in response to an event.

Author:
Keith Donald, Erwin Vervaet
See Also:
Transition, TransitionCriteria

Field Summary
 
Fields inherited from class org.springframework.webflow.engine.State
logger
 
Fields inherited from class org.springframework.webflow.engine.AnnotatedObject
CAPTION_PROPERTY, DESCRIPTION_PROPERTY
 
Constructor Summary
protected TransitionableState(Flow flow, java.lang.String id)
          Create a new transitionable state.
 
Method Summary
protected  void appendToString(org.springframework.core.style.ToStringCreator creator)
          Subclasses may override this hook method to stringify their internal state.
 void exit(RequestControlContext context)
          Exit this state.
 ActionList getExitActionList()
          Returns the list of actions executed by this state when it is exited.
 Transition getRequiredTransition(RequestContext context)
          Get a transition in this state for given flow execution request context.
 TransitionDefinition[] getTransitions()
          Returns the available transitions out of this state.
 TransitionSet getTransitionSet()
          Returns the set of transitions.
 ViewSelection onEvent(RequestControlContext context)
          Inform this state definition that an event was signaled in it.
 ViewSelection reenter(RequestControlContext context)
          Re-enter this state.
 
Methods inherited from class org.springframework.webflow.engine.State
doEnter, enter, equals, getEntryActionList, getExceptionHandlerSet, getFlow, getId, getOwner, handleException, hashCode, isStartState, toString
 
Methods inherited from class org.springframework.webflow.engine.AnnotatedObject
getAttributeMap, getAttributes, getCaption, getDescription, setCaption, setDescription
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.webflow.definition.StateDefinition
getId, getOwner
 
Methods inherited from interface org.springframework.webflow.definition.Annotated
getAttributes, getCaption, getDescription
 

Constructor Detail

TransitionableState

protected TransitionableState(Flow flow,
                              java.lang.String id)
                       throws java.lang.IllegalArgumentException
Create a new transitionable state.

Parameters:
flow - the owning flow
id - the state identifier (must be unique to the flow)
Throws:
java.lang.IllegalArgumentException - when this state cannot be added to given flow, for instance when the id is not unique
See Also:
State.State(Flow, String), getTransitionSet()
Method Detail

getTransitions

public TransitionDefinition[] getTransitions()
Description copied from interface: TransitionableStateDefinition
Returns the available transitions out of this state.

Specified by:
getTransitions in interface TransitionableStateDefinition
Returns:
the available state transitions

getTransitionSet

public TransitionSet getTransitionSet()
Returns the set of transitions. The returned set is mutable.


getRequiredTransition

public Transition getRequiredTransition(RequestContext context)
                                 throws NoMatchingTransitionException
Get a transition in this state for given flow execution request context. Throws and exception when there is no corresponding transition.

Throws:
NoMatchingTransitionException - when a matching transition cannot be found

getExitActionList

public ActionList getExitActionList()
Returns the list of actions executed by this state when it is exited. The returned list is mutable.

Returns:
the state exit action list

onEvent

public ViewSelection onEvent(RequestControlContext context)
                      throws NoMatchingTransitionException
Inform this state definition that an event was signaled in it. The signaled event is the last event available in given request context (RequestContext.getLastEvent()).

Parameters:
context - the flow execution control context
Returns:
the selected view
Throws:
NoMatchingTransitionException - when a matching transition cannot be found

reenter

public ViewSelection reenter(RequestControlContext context)
Re-enter this state. This is typically called when a transition out of this state is selected, but transition execution rolls back and as a result the flow reenters the source state.

By default, this just calls enter().

Parameters:
context - the flow control context in an executing flow (a client instance of a flow)
Returns:
a view selection containing model and view information needed to render the results of the state processing

exit

public void exit(RequestControlContext context)
Exit this state. This is typically called when a transition takes the flow out of this state into another state. By default just executes any registered exit actions.

Parameters:
context - the flow control context

appendToString

protected void appendToString(org.springframework.core.style.ToStringCreator creator)
Description copied from class: State
Subclasses may override this hook method to stringify their internal state. This default implementation does nothing.

Overrides:
appendToString in class State
Parameters:
creator - the toString creator, to stringify properties


Copyright © 2004-2007. All Rights Reserved.