Spring Web Flow

org.springframework.webflow.engine
Class ViewState

java.lang.Object
  extended by org.springframework.webflow.core.AnnotatedObject
      extended by org.springframework.webflow.engine.State
          extended by org.springframework.webflow.engine.TransitionableState
              extended by org.springframework.webflow.engine.ViewState
All Implemented Interfaces:
Annotated, StateDefinition, TransitionableStateDefinition

public class ViewState
extends TransitionableState

A view state is a state that issues a response to the user, for example, for soliciting form input. To accomplish this, a ViewState delegates to a ViewFactory.

Author:
Keith Donald, Erwin Vervaet
See Also:
ViewFactory

Field Summary
 
Fields inherited from class org.springframework.webflow.engine.State
logger
 
Fields inherited from class org.springframework.webflow.core.AnnotatedObject
CAPTION_PROPERTY, DESCRIPTION_PROPERTY
 
Constructor Summary
ViewState(Flow flow, java.lang.String id, ViewFactory viewFactory)
          Create a new view state.
 
Method Summary
 void addVariable(ViewVariable variable)
          Adds a view variable.
 void addVariables(ViewVariable... variables)
          Adds a set of view variables.
protected  void appendToString(org.springframework.core.style.ToStringCreator creator)
          Subclasses may override this hook method to print their internal state to a string.
protected  void doEnter(RequestControlContext context)
          Hook method to execute custom behavior as a result of entering this state.
protected  void doPreEntryActions(RequestControlContext context)
          Hook method to execute before running state entry actions upon state entry.
 void exit(RequestControlContext context)
          Exit this state.
 boolean getPopup()
          Returns whether this view state should render as a popup.
 boolean getRedirect()
          Returns whether this view state should request a flow execution redirect when entered.
 ActionList getRenderActionList()
          Returns the list of actions executable by this view state on entry and on refresh.
 ViewVariable getVariable(java.lang.String name)
          Returns the view variable with the given name.
 ViewVariable[] getVariables()
          Returns the configured view variables.
 ViewFactory getViewFactory()
          Returns the view factory.
 boolean isViewState()
          Returns true if this state is a view state.
 void resume(RequestControlContext context)
           
 void setPopup(boolean popup)
          Sets whether this view state should render as a popup.
 void setRedirect(java.lang.Boolean redirect)
          Sets whether this view state should requests a flow execution redirect when entered.
 
Methods inherited from class org.springframework.webflow.engine.TransitionableState
getExitActionList, getRequiredTransition, getTransition, getTransitions, getTransitionSet, handleEvent
 
Methods inherited from class org.springframework.webflow.engine.State
enter, equals, getEntryActionList, getExceptionHandlerSet, getFlow, getId, getOwner, handleException, hashCode, isStartState, toString
 
Methods inherited from class org.springframework.webflow.core.AnnotatedObject
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.core.Annotated
getAttributes, getCaption, getDescription
 

Constructor Detail

ViewState

public ViewState(Flow flow,
                 java.lang.String id,
                 ViewFactory viewFactory)
          throws java.lang.IllegalArgumentException
Create a new view state.

Parameters:
flow - the owning flow
id - the state identifier (must be unique to the flow)
viewFactory - the view factory
Throws:
java.lang.IllegalArgumentException - when this state cannot be added to given flow, e.g. because the id is not unique
Method Detail

isViewState

public boolean isViewState()
Description copied from interface: StateDefinition
Returns true if this state is a view state.

Specified by:
isViewState in interface StateDefinition
Overrides:
isViewState in class State
Returns:
true if a view state, false otherwise

addVariable

public void addVariable(ViewVariable variable)
Adds a view variable.

Parameters:
variable - the variable

addVariables

public void addVariables(ViewVariable... variables)
Adds a set of view variables.

Parameters:
variables - the variables

getVariable

public ViewVariable getVariable(java.lang.String name)
Returns the view variable with the given name.

Parameters:
name - the name of the variable

getVariables

public ViewVariable[] getVariables()
Returns the configured view variables.


getRedirect

public boolean getRedirect()
Returns whether this view state should request a flow execution redirect when entered.


setRedirect

public void setRedirect(java.lang.Boolean redirect)
Sets whether this view state should requests a flow execution redirect when entered.

Parameters:
redirect - the redirect flag

getPopup

public boolean getPopup()
Returns whether this view state should render as a popup.


setPopup

public void setPopup(boolean popup)
Sets whether this view state should render as a popup.

Parameters:
popup - the popup flag

getViewFactory

public ViewFactory getViewFactory()
Returns the view factory.


getRenderActionList

public ActionList getRenderActionList()
Returns the list of actions executable by this view state on entry and on refresh. The returned list is mutable.

Returns:
the state action list

doPreEntryActions

protected void doPreEntryActions(RequestControlContext context)
                          throws FlowExecutionException
Description copied from class: State
Hook method to execute before running state entry actions upon state entry. Does nothing by default. Subclasses may override.

Overrides:
doPreEntryActions in class State
Parameters:
context - the request control context
Throws:
FlowExecutionException - if an exception occurs

doEnter

protected void doEnter(RequestControlContext context)
                throws FlowExecutionException
Description copied from class: State
Hook method to execute custom behavior as a result of entering this state. By implementing this method subclasses specialize the behavior of the state.

Specified by:
doEnter in class State
Parameters:
context - the control context for the currently executing flow, used by this state to manipulate the flow execution
Throws:
FlowExecutionException - if an exception occurs in this state

resume

public void resume(RequestControlContext context)

exit

public void exit(RequestControlContext context)
Description copied from class: TransitionableState
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.

Overrides:
exit in class TransitionableState
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 print their internal state to a string. This default implementation does nothing.

Overrides:
appendToString in class TransitionableState
Parameters:
creator - the toString creator, to print properties to string
See Also:
State.toString()

Spring Web Flow