|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: NESTED | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |
javax.faces.application Class StateManager
java.lang.Object javax.faces.application.StateManager
- 直接已知子类:
- StateManagerWrapper
public abstract class StateManager
- extends Object
StateManager directs the process of saving and
restoring the view between requests. The StateManager
instance for an application is retrieved from the Application
instance, and thus cannot know any details of the markup language
created by the RenderKit
being used to render a view. The
StateManager
utilizes a helper object (ResponseStateManager
), that is provided by the RenderKit
implementation and is therefore aware of the markup language
details.
嵌套类摘要 | |
---|---|
class |
StateManager.SerializedView
Deprecated. This class was not marked Serializable
in the 1.0 version of the spec. It was also not a static inner
class, so it can't be made to be Serializable .
Therefore, it is being deprecated in version 1.2 of the spec.
The replacement is to use an implementation dependent
Object . |
字段摘要 | |
---|---|
static String |
STATE_SAVING_METHOD_CLIENT
Constant value for the initialization parameter named by the STATE_SAVING_METHOD_PARAM_NAME that indicates
state saving should take place on the client. |
static String |
STATE_SAVING_METHOD_PARAM_NAME
The ServletContext init parameter consulted by
the StateManager to tell where the state should be
saved. |
static String |
STATE_SAVING_METHOD_SERVER
Constant value for the initialization parameter named by the STATE_SAVING_METHOD_PARAM_NAME that indicates
state saving should take place on the server. |
构造器摘要 | |
---|---|
StateManager()
|
方法摘要 | |
---|---|
protected Object |
getComponentStateToSave(FacesContext context)
Deprecated. the distinction between tree structure and component state is now an implementation detail. The default implementation returns null . |
protected Object |
getTreeStructureToSave(FacesContext context)
Deprecated. the distinction between tree structure and component state is now an implementation detail. The default implementation returns null . |
boolean |
isSavingStateInClient(FacesContext context)
|
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. |
protected UIViewRoot |
restoreTreeStructure(FacesContext context,
String viewId,
String renderKitId)
Deprecated. the distinction between tree structure and component state is now an implementation detail. The default implementation returns null . |
abstract 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 . |
StateManager.SerializedView |
saveSerializedView(FacesContext context)
Deprecated. this has been replaced by saveView(javax.faces.context.FacesContext) . The
default implementation returns null . |
Object |
saveView(FacesContext context)
Return an opaque Object containing sufficient
information for this same instance to restore the state of the
current UIViewRoot on a subsequent request. |
void |
writeState(FacesContext context,
Object state)
Save the state represented in the specified state Object instance, in an implementation dependent
manner. |
void |
writeState(FacesContext context,
StateManager.SerializedView state)
Deprecated. This method has been replaced by writeState(javax.faces.context.FacesContext,java.lang.Object) .
The default implementation of this method does nothing. |
类方法继承 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段详细信息 |
---|
STATE_SAVING_METHOD_PARAM_NAME
public static final String STATE_SAVING_METHOD_PARAM_NAME
The
ServletContext
init parameter consulted by theStateManager
to tell where the state should be saved. Valid values are given as the values of the constants:STATE_SAVING_METHOD_CLIENT
orSTATE_SAVING_METHOD_SERVER
.If this parameter is not specified, the default value is the value of the constant
STATE_SAVING_METHOD_CLIENT
.- 另请参见:
- 常量字段
STATE_SAVING_METHOD_CLIENT
public static final String STATE_SAVING_METHOD_CLIENT
Constant value for the initialization parameter named by the
STATE_SAVING_METHOD_PARAM_NAME
that indicates state saving should take place on the client.- 另请参见:
- 常量字段
STATE_SAVING_METHOD_SERVER
public static final String STATE_SAVING_METHOD_SERVER
Constant value for the initialization parameter named by the
STATE_SAVING_METHOD_PARAM_NAME
that indicates state saving should take place on the server.- 另请参见:
- 常量字段
构造器详细信息 |
---|
StateManager
public StateManager()
方法详细信息 |
---|
saveSerializedView
public StateManager.SerializedView saveSerializedView(FacesContext context)
- Deprecated. this has been replaced by
saveView(javax.faces.context.FacesContext)
. The default implementation returnsnull
. Return the tree structure and component state information for the view contained in the specified
FacesContext
instance as an object of typeStateManager.SerializedView
. If there is no state information to be saved, returnnull
instead.Components may opt out of being included in the serialized view by setting their
transient
property totrue
. 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 nearestNamingContainer
must have unique identifiers.- 参数:
context
-FacesContext
for the current request- 抛出异常:
IllegalStateException
- if more than one component or facet within the sameNamingContainer
in this view has the same non-null
component id
saveView
public Object saveView(FacesContext context)
Return an opaque
Object
containing sufficient information for this same instance to restore the state of the currentUIViewRoot
on a subsequent request. The returned object must implementjava.io.Serializable
. If there is no state information to be saved, returnnull
instead.Components may opt out of being included in the serialized view by setting their
transient
property totrue
. 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 nearestNamingContainer
must have unique identifiers.For backwards compatability with existing
StateManager
implementations, the default implementation of this method callssaveSerializedView(javax.faces.context.FacesContext)
and creates and returns a two elementObject
array with element zero containing thestructure
property and element one containing thestate
property of theSerializedView
.- 参数:
context
-FacesContext
for the current request- 抛出异常:
IllegalStateException
- if more than one component or facet within the sameNamingContainer
in this view has the same non-null
component id- 从以下版本开始:
- 1.2
getTreeStructureToSave
protected Object getTreeStructureToSave(FacesContext context)
- 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 aSerializable
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 totrue
. 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.- 参数:
context
-FacesContext
for the current request
getComponentStateToSave
protected Object getComponentStateToSave(FacesContext context)
- 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 aSerializable
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 totrue
. 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.- 参数:
context
-FacesContext
for the current request
writeState
public void writeState(FacesContext context, Object state) throws IOException
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 theResponseStateManager
instance provided by theRenderKit
being used to render this view. This method assumes that the caller has positioned theResponseWriter
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 ofObject []
of length greater than or equal to two. If so, it creates aSerializedView
instance with the tree structure coming from element zero and the component state coming from element one and calls through towriteState(javax.faces.context.FacesContext,javax.faces.application.StateManager.SerializedView)
. If not, does nothing.- 参数:
context
-FacesContext
for the current requeststate
- the Serializable state to be written, as returned bysaveSerializedView(javax.faces.context.FacesContext)
- 抛出异常:
IOException
- 从以下版本开始:
- 1.2
writeState
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 theResponseStateManager
instance provided by theRenderKit
being used to render this view. This method assumes that the caller has positioned theResponseWriter
at the correct position for the saved state to be written.- 参数:
context
-FacesContext
for the current requeststate
- the serialized state to be written- 抛出异常:
IOException
restoreView
public abstract 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 restoredUIViewRoot
. If there is no saved state information available for thisviewId
, returnnull
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 theResponseStateManager
instance provided by theRenderKit
responsible for this view.- 参数:
context
-FacesContext
for the current requestviewId
- View identifier of the view to be restoredrenderKitId
- the renderKitId used to render this response. Must not benull
.- 抛出异常:
IllegalArgumentException
- ifrenderKitId
isnull
.
restoreTreeStructure
protected UIViewRoot restoreTreeStructure(FacesContext context, String viewId, String renderKitId)
- 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 aUIViewRoot
instance (populated with children and facets) representing the tree structure of the component tree being restored. If no saved state information is available, returnnull
instead.- 参数:
context
-FacesContext
for the current requestviewId
- View identifier of the view to be restoredrenderKitId
- the renderKitId used to render this response. Must not benull
.- 抛出异常:
IllegalArgumentException
- ifrenderKitId
isnull
.
restoreComponentState
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.- 参数:
context
-FacesContext
for the current requestviewRoot
-UIViewRoot
returned by a previous call torestoreTreeStructure()
renderKitId
- the renderKitId used to render this response. Must not benull
.- 抛出异常:
IllegalArgumentException
- ifrenderKitId
isnull
.
isSavingStateInClient
public boolean isSavingStateInClient(FacesContext context)
- 返回:
true
if and only if the value of theServletContext
init parameter named by the value of the constantSTATE_SAVING_METHOD_PARAM_NAME
is equal to the value of the constantSTATE_SAVING_METHOD_CLIENT
.false
otherwise.- 抛出异常:
NullPointerException
- ifcontext
isnull
.
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: NESTED | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.