javax.faces.application
Class StateManagerWrapper

java.lang.Object
  extended by javax.faces.application.StateManager
      extended by javax.faces.application.StateManagerWrapper
All Implemented Interfaces:
FacesWrapper<StateManager>

public abstract class StateManagerWrapper
extends StateManager
implements FacesWrapper<StateManager>

see Javadoc of JSF Specification

Author:
Stan Silvert

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.faces.application.StateManager
StateManager.SerializedView
 
Field Summary
 
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, STATE_SAVING_METHOD_CLIENT, STATE_SAVING_METHOD_PARAM_NAME, STATE_SAVING_METHOD_SERVER
 
Constructor Summary
StateManagerWrapper()
           
 
Method Summary
protected  Object getComponentStateToSave(FacesContext context)
          Return data that can be applied to a component tree created using the "getTreeStructureToSave" method.
protected  Object getTreeStructureToSave(FacesContext context)
          Return data that is sufficient to recreate the component tree that is the viewroot of the specified context, but without restoring the state in the components.
 String getViewState(FacesContext context)
          TODO: This method should be called from somewhere when ajax response is created to update the state saving param on client.
abstract  StateManager getWrapped()
          A class that implements this interface uses this method to return an instance of the class being wrapped.
 boolean isSavingStateInClient(FacesContext context)
           
protected  void restoreComponentState(FacesContext context, UIViewRoot viewRoot, String renderKitId)
           
protected  UIViewRoot restoreTreeStructure(FacesContext context, String viewId, String renderKitId)
           
 UIViewRoot restoreView(FacesContext context, String viewId, String renderKitId)
           
 StateManager.SerializedView saveSerializedView(FacesContext context)
          Invokes getTreeStructureToSave and getComponentStateToSave, then return an object that wraps the two resulting objects.
 Object saveView(FacesContext context)
          Returns an object that is sufficient to recreate the component tree that is the viewroot of the specified context.
 void writeState(FacesContext context, Object state)
          Associate the provided state object with the current response being generated.
 void writeState(FacesContext context, StateManager.SerializedView state)
          Associate the provided state object with the current response being generated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateManagerWrapper

public StateManagerWrapper()
Method Detail

getWrapped

public abstract StateManager getWrapped()
Description copied from interface: FacesWrapper
A class that implements this interface uses this method to return an instance of the class being wrapped.

Specified by:
getWrapped in interface FacesWrapper<StateManager>
Returns:
the instance of the class being wrapped

saveSerializedView

public StateManager.SerializedView saveSerializedView(FacesContext context)
Description copied from class: StateManager
Invokes getTreeStructureToSave and getComponentStateToSave, then return an object that wraps the two resulting objects. This object can then be passed to method writeState.

Deprecated; use saveView instead.

Overrides:
saveSerializedView in class StateManager

saveView

public Object saveView(FacesContext context)
Description copied from class: StateManager
Returns an object that is sufficient to recreate the component tree that is the viewroot of the specified context.

The return value is suitable for passing to method writeState.

Overrides:
saveView in class StateManager

isSavingStateInClient

public boolean isSavingStateInClient(FacesContext context)
Overrides:
isSavingStateInClient in class StateManager

getTreeStructureToSave

protected Object getTreeStructureToSave(FacesContext context)
Description copied from class: StateManager
Return data that is sufficient to recreate the component tree that is the viewroot of the specified context, but without restoring the state in the components.

Using this data, a tree of components which has the same "shape" as the original component tree can be recreated. However the component instances themselves will have only their default values, ie their member fields will not have been set to the original values.

Deprecated; use saveView instead.

Overrides:
getTreeStructureToSave in class StateManager

getComponentStateToSave

protected Object getComponentStateToSave(FacesContext context)
Description copied from class: StateManager
Return data that can be applied to a component tree created using the "getTreeStructureToSave" method.

Deprecated; use saveView instead.

Overrides:
getComponentStateToSave in class StateManager

writeState

public void writeState(FacesContext context,
                       StateManager.SerializedView state)
                throws IOException
Description copied from class: StateManager
Associate the provided state object with the current response being generated.

When client-side state is enabled, it is expected that method writes the data contained in the state parameter to the response somehow.

When server-side state is enabled, at most a "token" is expected to be written.

Deprecated; use writeState(FacesContext, Object) instead. This method was abstract in JSF1.1, but is now an empty non-abstract method so that old classes that implement this method continue to work, while new classes can just override the new writeState method rather than this one.

Overrides:
writeState in class StateManager
Throws:
IOException - never

writeState

public void writeState(FacesContext context,
                       Object state)
                throws IOException
Description copied from class: StateManager
Associate the provided state object with the current response being generated.

When client-side state is enabled, it is expected that method writes the data contained in the state parameter to the response somehow.

When server-side state is enabled, at most a "token" is expected to be written.

This method should be overridden by subclasses. It is not abstract because a default implementation is provided that forwards to the old writeState method; this allows subclasses of StateManager written using the JSF1.1 API to continue to work.

Overrides:
writeState in class StateManager
Throws:
IOException

restoreView

public UIViewRoot restoreView(FacesContext context,
                              String viewId,
                              String renderKitId)
Specified by:
restoreView in class StateManager

restoreTreeStructure

protected UIViewRoot restoreTreeStructure(FacesContext context,
                                          String viewId,
                                          String renderKitId)
Overrides:
restoreTreeStructure in class StateManager

restoreComponentState

protected void restoreComponentState(FacesContext context,
                                     UIViewRoot viewRoot,
                                     String renderKitId)
Overrides:
restoreComponentState in class StateManager

getViewState

public String getViewState(FacesContext context)
Description copied from class: StateManager
TODO: This method should be called from somewhere when ajax response is created to update the state saving param on client. The place where this method is called is an implementation detail, so there is no references about from where in the spec javadoc.

Overrides:
getViewState in class StateManager
Returns:


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.