Spring Web Flow

org.springframework.faces.webflow
Class FlowViewStateManager

java.lang.Object
  extended by javax.faces.application.StateManager
      extended by org.springframework.faces.webflow.FlowViewStateManager

public class FlowViewStateManager
extends javax.faces.application.StateManager

Custom StateManager that manages the JSF component state in web flow's view scope.

Author:
Jeremy Grelle, Rossen Stoyanchev

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.faces.application.StateManager
javax.faces.application.StateManager.SerializedView
 
Field Summary
protected static java.lang.String SERIALIZED_VIEW_STATE
           
 
Fields inherited from class javax.faces.application.StateManager
FULL_STATE_SAVING_VIEW_IDS_PARAM_NAME, IS_BUILDING_INITIAL_STATE, IS_SAVING_STATE, PARTIAL_STATE_SAVING_PARAM_NAME, SERIALIZE_SERVER_STATE_PARAM_NAME, STATE_SAVING_METHOD_CLIENT, STATE_SAVING_METHOD_PARAM_NAME, STATE_SAVING_METHOD_SERVER
 
Constructor Summary
FlowViewStateManager(javax.faces.application.StateManager delegate)
           
 
Method Summary
protected  java.lang.Object getComponentStateToSave(javax.faces.context.FacesContext context)
           
protected  java.lang.Object getTreeStructureToSave(javax.faces.context.FacesContext context)
           
 java.lang.String getViewState(javax.faces.context.FacesContext context)
           
 boolean isSavingStateInClient(javax.faces.context.FacesContext context)
           
protected  void restoreComponentState(javax.faces.context.FacesContext context, javax.faces.component.UIViewRoot viewRoot, java.lang.String renderKitId)
           
protected  javax.faces.component.UIViewRoot restoreTreeStructure(javax.faces.context.FacesContext context, java.lang.String viewId, java.lang.String renderKitId)
           
 javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context, java.lang.String viewId, java.lang.String renderKitId)
           In JSF 2 where a partial state saving algorithm is used, this method merely delegates to the next ViewStateManager.
 javax.faces.application.StateManager.SerializedView saveSerializedView(javax.faces.context.FacesContext context)
          JSF 1.1 version of state saving
 java.lang.Object saveView(javax.faces.context.FacesContext context)
           JSF 1.2 (or higher) version of state saving.
 void writeState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 void writeState(javax.faces.context.FacesContext context, javax.faces.application.StateManager.SerializedView state)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERIALIZED_VIEW_STATE

protected static final java.lang.String SERIALIZED_VIEW_STATE
See Also:
Constant Field Values
Constructor Detail

FlowViewStateManager

public FlowViewStateManager(javax.faces.application.StateManager delegate)
Method Detail

getComponentStateToSave

protected java.lang.Object getComponentStateToSave(javax.faces.context.FacesContext context)
Overrides:
getComponentStateToSave in class javax.faces.application.StateManager

getTreeStructureToSave

protected java.lang.Object getTreeStructureToSave(javax.faces.context.FacesContext context)
Overrides:
getTreeStructureToSave in class javax.faces.application.StateManager

restoreComponentState

protected void restoreComponentState(javax.faces.context.FacesContext context,
                                     javax.faces.component.UIViewRoot viewRoot,
                                     java.lang.String renderKitId)
Overrides:
restoreComponentState in class javax.faces.application.StateManager

restoreTreeStructure

protected javax.faces.component.UIViewRoot restoreTreeStructure(javax.faces.context.FacesContext context,
                                                                java.lang.String viewId,
                                                                java.lang.String renderKitId)
Overrides:
restoreTreeStructure in class javax.faces.application.StateManager

writeState

public void writeState(javax.faces.context.FacesContext context,
                       javax.faces.application.StateManager.SerializedView state)
                throws java.io.IOException
Overrides:
writeState in class javax.faces.application.StateManager
Throws:
java.io.IOException

writeState

public void writeState(javax.faces.context.FacesContext context,
                       java.lang.Object state)
                throws java.io.IOException
Overrides:
writeState in class javax.faces.application.StateManager
Throws:
java.io.IOException

isSavingStateInClient

public boolean isSavingStateInClient(javax.faces.context.FacesContext context)
Overrides:
isSavingStateInClient in class javax.faces.application.StateManager

saveSerializedView

public javax.faces.application.StateManager.SerializedView saveSerializedView(javax.faces.context.FacesContext context)
JSF 1.1 version of state saving

Overrides:
saveSerializedView in class javax.faces.application.StateManager

saveView

public java.lang.Object saveView(javax.faces.context.FacesContext context)

JSF 1.2 (or higher) version of state saving.

In JSF 2, if partial state saving is enabled this method delegates in order to obtain the serialized view state. During rendering JSF calls this method to prepare the state and then calls FlowViewResponseStateManager which writes it to Web Flow's view scope.

Nevertheless this method always writes the serialized state to Web Flow's view scope to ensure it is up-to-date for cases outside of rendering (e.g. ViewState.updateHistory()) or when the render phase doesn't call FlowViewResponseStateManager such as when processing a partial request.

Overrides:
saveView in class javax.faces.application.StateManager

restoreView

public javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context,
                                                    java.lang.String viewId,
                                                    java.lang.String renderKitId)

In JSF 2 where a partial state saving algorithm is used, this method merely delegates to the next ViewStateManager. Thus partial state saving is handled by the JSF 2 runtime. However, a FlowViewResponseStateManager plugged in via FlowRenderKit will ensure the state is saved in a Web Flow view-scoped variable.

Specified by:
restoreView in class javax.faces.application.StateManager

getViewState

public java.lang.String getViewState(javax.faces.context.FacesContext context)
Overrides:
getViewState in class javax.faces.application.StateManager

Spring Web Flow