| public static final String | STATE_SAVING_METHOD_PARAM_NAME | The ServletContext init parameter consulted by
the StateManager to tell where the state should be
saved. Valid values are given as the values of the constants:
#STATE_SAVING_METHOD_CLIENT or #STATE_SAVING_METHOD_SERVER .
If this parameter is not specified, the default value is the
value of the constant #STATE_SAVING_METHOD_CLIENT . |
| Method from javax.faces.application.StateManager Detail: |
protected Object getComponentStateToSave(FacesContext context) {
return null;
} Deprecated! the - distinction between tree structure and component
state is now an implementation detail. The default
implementation returns null.
Convenience method, which must be called by
saveSerializedView(), to construct and return a
Serializable object that represents the state of
all component properties, attributes, and attached objects, for
the entire component tree (including children and facets)
of this view.
Components may opt-out of being included in the component state
by setting their transient property to true.
This must cause the component itself, as well as all of that component's
children and facets, to be omitted from the saved component state
information.
|
protected Object getTreeStructureToSave(FacesContext context) {
return null;
} Deprecated! the - distinction between tree structure and component
state is now an implementation detail. The default
implementation returns null.
Convenience method, which must be called by
saveSerializedView(), to construct and return a
Serializable object that represents the structure
of the entire component tree (including children and facets)
of this view.
Components may opt-out of being included in the tree structure
by setting their transient property to true.
This must cause the component itself, as well as all of that component's
children and facets, to be omitted from the saved tree structure
information.
|
public boolean isSavingStateInClient(FacesContext context) {
if (null != savingStateInClient) {
return savingStateInClient.booleanValue();
}
savingStateInClient = Boolean.FALSE;
String saveStateParam = context.getExternalContext().
getInitParameter(STATE_SAVING_METHOD_PARAM_NAME);
if (saveStateParam != null &&
saveStateParam.equalsIgnoreCase(STATE_SAVING_METHOD_CLIENT)) {
savingStateInClient = Boolean.TRUE;
}
return savingStateInClient.booleanValue();
}
|
protected void restoreComponentState(FacesContext context,
UIViewRoot viewRoot,
String renderKitId) {
} Deprecated! the - distinction between tree structure and component
state is now an implementation detail. The default
implementation does nothing.
Convenience method, which must be called by
restoreView(), to restore the attributes, properties,
and attached objects of all components in the restored component tree.
|
protected UIViewRoot restoreTreeStructure(FacesContext context,
String viewId,
String renderKitId) {
return null;
} Deprecated! the - distinction between tree structure and component
state is now an implementation detail. The default
implementation returns null.
Convenience method, which must be called by
restoreView(), to construct and return a UIViewRoot
instance (populated with children and facets) representing the
tree structure of the component tree being restored. If no saved
state information is available, return null instead.
|
abstract public UIViewRoot restoreView(FacesContext context,
String viewId,
String renderKitId)
Restore the tree structure and the component state of the view
for the specified viewId, in an implementation dependent
manner, and return the restored UIViewRoot . If there is no
saved state information available for this viewId,
return null instead.
This method must consult the context initialization parameter
named by the symbolic constant
StateManager.STATE_SAVING_METHOD_PARAMETER_NAME
to determine whether state should be saved on the client or the
server. If not present, client side state saving is assumed.
If the init parameter indicates that client side state
saving should be used, this method must call the
getTreeStructureToRestore() and (if the previous method
call returned a non-null value) getComponentStateToRestore()
methods of the ResponseStateManager instance provided by the
RenderKit responsible for this view.
|
public StateManager.SerializedView saveSerializedView(FacesContext context) {
// ---------------------------------------------------- State Saving Methods
return null;
} Deprecated! this - has been replaced by #saveView . The
default implementation returns null.
Return the tree structure and component state information for the
view contained in the specified FacesContext instance as an
object of type StateManager.SerializedView. If there
is no state information to be saved, return null
instead.
Components may opt out of being included in the serialized view
by setting their transient property to true.
This must cause the component itself, as well as all of that component's
children and facets, to be omitted from the saved tree structure
and component state information.
This method must also enforce the rule that, for components with
non-null ids, all components that are descendants of the
same nearest NamingContainer must have unique identifiers.
|
public Object saveView(FacesContext context) {
SerializedView view = saveSerializedView(context);
Object stateArray[] = {view.getStructure(),
view.getState()};
return stateArray;
}
Return an opaque Object containing sufficient
information for this same instance to restore the state of the
current UIViewRoot on a subsequent request. The returned
object must implement java.io.Serializable. If there
is no state information to be saved, return null
instead.
Components may opt out of being included in the serialized view
by setting their transient property to true.
This must cause the component itself, as well as all of that component's
children and facets, to be omitted from the saved tree structure
and component state information.
This method must also enforce the rule that, for components with
non-null ids, all components that are descendants of the
same nearest NamingContainer must have unique identifiers.
For backwards compatability with existing
StateManager implementations, the default
implementation of this method calls #saveSerializedView
and creates and returns a two element Object array
with element zero containing the structure property
and element one containing the state property of the
SerializedView.
|
public void writeState(FacesContext context,
Object state) throws IOException {
if (null != state && state.getClass().isArray() &&
state.getClass().getComponentType().equals(Object.class)) {
Object stateArray[] = (Object[]) state;
if (2 == stateArray.length) {
SerializedView view = new SerializedView(stateArray[0],
stateArray[1]);
writeState(context, view);
}
}
}
Save the state represented in the specified state
Object instance, in an implementation dependent
manner.
This method will typically simply delegate the actual
writing to the writeState() method of the
ResponseStateManager instance provided by the
RenderKit being used to render this view. This
method assumes that the caller has positioned the
ResponseWriter at the correct position for the
saved state to be written.
For backwards compatability with existing
StateManager implementations, the default
implementation of this method checks if the argument is an
instance of Object [] of length greater than or
equal to two. If so, it creates a SerializedView
instance with the tree structure coming from element zero and
the component state coming from element one and calls through to
#writeState(javax.faces.context.FacesContext,javax.faces.application.StateManager.SerializedView) .
If not, does nothing.
|
public void writeState(FacesContext context,
StateManager.SerializedView state) throws IOException {
} Deprecated! This - method has been replaced by #writeState(javax.faces.context.FacesContext,java.lang.Object) .
The default implementation of this method does nothing.
Save the state represented in the specified
SerializedView isntance, in an implementation
dependent manner.
This method must consult the context initialization parameter
named by the symbolic constant
StateManager.STATE_SAVING_METHOD_PARAMETER_NAME
to determine whether state should be saved on the client or the
server. If not present, client side state saving is assumed.
If the init parameter indicates that client side state
saving should be used, this method must delegate the actual
writing to the writeState() method of the
ResponseStateManager instance provided by the
RenderKit being used to render this view. This
method assumes that the caller has positioned the
ResponseWriter at the correct position for the
saved state to be written.
|