|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |
javax.faces.component Class UIViewRoot
java.lang.Object javax.faces.component.UIComponent javax.faces.component.UIComponentBase javax.faces.component.UIViewRoot
- 所有已实现的接口:
- StateHolder
public class UIViewRoot
- extends UIComponentBase
UIViewRoot is the UIComponent that represents the
root of the UIComponent tree. This component has no rendering, it
just serves as the root of the component tree, and as a place to hang
per-view PhaseListener
s.
For each of the following lifecycle phase methods:
RenderResponse, via
encodeBegin(javax.faces.context.FacesContext)
andencodeEnd(javax.faces.context.FacesContext)
Take the following action regarding
PhaseListener
s.
Initialize a state flag to false
.
If getBeforePhaseListener()
returns non-null
,
invoke the listener, passing in the correct corresponding PhaseId
for this phase.
Upon return from the listener, call FacesContext.getResponseComplete()
and FacesContext.getRenderResponse()
. If either return true
set the internal state flag to true
.
If or one or more listeners have been added by a call to addPhaseListener(javax.faces.event.PhaseListener)
, invoke the beforePhase
method on
each one whose PhaseListener.getPhaseId()
matches the current
phaseId, passing in the same PhaseId
as in the previous
step.
Upon return from each listener, call FacesContext.getResponseComplete()
and FacesContext.getRenderResponse()
. If either return true
set the internal state flag to true
.
Execute any processing for this phase if the internal state flag was not set.
If getAfterPhaseListener()
returns non-null
,
invoke the listener, passing in the correct corresponding PhaseId
for this phase.
If or one or more listeners have been added by a call to addPhaseListener(javax.faces.event.PhaseListener)
, invoke the afterPhase
method on each
one whose PhaseListener.getPhaseId()
matches the current
phaseId, passing in the same PhaseId
as in the previous
step.
字段摘要 | |
---|---|
static String |
COMPONENT_FAMILY
The standard component family for this component. |
static String |
COMPONENT_TYPE
The standard component type for this component. |
static String |
UNIQUE_ID_PREFIX
The prefix that will be used for identifiers generated by the createUniqueId() method. |
Fields inherited from class javax.faces.component.UIComponent |
---|
bindings |
构造器摘要 | |
---|---|
UIViewRoot()
Create a new UIViewRoot instance with default property
values. |
方法摘要 | |
---|---|
void |
addPhaseListener(PhaseListener newPhaseListener)
|
String |
createUniqueId()
Generate an identifier for a component. |
void |
encodeBegin(FacesContext context)
Override the default UIComponentBase.encodeBegin(javax.faces.context.FacesContext)
behavior. |
void |
encodeEnd(FacesContext context)
Override the default UIComponentBase.encodeEnd(javax.faces.context.FacesContext)
behavior. |
MethodExpression |
getAfterPhaseListener()
|
MethodExpression |
getBeforePhaseListener()
|
String |
getFamily()
Return the identifier of the component family to which this component belongs. |
Locale |
getLocale()
Return the Locale to be used in localizing the
response being created for this view. |
String |
getRenderKitId()
Return the render kit identifier of the RenderKit
associated with this view. |
String |
getViewId()
Return the view identifier for this view. |
void |
processApplication(FacesContext context)
Broadcast any events that have been queued for the Invoke Application phase of the request processing lifecycle and to clear out any events for later phases if the event processing for this phase caused FacesContext.renderResponse() or
FacesContext.responseComplete() to be called. |
void |
processDecodes(FacesContext context)
Override the default UIComponentBase.processDecodes(javax.faces.context.FacesContext)
behavior to broadcast any queued events after the default
processing has been completed and to clear out any events
for later phases if the event processing for this phase caused FacesContext.renderResponse() or FacesContext.responseComplete()
to be called. |
void |
processUpdates(FacesContext context)
Override the default UIComponentBase behavior to broadcast
any queued events after the default processing has been completed
and to clear out any events for later phases if the event processing
for this phase caused FacesContext.renderResponse() or
FacesContext.responseComplete() to be called. |
void |
processValidators(FacesContext context)
Override the default UIComponentBase.processValidators(javax.faces.context.FacesContext)
behavior to broadcast any queued events after the default
processing has been completed and to clear out any events
for later phases if the event processing for this phase caused FacesContext.renderResponse() or FacesContext.responseComplete()
to be called. |
void |
queueEvent(FacesEvent event)
Override the default UIComponentBase.queueEvent(javax.faces.event.FacesEvent) behavior to
accumulate the queued events for later broadcasting. |
void |
removePhaseListener(PhaseListener toRemove)
|
void |
restoreState(FacesContext context,
Object state)
Perform any processing required to restore the state from the entries in the state Object. |
Object |
saveState(FacesContext context)
Gets the state of the instance as a Serializable Object. |
void |
setAfterPhaseListener(MethodExpression newAfterPhase)
Allow an arbitrary method to be called for the "afterPhase" event as the UIViewRoot runs through its lifecycle. |
void |
setBeforePhaseListener(MethodExpression newBeforePhase)
Allow an arbitrary method to be called for the "beforePhase" event as the UIViewRoot runs through its lifecycle. |
void |
setLocale(Locale locale)
Set the Locale to be used in localizing the
response being created for this view. |
void |
setRenderKitId(String renderKitId)
Set the render kit identifier of the RenderKit
associated with this view. |
void |
setViewId(String viewId)
Set the view identifier for this view. |
类方法继承 javax.faces.component.UIComponent |
---|
encodeAll, getContainerClientId, getValueExpression, setValueExpression |
类方法继承 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段详细信息 |
---|
COMPONENT_TYPE
public static final String COMPONENT_TYPE
The standard component type for this component.
- 另请参见:
- 常量字段
COMPONENT_FAMILY
public static final String COMPONENT_FAMILY
The standard component family for this component.
- 另请参见:
- 常量字段
UNIQUE_ID_PREFIX
public static final String UNIQUE_ID_PREFIX
The prefix that will be used for identifiers generated by the
createUniqueId()
method.- 另请参见:
- 常量字段
构造器详细信息 |
---|
UIViewRoot
public UIViewRoot()
Create a new
UIViewRoot
instance with default property values.
方法详细信息 |
---|
getFamily
public String getFamily()
- Description copied from class:
UIComponent
Return the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the
rendererType
property, may be used to select the appropriateRenderer
for this component instance.- 规范说明:
getFamily
in classUIComponent
getRenderKitId
public String getRenderKitId()
Return the render kit identifier of the
RenderKit
associated with this view. Unless explicitly set, as inViewHandler.createView(javax.faces.context.FacesContext, java.lang.String)
, the returned value will benull.
setRenderKitId
public void setRenderKitId(String renderKitId)
Set the render kit identifier of the
RenderKit
associated with this view. This method may be called at any time between the end of Apply Request Values phase of the request processing lifecycle (i.e. when events are being broadcast) and the beginning of the Render Response phase.
getViewId
public String getViewId()
Return the view identifier for this view.
setViewId
public void setViewId(String viewId)
Set the view identifier for this view.
- 参数:
viewId
- The new view identifier
getBeforePhaseListener
public MethodExpression getBeforePhaseListener()
- 返回:
- the
MethodExpression
that will be invoked before this view is rendered.
setBeforePhaseListener
public void setBeforePhaseListener(MethodExpression newBeforePhase)
Allow an arbitrary method to be called for the "beforePhase" event as the UIViewRoot runs through its lifecycle. This method will be called for all phases except
PhaseId.RESTORE_VIEW
. Unlike a truePhaseListener
, this approach doesn't allow for only receivingPhaseEvent
s for a given phase.The method must conform to the signature of
PhaseListener.beforePhase(javax.faces.event.PhaseEvent)
.- 参数:
newBeforePhase
- theMethodExpression
that will be invoked before this view is rendered.
getAfterPhaseListener
public MethodExpression getAfterPhaseListener()
- 返回:
- the
MethodExpression
that will be invoked after this view is rendered.
setAfterPhaseListener
public void setAfterPhaseListener(MethodExpression newAfterPhase)
Allow an arbitrary method to be called for the "afterPhase" event as the UIViewRoot runs through its lifecycle. This method will be called for all phases except
PhaseId.RESTORE_VIEW
. Unlike a truePhaseListener
, this approach doesn't allow for only receivingPhaseEvent
s for a given phase.The method must conform to the signature of
PhaseListener.afterPhase(javax.faces.event.PhaseEvent)
.- 参数:
newAfterPhase
- theMethodExpression
that will be invoked after this view is rendered.
removePhaseListener
public void removePhaseListener(PhaseListener toRemove)
addPhaseListener
public void addPhaseListener(PhaseListener newPhaseListener)
queueEvent
public void queueEvent(FacesEvent event)
Override the default
UIComponentBase.queueEvent(javax.faces.event.FacesEvent)
behavior to accumulate the queued events for later broadcasting.- 重写:
queueEvent
in classUIComponentBase
- 参数:
event
-FacesEvent
to be queued- 抛出异常:
IllegalStateException
- if this component is not a descendant of aUIViewRoot
NullPointerException
- ifevent
isnull
processDecodes
public void processDecodes(FacesContext context)
Override the default
UIComponentBase.processDecodes(javax.faces.context.FacesContext)
behavior to broadcast any queued events after the default processing has been completed and to clear out any events for later phases if the event processing for this phase causedFacesContext.renderResponse()
orFacesContext.responseComplete()
to be called.- 重写:
processDecodes
in classUIComponentBase
- 参数:
context
-FacesContext
for the request we are processing- 抛出异常:
NullPointerException
- ifcontext
isnull
encodeBegin
public void encodeBegin(FacesContext context) throws IOException
Override the default
UIComponentBase.encodeBegin(javax.faces.context.FacesContext)
behavior. IfgetBeforePhaseListener()
returns non-null
, invoke it, passing aPhaseEvent
for thePhaseId.RENDER_RESPONSE
phase. If the internal list populated by calls toaddPhaseListener(javax.faces.event.PhaseListener)
is non-empty, any listeners in that list must have theirPhaseListener.beforePhase(javax.faces.event.PhaseEvent)
method called, passing thePhaseEvent
. Any errors that occur during invocation of any of the the beforePhase listeners must be logged and swallowed. After listeners are invoked call superclass processing.- 重写:
encodeBegin
in classUIComponentBase
- 参数:
context
-FacesContext
for the response we are creating- 抛出异常:
IOException
- if an input/output error occurs while rendering
encodeEnd
public void encodeEnd(FacesContext context) throws IOException
Override the default
UIComponentBase.encodeEnd(javax.faces.context.FacesContext)
behavior. IfgetAfterPhaseListener()
returns non-null
, invoke it, passing aPhaseEvent
for thePhaseId.RENDER_RESPONSE
phase. Any errors that occur during invocation of the afterPhase listener must be logged and swallowed.- 重写:
encodeEnd
in classUIComponentBase
- 参数:
context
-FacesContext
for the response we are creating- 抛出异常:
IOException
- if an input/output error occurs while rendering
processValidators
public void processValidators(FacesContext context)
Override the default
UIComponentBase.processValidators(javax.faces.context.FacesContext)
behavior to broadcast any queued events after the default processing has been completed and to clear out any events for later phases if the event processing for this phase causedFacesContext.renderResponse()
orFacesContext.responseComplete()
to be called.- 重写:
processValidators
in classUIComponentBase
- 参数:
context
-FacesContext
for the request we are processing- 抛出异常:
NullPointerException
- ifcontext
isnull
processUpdates
public void processUpdates(FacesContext context)
Override the default
UIComponentBase
behavior to broadcast any queued events after the default processing has been completed and to clear out any events for later phases if the event processing for this phase causedFacesContext.renderResponse()
orFacesContext.responseComplete()
to be called.- 重写:
processUpdates
in classUIComponentBase
- 参数:
context
-FacesContext
for the request we are processing- 抛出异常:
NullPointerException
- ifcontext
isnull
processApplication
public void processApplication(FacesContext context)
Broadcast any events that have been queued for the Invoke Application phase of the request processing lifecycle and to clear out any events for later phases if the event processing for this phase caused
FacesContext.renderResponse()
orFacesContext.responseComplete()
to be called.- 参数:
context
-FacesContext
for the request we are processing- 抛出异常:
NullPointerException
- ifcontext
isnull
createUniqueId
public String createUniqueId()
Generate an identifier for a component. The identifier will be prefixed with UNIQUE_ID_PREFIX, and will be unique within this UIViewRoot.
getLocale
public Locale getLocale()
Return the
Locale
to be used in localizing the response being created for this view.Algorithm:
If we have a
locale
ivar, return it. If we have a value expression for "locale", get its value. If the value isnull
, return the result of callingViewHandler.calculateLocale(javax.faces.context.FacesContext)
. If the value is an instance ofjava.util.Locale
return it. If the value is a String, convert it to ajava.util.Locale
and return it. If there is no value expression for "locale", return the result of callingViewHandler.calculateLocale(javax.faces.context.FacesContext)
.- 返回:
- The current
Locale
obtained by executing the above algorithm.
setLocale
public void setLocale(Locale locale)
Set the
Locale
to be used in localizing the response being created for this view.- 参数:
locale
- The new localization Locale
saveState
public Object saveState(FacesContext context)
- Description copied from interface:
StateHolder
Gets the state of the instance as a
Serializable
Object.If the class that implements this interface has references to instances that implement StateHolder (such as a
UIComponent
with event handlers, validators, etc.) this method must call theStateHolder.saveState(javax.faces.context.FacesContext)
method on all those instances as well. This method must not save the state of children and facets. That is done via theStateManager
This method must not alter the state of the implementing object. In other words, after executing this code:
Object state = component.saveState(facesContext);
component
should be the same as before executing it.The return from this method must be
Serializable
- 规范说明:
saveState
in interfaceStateHolder
- 重写:
saveState
in classUIComponentBase
restoreState
public void restoreState(FacesContext context, Object state)
- Description copied from interface:
StateHolder
Perform any processing required to restore the state from the entries in the state Object.
If the class that implements this interface has references to instances that also implement StateHolder (such as a
UIComponent
with event handlers, validators, etc.) this method must call theStateHolder.restoreState(javax.faces.context.FacesContext, java.lang.Object)
method on all those instances as well.- 规范说明:
restoreState
in interfaceStateHolder
- 重写:
restoreState
in classUIComponentBase
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.