Class 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:
  • Constructor Details

    • ViewState

      public ViewState(Flow flow, String id, ViewFactory viewFactory) throws 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:
      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 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(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(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: