|
JSF-Spring | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.faces.application.StateManager de.mindmatters.faces.application.OptimizedStateManager
public final class OptimizedStateManager
OptimizedStateManager directs the process of saving and restoring the view between requests.
This state manager only works with a view handler of type
ViewBuilder
! Because an implemention of a ViewBuilder is
able to restore the structure of a component tree of a view without a given
serialized state this state manager writes no component structure state. This
class restores the component tree by invoking the method
ViewBuilder.buildView(FacesContext, String)
of the configured view
handler.
ViewBuilder.buildView(FacesContext, String)
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 |
---|
STATE_SAVING_METHOD_CLIENT, STATE_SAVING_METHOD_PARAM_NAME, STATE_SAVING_METHOD_SERVER |
Constructor Summary | |
---|---|
OptimizedStateManager(StateManager delegate)
Creates an OptimizedStateManager with the given state manager delegate of the underlying JSF implementation. |
Method Summary | |
---|---|
protected java.lang.Object |
getComponentStateToSave(FacesContext context)
Convenience method, which must be called by
|
protected java.lang.Object |
getTreeStructureToSave(FacesContext context)
Convenience method, which must be called by
|
protected void |
restoreComponentState(FacesContext context,
UIViewRoot viewRoot,
java.lang.String renderKitId)
Convenience method, which must be called by
|
protected UIViewRoot |
restoreTreeStructure(FacesContext context,
java.lang.String viewId,
java.lang.String renderKitId)
Convenience method, which must be called by
|
UIViewRoot |
restoreView(FacesContext context,
java.lang.String viewId,
java.lang.String renderKitId)
Restore the tree structure and the component state of the view
for the specified |
StateManager.SerializedView |
saveSerializedView(FacesContext context)
Return the tree structure and component state information for the
view contained in the specified |
void |
writeState(FacesContext context,
StateManager.SerializedView state)
Save the state represented in the specified
|
Methods inherited from class javax.faces.application.StateManager |
---|
isSavingStateInClient |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OptimizedStateManager(StateManager delegate)
delegate
of the underlying JSF implementation.
delegate
- the original state manager of the underlying JSF
implementationMethod Detail |
---|
public StateManager.SerializedView saveSerializedView(FacesContext context)
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 id
s, all components that are descendants of the
same nearest NamingContainer
must have unique identifiers.
saveSerializedView
in class StateManager
context
- FacesContext
for the current requestprotected java.lang.Object getTreeStructureToSave(FacesContext context)
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.
PENDING(craigmcc) - Does this method need to be in the public APIs?
getTreeStructureToSave
in class StateManager
context
- FacesContext
for the current requestprotected java.lang.Object getComponentStateToSave(FacesContext context)
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.
PENDING(craigmcc) - Does this method need to be in the public APIs?
getComponentStateToSave
in class StateManager
context
- FacesContext
for the current requestpublic void writeState(FacesContext context, StateManager.SerializedView state) throws java.io.IOException
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.
If the init parameter indicates that server side state
saving should be used, this method must save the state in
such a manner that it may be retrieved using only the
viewId
.
writeState
in class StateManager
context
- FacesContext
for the current requeststate
- the serialized state to be written
java.io.IOException
public UIViewRoot restoreView(FacesContext context, java.lang.String viewId, java.lang.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.
restoreView
in class StateManager
context
- FacesContext
for the current requestviewId
- View identifier of the view to be restoredrenderKitId
- the renderKitId used to render this response.
Must not be null
.protected UIViewRoot restoreTreeStructure(FacesContext context, java.lang.String viewId, java.lang.String renderKitId)
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.
PENDING(craigmcc) - Does this method need to be in the public APIs?
restoreTreeStructure
in class StateManager
context
- FacesContext
for the current requestviewId
- View identifier of the view to be restoredrenderKitId
- the renderKitId used to render this response.
Must not be null
.protected void restoreComponentState(FacesContext context, UIViewRoot viewRoot, java.lang.String renderKitId)
Convenience method, which must be called by
restoreView()
, to restore the attributes, properties,
and attached objects of all components in the restored component tree.
PENDING(craigmcc) - Does this method need to be in the public APIs?
restoreComponentState
in class StateManager
context
- FacesContext
for the current requestviewRoot
- UIViewRoot
returned by a previous call
to restoreTreeStructure()
renderKitId
- the renderKitId used to render this response.
Must not be null
.
|
JSF-Spring | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |