Class ViewState
java.lang.Object
org.springframework.webflow.core.AnnotatedObject
org.springframework.webflow.engine.State
org.springframework.webflow.engine.TransitionableState
org.springframework.webflow.engine.ViewState
- All Implemented Interfaces:
Annotated
,StateDefinition
,TransitionableStateDefinition
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:
-
Field Summary
Fields inherited from class org.springframework.webflow.core.AnnotatedObject
CAPTION_PROPERTY, DESCRIPTION_PROPERTY
-
Constructor Summary
ConstructorDescriptionViewState
(Flow flow, String id, ViewFactory viewFactory) Create a new view state. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Returns whether this view state should request a flow execution redirect when entered.Returns the list of actions executable by this view state on entry and on refresh.getVariable
(String name) Returns the view variable with the given name.Returns the configured view variables.Returns the view factory.boolean
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
(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.core.Annotated
getAttributes, getCaption, getDescription
Methods inherited from interface org.springframework.webflow.definition.StateDefinition
getId, getOwner
-
Constructor Details
-
ViewState
Create a new view state.- Parameters:
flow
- the owning flowid
- the state identifier (must be unique to the flow)viewFactory
- the view factory- Throws:
IllegalArgumentException
- when this state cannot be added to given flow, e.g. because the id is not unique
-
-
Method Details
-
isViewState
public boolean isViewState()Description copied from interface:StateDefinition
Returns true if this state is a view state.- Specified by:
isViewState
in interfaceStateDefinition
- Overrides:
isViewState
in classState
- Returns:
- true if a view state, false otherwise
-
addVariable
Adds a view variable.- Parameters:
variable
- the variable
-
addVariables
Adds a set of view variables.- Parameters:
variables
- the variables
-
getVariable
Returns the view variable with the given name.- Parameters:
name
- the name of the variable
-
getVariables
Returns the configured view variables. -
getRedirect
public boolean getRedirect()Returns whether this view state should request a flow execution redirect when entered. -
setRedirect
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
Returns the view factory. -
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
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 classState
- Parameters:
context
- the request control context- Throws:
FlowExecutionException
- if an exception occurs
-
doEnter
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 classState
- 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
-
exit
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 classTransitionableState
- 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 classTransitionableState
- Parameters:
creator
- the toString creator, to print properties to string- See Also:
-