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
ConstructorsConstructorDescriptionViewState(Flow flow, String id, ViewFactory viewFactory) Create a new view state. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddVariable(ViewVariable variable) Adds a view variable.voidaddVariables(ViewVariable... variables) Adds a set of view variables.protected voidappendToString(org.springframework.core.style.ToStringCreator creator) Subclasses may override this hook method to print their internal state to a string.protected voiddoEnter(RequestControlContext context) Hook method to execute custom behavior as a result of entering this state.protected voiddoPreEntryActions(RequestControlContext context) Hook method to execute before running state entry actions upon state entry.voidexit(RequestControlContext context) Exit this state.booleangetPopup()Returns whether this view state should render as a popup.booleanReturns 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.booleanReturns true if this state is a view state.voidresume(RequestControlContext context) voidsetPopup(boolean popup) Sets whether this view state should render as a popup.voidsetRedirect(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, handleEventMethods inherited from class org.springframework.webflow.engine.State
enter, equals, getEntryActionList, getExceptionHandlerSet, getFlow, getId, getOwner, handleException, hashCode, isStartState, toStringMethods inherited from class org.springframework.webflow.core.AnnotatedObject
getAttributes, getCaption, getDescription, setCaption, setDescriptionMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.webflow.core.Annotated
getAttributes, getCaption, getDescriptionMethods 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:StateDefinitionReturns true if this state is a view state.- Specified by:
isViewStatein interfaceStateDefinition- Overrides:
isViewStatein 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:StateHook method to execute before running state entry actions upon state entry. Does nothing by default. Subclasses may override.- Overrides:
doPreEntryActionsin classState- Parameters:
context- the request control context- Throws:
FlowExecutionException- if an exception occurs
-
doEnter
Description copied from class:StateHook 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:
doEnterin 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:TransitionableStateExit 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:
exitin classTransitionableState- Parameters:
context- the flow control context
-
appendToString
protected void appendToString(org.springframework.core.style.ToStringCreator creator) Description copied from class:StateSubclasses may override this hook method to print their internal state to a string. This default implementation does nothing.- Overrides:
appendToStringin classTransitionableState- Parameters:
creator- the toString creator, to print properties to string- See Also:
-