|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
javax.faces.component Class UIComponent
java.lang.Objectjavax.faces.component.UIComponent
- All Implemented Interfaces:
- StateHolder
- Direct Known Subclasses:
- UIComponentBase
public abstract class UIComponent
- extends Object
- implements StateHolder
UIComponent 是 JavaServer Faces 中所有用户界面组件的基类。与特定请求和响应关联的 UIComponent 实例集合被组织成表示整个请求或响应内容的 UIViewRoot 下的组件树。
为了方便组件开发人员使用,UIComponentBase 提供了为 UIComponent 指定的默认行为,并且是所有具体 UIComponent“基本”实现的基类。鼓励组件编写者为 UIComponentBase 创建子类,而不是直接实现此抽象类,以减少将来更改方法签名所带来的影响。
UIComponent is the base class for all user interface
components in JavaServer Faces. The set of UIComponent instances
associated with a particular request and response are organized into a
component tree under a UIViewRoot that represents
the entire content of the request or response.
For the convenience of component developers,
UIComponentBase provides the default
behavior that is specified for a UIComponent, and is the base class
for all of the concrete UIComponent "base" implementations.
Component writers are encouraged to subclass
UIComponentBase, instead of directly
implementing this abstract class, to reduce the impact of any future changes
to the method signatures.
| Field Summary | |
|---|---|
protected Map<String,ValueExpression> |
bindings
|
| Constructor Summary | |
|---|---|
UIComponent()
|
|
| Method Summary | |
|---|---|
protected abstract void |
addFacesListener(FacesListener listener)
Add the specified FacesListener to the set of listeners
registered to receive event notifications from this UIComponent. |
abstract void |
broadcast(FacesEvent event)
Broadcast the specified FacesEvent to all registered
event listeners who have expressed an interest in events of this
type. |
abstract void |
decode(FacesContext context)
Decode any new state of this UIComponent from the
request contained in the specified FacesContext, and store
this state as needed. |
void |
encodeAll(FacesContext context)
If this component returns true from isRendered(), render this component and all its children that
return true from isRendered(),
regardless of the value of the getRendersChildren() flag. |
abstract void |
encodeBegin(FacesContext context)
If our rendered property is true,
render the beginning of the current state of this
UIComponent to the response contained in the specified
FacesContext. |
abstract void |
encodeChildren(FacesContext context)
If our rendered property is true,
render the child UIComponents of this UIComponent. |
abstract void |
encodeEnd(FacesContext context)
If our rendered property is true,
render the ending of the current state of this
UIComponent. |
abstract UIComponent |
findComponent(String expr)
Search for and return the UIComponent with an id
that matches the specified search expression (if any), according to the
algorithm described below. |
abstract Map<String,Object> |
getAttributes()
Return a mutable Map representing the attributes
(and properties, see below) associated wth this UIComponent,
keyed by attribute name (which must be a String). |
abstract int |
getChildCount()
Return the number of child UIComponents that are
associated with this UIComponent. |
abstract List<UIComponent> |
getChildren()
Return a mutable List representing the child
UIComponents associated with this component. |
abstract String |
getClientId(FacesContext context)
Return a client-side identifier for this component, generating one if necessary. |
String |
getContainerClientId(FacesContext context)
Allow components that implement NamingContainer to
selectively disable prepending their clientId to their
descendent's clientIds by breaking the prepending logic into a
seperately callable method. |
protected abstract FacesContext |
getFacesContext()
Convenience method to return the FacesContext instance
for the current request. |
protected abstract FacesListener[] |
getFacesListeners(Class clazz)
Return an array of registered FacesListeners that are
instances of the specified class. |
abstract UIComponent |
getFacet(String name)
Convenience method to return the named facet, if it exists, or null otherwise. |
int |
getFacetCount()
Return the number of facet UIComponents that are
associated with this UIComponent. |
abstract Map<String,UIComponent> |
getFacets()
Return a mutable Map representing the facet
UIComponents associated with this UIComponent,
keyed by facet name (which must be a String). |
abstract Iterator<UIComponent> |
getFacetsAndChildren()
Return an Iterator over the facet followed by child
UIComponents of this UIComponent. |
abstract String |
getFamily()
Return the identifier of the component family to which this component belongs. |
abstract String |
getId()
Return the component identifier of this UIComponent. |
abstract UIComponent |
getParent()
Return the parent UIComponent of this
UIComponent, if any. |
protected abstract Renderer |
getRenderer(FacesContext context)
Convenience method to return the Renderer instance
associated with this component, if any; otherwise, return
null. |
abstract String |
getRendererType()
Return the Renderer type for this UIComponent
(if any). |
abstract boolean |
getRendersChildren()
Return a flag indicating whether this component is responsible for rendering its child components. |
abstract ValueBinding |
getValueBinding(String name)
Deprecated. This has been replaced by getValueExpression(java.lang.String). |
ValueExpression |
getValueExpression(String name)
Return the ValueExpression used to calculate the value for the
specified attribute or property name, if any. |
boolean |
invokeOnComponent(FacesContext context,
String clientId,
ContextCallback callback)
Starting at this component in the View hierarchy, search for a component with a clientId equal to the argument
clientId and, if found, call the ContextCallback.invokeContextCallback(javax.faces.context.FacesContext, javax.faces.component.UIComponent) method on the argument
callback, passing the current FacesContext
and the found component as arguments. |
abstract boolean |
isRendered()
Return true if this component (and its children)
should be rendered during the Render Response phase
of the request processing lifecycle. |
abstract void |
processDecodes(FacesContext context)
Perform the component tree processing required by the Apply Request Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows. |
abstract void |
processRestoreState(FacesContext context,
Object state)
Perform the component tree processing required by the Restore View phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows. |
abstract Object |
processSaveState(FacesContext context)
Perform the component tree processing required by the state saving portion of the Render Response phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows. |
abstract void |
processUpdates(FacesContext context)
Perform the component tree processing required by the Update Model Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows. |
abstract void |
processValidators(FacesContext context)
Perform the component tree processing required by the Process Validations phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows. |
abstract void |
queueEvent(FacesEvent event)
Queue an event for broadcast at the end of the current request processing lifecycle phase. |
protected abstract void |
removeFacesListener(FacesListener listener)
Remove the specified FacesListener from the set of listeners
registered to receive event notifications from this UIComponent. |
abstract void |
setId(String id)
Set the component identifier of this UIComponent (if any). |
abstract void |
setParent(UIComponent parent)
Set the parent UIComponent of this
UIComponent. |
abstract void |
setRendered(boolean rendered)
Set the rendered property of this
UIComponent. |
abstract void |
setRendererType(String rendererType)
Set the Renderer type for this UIComponent,
or null for components that render themselves. |
abstract void |
setValueBinding(String name,
ValueBinding binding)
Deprecated. This has been replaced by setValueExpression(java.lang.String, javax.el.ValueExpression). |
void |
setValueExpression(String name,
ValueExpression binding)
Set the ValueExpression used to calculate the value
for the specified attribute or property name, if any. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.faces.component.StateHolder |
|---|
isTransient, restoreState, saveState, setTransient |
| Field Detail |
|---|
英文文档:
bindings
protected Map<String,ValueExpression> bindings
| Constructor Detail |
|---|
public
UIComponent()
英文文档:
UIComponent
public UIComponent()
| Method Detail |
|---|
abstract public java.util.Map<K, V>
getAttributes()
返回表示与此 UIComponent 关联的属性(以及特性,参见下文)的可变 Map,以属性名称(必须是 String)作为键。返回的实现必须支持所有标准的和可选的 Map 方法,并支持以下附加要求:
Map实现必须实现java.io.Serializable接口。- 任何添加
null键或值的尝试都必定抛出NullPointerException。 - 任何添加非 String 键的尝试都必定抛出
ClassCastException。 - 如果指定为键的属性名称与此
UIComponent实现类的某个属性相匹配,则下列方法将具有特殊行为:containsKey- 返回false。get()- 如果属性是可读的,则调用获取方法并返回已返回的值(在其相应的包装器类中包装基本值);否则抛出IllegalArgumentException。put()- 如果属性是可写的,则调用设置方法以设置相应的值(在其相应包装器类中对基本值解包)。如果属性是不可写的,或尝试将基本类型的属性设置为null,则抛出IllegalArgumentException。remove- 抛出IllegalArgumentException。
getAttributes
public abstract Map<String,Object> getAttributes()
Return a mutable
Maprepresenting the attributes (and properties, see below) associated wth thisUIComponent, keyed by attribute name (which must be a String). The returned implementation must support all of the standard and optionalMapmethods, plus support the following additional requirements:- The
Mapimplementation must implement thejava.io.Serializableinterface. - Any attempt to add a
nullkey or value must throw aNullPointerException. - Any attempt to add a key that is not a String must throw
a
ClassCastException. - If the attribute name specified as a key matches a property
of this
UIComponent's implementation class, the following methods will have special behavior:containsKey- Returnfalse.get()- If the property is readable, call the getter method and return the returned value (wrapping primitive values in their corresponding wrapper classes); otherwise throwIllegalArgumentException.put()- If the property is writeable, call the setter method to set the corresponding value (unwrapping primitive values in their corresponding wrapper classes). If the property is not writeable, or an attempt is made to set a property of primitive type tonull, throwIllegalArgumentException.remove- ThrowIllegalArgumentException.
- The
abstract public ValueBinding
getValueBinding(String name)
调用 #getValueExpression 并检查结果。如果结果是 #setValueBinding 中规定的包装器类的实例,则提取 ValueBinding 实例并将其返回。否则,在 ValueBinding 的实现中包装结果,并将其返回。
| name |
要为其获取 ValueBinding 的属性的名称 |
| Throws | NullPointerException:
如果 name 为 null |
| deprecated |
此方法已由 #getValueExpression 替代。 |
getValueBinding
public abstract ValueBinding getValueBinding(String name)
- Deprecated. This has been replaced by
getValueExpression(java.lang.String). Call through to
getValueExpression(java.lang.String)and examine the result. If the result is an instance of the wrapper class mandated insetValueBinding(java.lang.String, javax.faces.el.ValueBinding), extract theValueBindinginstance and return it. Otherwise, wrap the result in an implementation ofValueBinding, and return it.- Parameters:
name- Name of the attribute or property for which to retrieve aValueBinding- Throws:
NullPointerException- ifnameisnull
abstract public void
setValueBinding(String name, ValueBinding binding)
在 ValueExpression 的实现中包装参数 binding 并调用 #setValueExpression。
| name |
将为其设置 ValueBinding 的属性的名称 |
| binding |
要设置的 ValueBinding,或为 null 以移除任何当前设置的 ValueBinding |
| Throws | IllegalArgumentException:
如果 name 是 id 或 parent 之一 |
| Throws | NullPointerException:
如果 name 为 null |
| deprecated |
此方法已由 #setValueExpression 替代。 |
setValueBinding
public abstract void setValueBinding(String name, ValueBinding binding)
- Deprecated. This has been replaced by
setValueExpression(java.lang.String, javax.el.ValueExpression). Wrap the argument
bindingin an implementation ofValueExpressionand call through tosetValueExpression(java.lang.String, javax.el.ValueExpression).- Parameters:
name- Name of the attribute or property for which to set aValueBindingbinding- TheValueBindingto set, ornullto remove any currently setValueBinding- Throws:
IllegalArgumentException- ifnameis one ofidorparentNullPointerException- ifnameisnull
public ValueExpression
getValueExpression(String name)
返回用于计算指定属性名称值的 ValueExpression(如果有)。
必须为遵守 JSF 1.2 及以后规范的组件重写并实现此方法。
| since | 1.2 |
| name |
要为其获取 ValueExpression 的属性的名称 |
| Throws | NullPointerException:
如果 name 为 null |
getValueExpression
public ValueExpression getValueExpression(String name)
Return the
ValueExpressionused to calculate the value for the specified attribute or property name, if any.This method must be overridden and implemented for components that comply with JSF 1.2 and later.
- Parameters:
name- Name of the attribute or property for which to retrieve aValueExpression- Throws:
NullPointerException- ifnameisnull- Since:
- 1.2
public void
setValueExpression(String name, ValueExpression binding)
设置用于计算指定属性名称值的 ValueExpression(如果有)。
实现必须以参数 expression 调用 ValueExpression#isLiteralText。如果 isLiteralText() 返回 true,则以参数 expression 调用 ValueExpression#getValue,并将结果作为 value 参数传入对 this.#getAttributes().put(name, value) 的调用,其中 name 是参数 name。如果调用 ValueExpression#getValue 时抛出异常,则在 javax.faces.FacesException 中包装它并将其重新抛出。如果 isLiteralText() 返回 false,则仅将未求值的 expression 参数存储在参数 name 给定的键下的 ValueExpression 集合中。
必须为遵守 JSF 1.2 及以后规范的组件重写并实现此方法。
| since | 1.2 |
| name |
要为其设置 ValueExpression 的属性的名称 |
| binding |
要设置的 ValueExpression,或为 null 以移除任何当前设置的 ValueExpression |
| Throws | IllegalArgumentException:
如果 name 是 id 或 parent 之一 |
| Throws | NullPointerException:
如果 name 为 null |
setValueExpression
public void setValueExpression(String name, ValueExpression binding)
Set the
ValueExpressionused to calculate the value for the specified attribute or property name, if any.The implementation must call
Expression.isLiteralText()on the argumentexpression. IfisLiteralText()returnstrue, invokeValueExpression.getValue(javax.el.ELContext)on the argument expression and pass the result as thevalueparameter in a call tothis.getAttributes().put(name, value) wherenameis the argumentname. If an exception is thrown as a result of callingValueExpression.getValue(javax.el.ELContext), wrap it in aFacesExceptionand re-throw it. IfisLiteralText()returnsfalse, simply store the un-evaluatedexpressionargument in the collection ofValueExpressions under the key given by the argumentname.This method must be overridden and implemented for components that comply with JSF 1.2 and later.
- Parameters:
name- Name of the attribute or property for which to set aValueExpressionbinding- TheValueExpressionto set, ornullto remove any currently setValueExpression- Throws:
IllegalArgumentException- ifnameis one ofidorparentNullPointerException- ifnameisnull- Since:
- 1.2
abstract public String
getClientId(FacesContext context)
返回此组件的客户端标识符,如果需要可以生成一个标识符。将会请求关联的 Renderer(如果有)将 clientId 转换为适合传送给客户端的形式。
此方法的返回值必须在实例的整个生命周期中保持一致,除非组件的 id 属性发生改变,或此组件所在的 NamingContainer 的客户端 ID 发生改变(例如,UIData)。但是,即使在这些情况下,对此方法的连续调用也必须总是返回相同的值。实现必须按照以下步骤确定 clientId:
在实现 NamingContainer 的视图层次结构中找到离此组件最近的祖先。调用它的 getContainerClientId() 并将结果保存为局部变量 parentId。调用此组件的 #getId,并将结果保存为局部变量 myId。如果 myId 为 null,则调用 context.getViewRoot().createUniqueId(),并将结果分配给 myId。如果 parentId 为非 null,则使 myId 等于 parentId + NamingContainer.SEPARATOR_CHAR + myId。调用 Renderer#convertClientId,同时传递 myId,并返回结果。
| context |
当前请求的 FacesContext |
| Throws | NullPointerException:
如果 context 为 null |
getClientId
public abstract String getClientId(FacesContext context)
Return a client-side identifier for this component, generating one if necessary. The associated
Renderer, if any, will be asked to convert the clientId to a form suitable for transmission to the client.The return from this method must be the same value throughout the lifetime of the instance, unless the
idproperty of the component is changed, or the component is placed in aNamingContainerwhose client ID changes (for example,UIData). However, even in these cases, consecutive calls to this method must always return the same value. The implementation must follow these steps in determining the clientId:Find the closest ancestor to this component in the view hierarchy that implements
NamingContainer. CallgetContainerClientId()on it and save the result as theparentIdlocal variable. CallgetId()on this component and save the result as themyIdlocal variable. IfmyIdisnull, callcontext.getViewRoot().createUniqueId()and assign the result to myId. IfparentIdis non-null, letmyIdequalparentId + NamingContainer.SEPARATOR_CHAR + myId. CallRenderer.convertClientId(javax.faces.context.FacesContext, java.lang.String), passingmyId, and return the result.- Parameters:
context- TheFacesContextfor the current request- Throws:
NullPointerException- ifcontextisnull
public String
getContainerClientId(FacesContext context)
通过将前置逻辑分离到一个单独的可调用方法,使实现 NamingContainer 的组件能够有选择地禁用将其 clientId 放到其后代的 clientId 前面的行为。有关用法,请参见 #getClientId。
默认情况下,此方法将调用 #getClientId 并返回结果。
| since | 1.2 |
| Throws | NullPointerException:
如果 context 为 null |
getContainerClientId
public String getContainerClientId(FacesContext context)
Allow components that implement
NamingContainerto selectively disable prepending their clientId to their descendent's clientIds by breaking the prepending logic into a seperately callable method. SeegetClientId(javax.faces.context.FacesContext)for usage.By default, this method will call through to
getClientId(javax.faces.context.FacesContext)and return the result.- Throws:
NullPointerException- ifcontextisnull- Since:
- 1.2
abstract public String
getFamily()
返回此组件所属的组件家族的标识符。此标识符(结合 rendererType 属性的值)可用于为此组件实例选择合适的 Renderer。
getFamily
public abstract String getFamily()
Return the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the
rendererTypeproperty, may be used to select the appropriateRendererfor this component instance.
abstract public String
getId()
返回此 UIComponent 的组件标识符。
getId
public abstract String getId()
Return the component identifier of this
UIComponent.
abstract public void
setId(String id)
设置此 UIComponent 的组件标识符(如果有)。组件标识符必须符合以下语法限制:
- 不得为长度为 0 的 String。
- 第一个字符必须为字母或下划线 ('_')。
- 后续字符必须为字母、数字、下划线 ('_') 或短划线 ('-')。
组件标识符还必须遵守下列语义限制(请注意,setId() 实现不执行此限制):
- 指定的标识符必须在所有组件(包括 facet)之间是唯一的,这些组件是距离最近的
NamingContainer祖先UIComponent的后代;如果不存在这样一个NamingContainer祖先,则它必须在整个组件树范围内是唯一的。
| id |
新组件标识符,或为 null 以指示此 UIComponent 没有组件标识符 |
| Throws | IllegalArgumentException:
如果 id 语法无效 |
setId
public abstract void setId(String id)
Set the component identifier of this
UIComponent(if any). Component identifiers must obey the following syntax restrictions:- Must not be a zero-length String.
- First character must be a letter or an underscore ('_').
- Subsequent characters must be a letter, a digit, an underscore ('_'), or a dash ('-').
Component identifiers must also obey the following semantic restrictions (note that this restriction is NOT enforced by the
setId()implementation):- The specified identifier must be unique among all the components
(including facets) that are descendents of the nearest ancestor
UIComponentthat is aNamingContainer, or within the scope of the entire component tree if there is no such ancestor that is aNamingContainer.
- Parameters:
id- The new component identifier, ornullto indicate that thisUIComponentdoes not have a component identifier- Throws:
IllegalArgumentException- ifidis not syntactically valid
abstract public UIComponent
getParent()
返回此 UIComponent 的父 UIComponent(如果有)。组件必须允许将子组件添加到此组件的子组件列表中,或从该列表中将其移除,即使子组件从 getParent( ) 返回 null。
getParent
public abstract UIComponent getParent()
Return the parent
UIComponentof thisUIComponent, if any. A component must allow child components to be added to and removed from the list of children of this component, even though the child component returns null fromgetParent( ).
abstract public void
setParent(UIComponent parent)
设置此 UIComponent 的父 UIComponent。此方法绝不能由开发人员调用;在将组件添加到父组件的子 List 或 facet Map 中,或从中移除组件时,UIComponent 的内部实现会调用它。
| parent |
新父组件,或对于组件树的根节点而言,为 null |
setParent
public abstract void setParent(UIComponent parent)
Set the parent
UIComponentof thisUIComponent. This method must never be called by developers; aUIComponent's internal implementation will call it as components are added to or removed from a parent's childListor facetMap.- Parameters:
parent- The new parent, ornullfor the root node of a component tree
abstract public boolean
isRendered()
如果应在请求处理生命周期的呈现响应 阶段呈现此组件(及其子组件),则返回 true。
isRendered
public abstract boolean isRendered()
Return
trueif this component (and its children) should be rendered during the Render Response phase of the request processing lifecycle.
abstract public void
setRendered(boolean rendered)
设置此 UIComponent 的 rendered 属性。
| rendered |
如果为 true,则呈现此组件;否则不呈现此组件。 |
setRendered
public abstract void setRendered(boolean rendered)
Set the
renderedproperty of thisUIComponent.- Parameters:
rendered- Iftruerender this component; otherwise, do not render this component
abstract public String
getRendererType()
返回此 UIComponent 的 Renderer 类型(如果有)。
getRendererType
public abstract String getRendererType()
Return the
Renderertype for thisUIComponent(if any).
abstract public void
setRendererType(String rendererType)
设置此 UIComponent 的 Renderer 类型,或对于自呈现组件而言,为 null。
| rendererType |
要使用的 Renderer 类型的逻辑标识符,或对于自呈现组件而言,为 null |
setRendererType
public abstract void setRendererType(String rendererType)
Set the
Renderertype for thisUIComponent, ornullfor components that render themselves.- Parameters:
rendererType- Logical identifier of the type ofRendererto use, ornullfor components that render themselves
abstract public boolean
getRendersChildren()
返回一个标志,指示此组件是否负责呈现其子组件。UIComponentBase#getRendersChildren 的默认实现会尝试查找此组件的 renderer。如果找到,它将调用 Renderer#getRendersChildren 并返回结果。如果未找到,它将返回 false。自 JavaServer Faces 规范 1.2 版起,鼓励组件编写者通过此方法返回 true,并依靠 UIComponentBase#encodeChildren。
getRendersChildren
public abstract boolean getRendersChildren()
Return a flag indicating whether this component is responsible for rendering its child components. The default implementation in
UIComponentBase.getRendersChildren()tries to find the renderer for this component. If it does, it callsRenderer.getRendersChildren()and returns the result. If it doesn't, it returns false. As of version 1.2 of the JavaServer Faces Specification, component authors are encouraged to returntruefrom this method and rely onUIComponentBase.encodeChildren(javax.faces.context.FacesContext).
abstract public java.util.List<E>
getChildren()
返回表示与此组件关联的子 UIComponent 的可变 List。返回的实现必须支持所有标准的和可选的 List 方法,并支持以下附加要求:
List实现必须实现java.io.Serializable接口。- 任何添加
null的尝试都必定抛出 NullPointerException。 - 任何添加未实现
UIComponent的对象的尝试都必定抛出 ClassCastException。 - 只要添加新的子组件,该子组件的
parent属性就必须设置为此组件实例。如果子组件的parent属性已经是非 null,则必须首先从此组件以前的父组件中移除此子组件(在该父组件中它可能已经是子组件或 facet)。 - 只要移除现有的子组件,该子组件的
parent属性就必须设置为null。
getChildren
public abstract List<UIComponent> getChildren()
Return a mutable
Listrepresenting the childUIComponents associated with this component. The returned implementation must support all of the standard and optionalListmethods, plus support the following additional requirements:- The
Listimplementation must implement thejava.io.Serializableinterface. - Any attempt to add a
nullmust throw a NullPointerException - Any attempt to add an object that does not implement
UIComponentmust throw a ClassCastException. - Whenever a new child component is added, the
parentproperty of the child must be set to this component instance. If theparentproperty of the child was already non-null, the child must first be removed from its previous parent (where it may have been either a child or a facet). - Whenever an existing child component is removed, the
parentproperty of the child must be set tonull.
- The
abstract public int
getChildCount()
返回与此 UIComponent 关联的子 UIComponent 的数量。如果不存在子组件,则此方法必须返回 0。此方法不得导致创建子组件列表。
getChildCount
public abstract int getChildCount()
Return the number of child
UIComponents that are associated with thisUIComponent. If there are no children, this method must return 0. The method must not cause the creation of a child component list.
abstract public UIComponent
findComponent(String expr)
按照如下所述的算法,搜索并返回带有与指定搜索表达式相匹配的 id 的 UIComponent(如果有)。
有关给定一个简单的 clientId 查找组件的方法,请参见 #invokeOnComponent。
要求组件标识符在包含此组件的距离最近的祖先 NamingContainer (可能是此组件本身)范围内是唯一的。如果此组件的祖先中不存在 NamingContainer 组件,则树的根组件将被视为 NamingContainer,不论其类是否实际实现 NamingContainer 接口。
搜索表达式 由一个标识符(该标识符与 UIComponent 的 id 属性完全匹配),或者一组通过 NamingContainer#SEPARATOR_CHAR 字符值链接的此类标识符组成。搜索算法应按照下列过程操作,尽管只要最终结果相同,也可以使用备用算法:
- 标识作为搜索基本组件的
UIComponent,当满足下列条件之一时停止:- 如果搜索表达式以分隔符字符开头(称为“绝对”搜索表达式),基本组件将是组件树的根
UIComponent。前导分隔符字符将会被去掉,搜索表达式的其余部分将被视为下文所述的“相对”搜索表达式。 - 否则,如果此
UIComponent是NamingContainer,它将作为基本组件。 - 否则,向上搜索此组件的父组件。如果遇到
NamingContainer,它将作为基本组件。 - 否则(如果没有遇到
NamingContainer),则将根UIComponent作为基本组件。
- 如果搜索表达式以分隔符字符开头(称为“绝对”搜索表达式),基本组件将是组件树的根
- 现在搜索表达式(可能在前面的步骤中修改过)是“相对”搜索表达式,将用于在基本组件范围内查找具有匹配
id的组件(如果有)。匹配按照以下过程操作:- 如果搜索表达式是简单标识符,则将该值与
id属性比较,然后在基本UIComponent的 facet 和子组件中递归(除非找到了后代NamingContainer才不搜索其自身的 facet 和子组件)。 - 如果搜索表达式包含由分隔符字符分隔的多个标识符,则使用第一个标识符按上一条规则来查找
NamingContainer。然后,将调用此NamingContainer的findComponent()方法,同时传递搜索表达式的其余部分。
- 如果搜索表达式是简单标识符,则将该值与
| expr |
标识要返回的 UIComponent 的搜索表达式 |
| return |
找到的 UIComponent;如果未找到组件,则返回 null。 |
| Throws | IllegalArgumentException:
如果搜索表达式的中间标识符标识了非 NamingContainer 的 UIComponent |
| Throws | NullPointerException:
如果 expr 为 null |
findComponent
public abstract UIComponent findComponent(String expr)
Search for and return the
UIComponentwith anidthat matches the specified search expression (if any), according to the algorithm described below.For a method to find a component given a simple
clientId, seeinvokeOnComponent(javax.faces.context.FacesContext, java.lang.String, javax.faces.component.ContextCallback).Component identifiers are required to be unique within the scope of the closest ancestor
NamingContainerthat encloses this component (which might be this component itself). If there are noNamingContainercomponents in the ancestry of this component, the root component in the tree is treated as if it were aNamingContainer, whether or not its class actually implements theNamingContainerinterface.A search expression consists of either an identifier (which is matched exactly against the
idproperty of aUIComponent, or a series of such identifiers linked by theNamingContainer.SEPARATOR_CHARcharacter value. The search algorithm should operates as follows, though alternate alogrithms may be used as long as the end result is the same:- Identify the
UIComponentthat will be the base for searching, by stopping as soon as one of the following conditions is met:- If the search expression begins with the the separator character
(called an "absolute" search expression),
the base will be the root
UIComponentof the component tree. The leading separator character will be stripped off, and the remainder of the search expression will be treated as a "relative" search expression as described below. - Otherwise, if this
UIComponentis aNamingContainerit will serve as the basis. - Otherwise, search up the parents of this component. If
a
NamingContaineris encountered, it will be the base. - Otherwise (if no
NamingContaineris encountered) the rootUIComponentwill be the base.
- If the search expression begins with the the separator character
(called an "absolute" search expression),
the base will be the root
- The search expression (possibly modified in the previous step) is now
a "relative" search expression that will be used to locate the
component (if any) that has an
idthat matches, within the scope of the base component. The match is performed as follows:- If the search expression is a simple identifier, this value is
compared to the
idproperty, and then recursively through the facets and children of the baseUIComponent(except that if a descendantNamingContaineris found, its own facets and children are not searched). - If the search expression includes more than one identifier
separated by the separator character, the first identifier is
used to locate a
NamingContainerby the rules in the previous bullet point. Then, thefindComponent()method of thisNamingContainerwill be called, passing the remainder of the search expression.
- If the search expression is a simple identifier, this value is
compared to the
- Identify the
- Parameters:
expr- Search expression identifying theUIComponentto be returned- Returns:
- the found
UIComponent, ornullif the component was not found. - Throws:
IllegalArgumentException- if an intermediate identifier in a search expression identifies aUIComponentthat is not aNamingContainerNullPointerException- ifexprisnull
public boolean
invokeOnComponent(FacesContext context, String clientId, ContextCallback callback) throws FacesException
在视图层次结构中从此组件开始,搜索 clientId 等于参数 clientId 的组件;如果找到,则以参数 callback 调用 ContextCallback#invokeContextCallback 方法,同时将当前 FacesContext 和找到的组件作为参数传递。此方法与 #findComponent 类似,但它不支持前导 NamingContainer#SEPARATOR_CHAR 语法用于从视图的根进行搜索。
默认实现将首先检查 this.getClientId() 是否等于参数 clientId。如果等于,以参数 callback 调用 ContextCallback#invokeContextCallback 方法,同时传递 FacesContext 参数并将此 clientId 作为组件参数传递。如果回调抛出 Exception,则在 FacesException 中包装它并将其重新抛出。否则,返回 true。
否则,对 #getFacetsAndChildren 返回的每个组件,调用 invokeOnComponent(),同时按顺序将参数传递给此方法。invokeOnComponent() 首次返回 true 时,将中止遍历 Iterator 的其余部分并返回 true。
对于在参数 clientId 中找到的任何状态,当调用 ContextCallback#invokeContextCallback 时,此方法的实现必须保证传递给回调的组件状态正确反映组件在视图层次结构中的位置。例如,像 UIData 之类的迭代组件将需要设置其行索引,以正确反映参数 clientId,然后再查找正确行支持的相应子组件。当回调正常返回或抛出 Exception 时,此方法的实现必须将视图状态恢复到调用回调前的状态。
如果 #getFacetsAndChildren 的任何一个元素都没有从 invokeOnComponent() 中返回 true,则返回 false。
一个简单的用法示例是通过 clientId 查找组件。
private UIComponent found = null;
private void doFind(FacesContext context, String clientId) {
context.getViewRoot().invokeOnComponent(context, clientId,
new ContextCallback() {
public void invokeOnComponent(FacesContext context,
UIComponent component) {
found = component;
}
});
}
| since | 1.2 |
| context |
当前请求的 FacesContext |
| clientId | 要传递给参数 callback 的组件的客户端标识符。 |
| callback | Callback 接口的实现。 |
| Throws | NullPointerException: 如果任何参数为 null |
| Throws | FacesException:
如果参数 Callback 抛出 Exception,则将在 FacesException 中包装它并将其重新抛出。 |
| return |
如果找到了具有给定 clientId 的组件,成功调用了回调方法,同时将该组件作为参数传递,而且未抛出 Exception,则返回 true。如果未找到具有给定 clientId 的组件,则返回 false。 |
invokeOnComponent
public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback) throws FacesException
Starting at this component in the View hierarchy, search for a component with a
clientIdequal to the argumentclientIdand, if found, call theContextCallback.invokeContextCallback(javax.faces.context.FacesContext, javax.faces.component.UIComponent)method on the argumentcallback, passing the currentFacesContextand the found component as arguments. This method is similar tofindComponent(java.lang.String)but it does not support the leadingNamingContainer.SEPARATOR_CHARsyntax for searching from the root of the View.The default implementation will first check if
this.getClientId()is equal to the argumentclientId. If so, call theContextCallback.invokeContextCallback(javax.faces.context.FacesContext, javax.faces.component.UIComponent)method on the argument callback, passing through theFacesContextargument and passing this as the component argument. If anExceptionis thrown by the callback, wrap it in aFacesExceptionand re-throw it. Otherwise, returntrue.Otherwise, for each component returned by
getFacetsAndChildren(), callinvokeOnComponent()passing the arguments to this method, in order. The first timeinvokeOnComponent()returns true, abort traversing the rest of theIteratorand returntrue.When calling
ContextCallback.invokeContextCallback(javax.faces.context.FacesContext, javax.faces.component.UIComponent)the implementation of this method must guarantee that the state of the component passed to the callback correctly reflects the component's position in the View hierarchy with respect to any state found in the argumentclientId. For example, an iterating component such asUIDatawill need to set its row index to correctly reflect the argumentclientIdbefore finding the appropriate child component backed by the correct row. When the callback returns, either normally or by throwing anExceptionthe implementation of this method must restore the state of the view to the way it was before invoking the callback.If none of the elements from
getFacetsAndChildren()returnedtruefrominvokeOnComponent(), returnfalse.Simple usage example to find a component by
clientId.private UIComponent found = null; private void doFind(FacesContext context, String clientId) { context.getViewRoot().invokeOnComponent(context, clientId, new ContextCallback() { public void invokeOnComponent(FacesContext context, UIComponent component) { found = component; } }); }- Parameters:
context- theFacesContextfor the current requestclientId- the client identifier of the component to be passed to the argument callback.callback- an implementation of the Callback interface.- Returns:
trueif the a component with the givenclientIdis found, the callback method was successfully invoked passing that component as an argument, and no Exception was thrown. Returnsfalseif no component with the givenclientIdis found.- Throws:
NullPointerException- if any of the arguments are nullFacesException- if the argument Callback throws an Exception, it is wrapped in aFacesExceptionand re-thrown.- Since:
- 1.2
abstract public java.util.Map<K, V>
getFacets()
返回表示与此 UIComponent 关联的 facet UIComponent 的可变 Map,以 facet 名称(必须是 String)作为键。返回的实现必须支持所有标准的和可选的 Map 方法,并支持以下附加要求:
Map实现必须实现java.io.Serializable接口。- 任何添加
null键或值的尝试都必定抛出 NullPointerException。 - 任何添加非 String 键的尝试都必定抛出 ClassCastException。
- 任何添加非
UIComponent的尝试都必定抛出 ClassCastException。 - 只要添加新 facet
UIComponent:- 组件的
parent属性就必须设置为此组件实例。 - 如果组件的
parent属性已经是非 null,则必须首先从此组件以前的父组件中移除此组件(在该父组件中它可能已经是子组件或 facet)。
- 组件的
- 只要移除现有的 facet
UIComponent:- facet 的
parent属性就必须设置为null。
- facet 的
getFacets
public abstract Map<String,UIComponent> getFacets()
Return a mutable
Maprepresenting the facetUIComponents associated with thisUIComponent, keyed by facet name (which must be a String). The returned implementation must support all of the standard and optionalMapmethods, plus support the following additional requirements:- The
Mapimplementation must implement thejava.io.Serializableinterface. - Any attempt to add a
nullkey or value must throw a NullPointerException. - Any attempt to add a key that is not a String must throw a ClassCastException.
- Any attempt to add a value that is not a
UIComponentmust throw a ClassCastException. - Whenever a new facet
UIComponentis added:- The
parentproperty of the component must be set to this component instance. - If the
parentproperty of the component was already non-null, the component must first be removed from its previous parent (where it may have been either a child or a facet).
- The
- Whenever an existing facet
UIComponentis removed:- The
parentproperty of the facet must be set tonull.
- The
- The
public int
getFacetCount()
返回与此 UIComponent 关联的 facet UIComponent 的数量。如果不存在 facet,则此方法必须返回 0。此方法不得导致创建 facet 组件映射。
为了与直接扩展 UIComponent 的类向后兼容,提供了默认实现,只需调用 #getFacets,然后对返回的 Map 调用 size() 方法即可。UIComponentBase#getFacetCount 中提供了此方法的更优化版本。
| since | 1.2 |
getFacetCount
public int getFacetCount()
Return the number of facet
UIComponents that are associated with thisUIComponent. If there are no facets, this method must return 0. The method must not cause the creation of a facet component map.For backwards compatability with classes that extend UIComponent directly, a default implementation is provided that simply calls
getFacets()and then calls thesize()method on the returnedMap. A more optimized version of this method is provided inUIComponentBase.getFacetCount().- Since:
- 1.2
abstract public UIComponent
getFacet(String name)
一个便捷方法,如果指定的 facet 存在,则返回指定的 facet,否则返回 null。如果请求的 facet 不存在,则不得创建 facet Map。
| name | 所需 facet 的名称 |
getFacet
public abstract UIComponent getFacet(String name)
Convenience method to return the named facet, if it exists, or
nullotherwise. If the requested facet does not exist, the facets Map must not be created.- Parameters:
name- Name of the desired facet
abstract public java.util.Iterator<E>
getFacetsAndChildren()
返回 facet 上的 Iterator,该 facet 后跟此 UIComponent 的子 UIComponent。返回的 facet 没有固定的顺序,所有子组件按其在子组件列表中存储的顺序跟在 facet 后面。如果此组件没有 facet 或子组件,则返回空 Iterator。
返回的 Iterator 不得支持 remove() 操作。
getFacetsAndChildren
public abstract Iterator<UIComponent> getFacetsAndChildren()
Return an
Iteratorover the facet followed by childUIComponents of thisUIComponent. Facets are returned in an undefined order, followed by all the children in the order they are stored in the child list. If this component has no facets or children, an emptyIteratoris returned.The returned
Iteratormust not support theremove()operation.
abstract public void
broadcast(FacesEvent event) throws AbortProcessingException
将指定的 FacesEvent 广播到表示关注此类型事件的所有注册的事件侦听器。侦听器按其添加的顺序调用。
| event |
要广播的 FacesEvent |
| Throws | AbortProcessingException: 通知 JavaServer Face 实现不应该继续处理当前事件 |
| Throws | IllegalArgumentException:
如果此组件不支持此 FacesEvent 的实现类 |
| Throws | NullPointerException:
如果 event 为 null |
broadcast
public abstract void broadcast(FacesEvent event) throws AbortProcessingException
Broadcast the specified
FacesEventto all registered event listeners who have expressed an interest in events of this type. Listeners are called in the order in which they were added.- Parameters:
event- TheFacesEventto be broadcast- Throws:
AbortProcessingException- Signal the JavaServer Faces implementation that no further processing on the current event should be performedIllegalArgumentException- if the implementation class of thisFacesEventis not supported by this componentNullPointerException- ifeventisnull
abstract public void
decode(FacesContext context)
从指定 FacesContext 包含的请求中对此 UIComponent 的任何新状态解码,并在需要时存储此状态。
在解码过程中,通过调用 queueEvent(),可将事件排队,以便稍后处理(由已注册关注此事件的事件侦听器处理)。
| context |
要处理的请求的 FacesContext |
| Throws | NullPointerException:
如果 context 为 null |
decode
public abstract void decode(FacesContext context)
Decode any new state of this
UIComponentfrom the request contained in the specifiedFacesContext, and store this state as needed.During decoding, events may be enqueued for later processing (by event listeners who have registered an interest), by calling
queueEvent().- Parameters:
context-FacesContextfor the request we are processing- Throws:
NullPointerException- ifcontextisnull
abstract public void
encodeBegin(FacesContext context) throws java.io.IOException
如果 rendered 属性为 true,则将此 UIComponent 的当前状态的开头呈现给指定 FacesContext 中包含的响应。
如果 Renderer 与此 UIComponent 关联,则实际编码操作将委托给 encodeBegin(FacesContext, UIComponent)。
| context |
要创建的响应的 FacesContext |
| Throws | java.io.IOException: 如果呈现期间发生输入/输出错误 |
| Throws | NullPointerException:
如果 context 为 null |
encodeBegin
public abstract void encodeBegin(FacesContext context) throws IOException
If our
renderedproperty istrue, render the beginning of the current state of thisUIComponentto the response contained in the specifiedFacesContext.If a
Rendereris associated with thisUIComponent, the actual encoding will be delegated toRenderer.encodeBegin(FacesContext, UIComponent).- Parameters:
context-FacesContextfor the response we are creating- Throws:
IOException- if an input/output error occurs while renderingNullPointerException- ifcontextisnull
abstract public void
encodeChildren(FacesContext context) throws java.io.IOException
如果 rendered 属性为 true,则呈现此 UIComponent 的子 UIComponent。仅当 rendersChildren 属性为 true 时才调用此方法。
如果 Renderer 与此 UIComponent 关联,则实际编码操作将委托给 encodeChildren(FacesContext, UIComponent)。
| context |
要创建的响应的 FacesContext |
| Throws | java.io.IOException: 如果呈现期间发生输入/输出错误 |
| Throws | NullPointerException:
如果 context 为 null |
encodeChildren
public abstract void encodeChildren(FacesContext context) throws IOException
If our
renderedproperty istrue, render the childUIComponents of thisUIComponent. This method will only be called if therendersChildrenproperty istrue.If a
Rendereris associated with thisUIComponent, the actual encoding will be delegated toRenderer.encodeChildren(FacesContext, UIComponent).- Parameters:
context-FacesContextfor the response we are creating- Throws:
IOException- if an input/output error occurs while renderingNullPointerException- ifcontextisnull
abstract public void
encodeEnd(FacesContext context) throws java.io.IOException
如果 rendered 属性为 true,则呈现此 UIComponent 的当前状态的末尾。
如果 Renderer 与此 UIComponent 关联,则实际编码操作将委托给 encodeEnd(FacesContext, UIComponent)。
| context |
要创建的响应的 FacesContext |
| Throws | java.io.IOException: 如果呈现期间发生输入/输出错误 |
| Throws | NullPointerException:
如果 context 为 null |
encodeEnd
public abstract void encodeEnd(FacesContext context) throws IOException
If our
renderedproperty istrue, render the ending of the current state of thisUIComponent.If a
Rendereris associated with thisUIComponent, the actual encoding will be delegated toRenderer.encodeEnd(FacesContext, UIComponent).- Parameters:
context-FacesContextfor the response we are creating- Throws:
IOException- if an input/output error occurs while renderingNullPointerException- ifcontextisnull
public void
encodeAll(FacesContext context) throws java.io.IOException
如果此组件从 #isRendered 返回 true,则呈现此组件及其从 isRendered() 返回 true 的所有子组件,不考虑 #getRendersChildren 标志的值。
| since | 1.2 |
| Throws | java.io.IOException: 如果呈现期间发生输入/输出错误 |
| Throws | NullPointerException:
如果 context 为 null |
encodeAll
public void encodeAll(FacesContext context) throws IOException
If this component returns
truefromisRendered(), render this component and all its children that returntruefromisRendered(), regardless of the value of thegetRendersChildren()flag.- Throws:
IOException- if an input/output error occurs while renderingNullPointerException- ifcontextisnull- Since:
- 1.2
abstract protected void
addFacesListener(FacesListener listener)
将指定的 FacesListener 添加到注册了接收此 UIComponent 事件通知的侦听器集合。预计作为事件源的 UIComponent 类将具有相应的类型安全 API 用于注册所需类型的侦听器,并且这些注册方法的实现将委托给此方法。例如:
public class FooEvent extends FacesEvent { ... }
public interface FooListener extends FacesListener {
public void processFoo(FooEvent event);
}
public class FooComponent extends UIComponentBase {
...
public void addFooListener(FooListener listener) {
addFacesListener(listener);
}
public void removeFooListener(FooListener listener) {
removeFacesListener(listener);
}
...
}
| listener |
要注册的 FacesListener |
| Throws | NullPointerException:
如果 listener 为 null |
addFacesListener
protected abstract void addFacesListener(FacesListener listener)
Add the specified
FacesListenerto the set of listeners registered to receive event notifications from thisUIComponent. It is expected thatUIComponentclasses acting as event sources will have corresponding typesafe APIs for registering listeners of the required type, and the implementation of those registration methods will delegate to this method. For example:public class FooEvent extends FacesEvent { ... } public interface FooListener extends FacesListener { public void processFoo(FooEvent event); } public class FooComponent extends UIComponentBase { ... public void addFooListener(FooListener listener) { addFacesListener(listener); } public void removeFooListener(FooListener listener) { removeFacesListener(listener); } ... }- Parameters:
listener- TheFacesListenerto be registered- Throws:
NullPointerException- iflistenerisnull
abstract protected FacesListener[]
getFacesListeners(Class<T> clazz)
返回作为指定类实例的已注册 FacesListener 的数组。如果不存在此类已注册侦听器,则返回一个长度为 0 的数组。返回的数组可以安全地强制转换为 clazz 元素类型的强制类型数组。
| clazz | 必须由其要返回的 FacesListener 实现的类 |
| Throws | IllegalArgumentException:
如果 clazz 不是 FacesListener 并且未实现 FacesListener |
| Throws | NullPointerException:
如果 clazz 为 null |
getFacesListeners
protected abstract FacesListener[] getFacesListeners(Class clazz)
Return an array of registered
FacesListeners that are instances of the specified class. If there are no such registered listeners, a zero-length array is returned. The returned array can be safely be cast to an array strongly typed to an element type ofclazz.- Parameters:
clazz- Class that must be implemented by aFacesListenerfor it to be returned- Throws:
IllegalArgumentException- ifclassis not, and does not implement,FacesListenerNullPointerException- ifclazzisnull
abstract protected void
removeFacesListener(FacesListener listener)
从注册接收此 UIComponent 事件通知的侦听器集合中移除指定的 FacesListener。
| listener |
要取消注册的 FacesListener |
| Throws | NullPointerException:
如果 listener 为 null |
removeFacesListener
protected abstract void removeFacesListener(FacesListener listener)
Remove the specified
FacesListenerfrom the set of listeners registered to receive event notifications from thisUIComponent.- Parameters:
listener- TheFacesListenerto be deregistered- Throws:
NullPointerException- iflistenerisnull
abstract public void
queueEvent(FacesEvent event)
将事件排队,以便在当前请求处理生命周期阶段结束时广播。UIComponentBase 中的默认实现必须将此调用委托给父 UIComponent 的 queueEvent() 方法。
| event |
要排队的 FacesEvent |
| Throws | IllegalStateException:
如果此组件不是 UIViewRoot 的后代 |
| Throws | NullPointerException:
如果 event 为 null |
queueEvent
public abstract void queueEvent(FacesEvent event)
Queue an event for broadcast at the end of the current request processing lifecycle phase. The default implementation in
UIComponentBasemust delegate this call to thequeueEvent()method of the parentUIComponent.- Parameters:
event-FacesEventto be queued- Throws:
IllegalStateException- if this component is not a descendant of aUIViewRootNullPointerException- ifeventisnull
abstract public void
processRestoreState(FacesContext context, Object state)
按如下操作,对此组件的所有 facet、此组件的所有子组件和此组件本身执行请求处理生命周期的恢复视图 阶段所需的组件树处理。
- 按照调用
getFacetsAndChildren()所确定的顺序,调用此UIComponent的所有 facet 和子组件的processRestoreState()方法。 - 调用此组件的
restoreState()方法。
如果状态保存方法被设置为服务器,则可能不能调用此方法。
| context |
要处理的请求的 FacesContext |
| Throws | NullPointerException:
如果 context 为 null |
processRestoreState
public abstract void processRestoreState(FacesContext context, Object state)
Perform the component tree processing required by the Restore View phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.
- Call the
processRestoreState()method of all facets and children of thisUIComponentin the order determined by a call togetFacetsAndChildren(). - Call the
restoreState()method of this component.
This method may not be called if the state saving method is set to server.
- Call the
- Parameters:
context-FacesContextfor the request we are processing- Throws:
NullPointerException- ifcontextisnull
abstract public void
processDecodes(FacesContext context)
按如下操作,对此组件的所有 facet、此组件的所有子组件和此组件本身执行请求处理生命周期的应用请求值 阶段所需的组件树处理。
- 如果此
UIComponent的rendered属性为false,则跳过进一步的处理。 - 按照调用
getFacetsAndChildren()所确定的顺序,调用此UIComponent的所有 facet 和子组件的processDecodes()方法。 - 调用此组件的
decode()方法。 - 如果在解码处理期间抛出
RuntimeException,则调用FacesContext#renderResponse并重新抛出该异常。
| context |
要处理的请求的 FacesContext |
| Throws | NullPointerException:
如果 context 为 null |
processDecodes
public abstract void processDecodes(FacesContext context)
Perform the component tree processing required by the Apply Request Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.
- If the
renderedproperty of thisUIComponentisfalse, skip further processing. - Call the
processDecodes()method of all facets and children of thisUIComponent, in the order determined by a call togetFacetsAndChildren(). - Call the
decode()method of this component. - If a
RuntimeExceptionis thrown during decode processing, callFacesContext.renderResponse()and re-throw the exception.
- If the
- Parameters:
context-FacesContextfor the request we are processing- Throws:
NullPointerException- ifcontextisnull
abstract public void
processValidators(FacesContext context)
按如下操作,对此组件的所有 facet、此组件的所有子组件和此组件本身执行请求处理生命周期的处理验证 阶段所需的组件树处理。
- 如果此
UIComponent的rendered属性为false,则跳过进一步的处理。 - 按照调用
getFacetsAndChildren()所确定的顺序,调用此UIComponent的所有 facet 和子组件的processValidators()方法。
| context |
要处理的请求的 FacesContext |
| Throws | NullPointerException:
如果 context 为 null |
processValidators
public abstract void processValidators(FacesContext context)
Perform the component tree processing required by the Process Validations phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.
- If the
renderedproperty of thisUIComponentisfalse, skip further processing. - Call the
processValidators()method of all facets and children of thisUIComponent, in the order determined by a call togetFacetsAndChildren().
- If the
- Parameters:
context-FacesContextfor the request we are processing- Throws:
NullPointerException- ifcontextisnull
abstract public void
processUpdates(FacesContext context)
按如下操作,对此组件的所有 facet、此组件的所有子组件和此组件本身执行请求处理生命周期的更新模型值 阶段所需的组件树处理。
- 如果此
UIComponent的rendered属性为false,则跳过进一步的处理。 - 按照调用
getFacetsAndChildren()所确定的顺序,调用此UIComponent的所有 facet 和子组件的processUpdates()方法。
| context |
要处理的请求的 FacesContext |
| Throws | NullPointerException:
如果 context 为 null |
processUpdates
public abstract void processUpdates(FacesContext context)
Perform the component tree processing required by the Update Model Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.
- If the
renderedproperty of thisUIComponentisfalse, skip further processing. - Call the
processUpdates()method of all facets and children of thisUIComponent, in the order determined by a call togetFacetsAndChildren().
- If the
- Parameters:
context-FacesContextfor the request we are processing- Throws:
NullPointerException- ifcontextisnull
abstract public Object
processSaveState(FacesContext context)
按如下操作,对此组件的所有 facet、此组件的所有子组件和此组件本身执行请求处理生命周期的呈现响应 阶段的状态保存部分所需的组件树处理。
- 参考此组件的
transient属性。如果为 true,则仅返回null。 - 按照调用
getFacetsAndChildren()所确定的顺序,调用此UIComponent的所有 facet 和子组件的processSaveState()方法,跳过瞬态的子组件和 facet。 - 调用此组件的
saveState()方法。 - 将子状态和所处状态封装到 Serializable Object 中并将其返回。
如果状态保存方法被设置为服务器,则可能不能调用此方法。
| context |
要处理的请求的 FacesContext |
| Throws | NullPointerException:
如果 context 为 null |
processSaveState
public abstract Object processSaveState(FacesContext context)
Perform the component tree processing required by the state saving portion of the Render Response phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.
- consult the
transientproperty of this component. If true, just returnnull. - Call the
processSaveState()method of all facets and children of thisUIComponentin the order determined by a call togetFacetsAndChildren(), skipping children and facets that are transient. - Call the
saveState()method of this component. - Encapsulate the child state and your state into a Serializable Object and return it.
This method may not be called if the state saving method is set to server.
- consult the
- Parameters:
context-FacesContextfor the request we are processing- Throws:
NullPointerException- ifcontextisnull
abstract protected FacesContext
getFacesContext()
一个便捷方法,返回当前请求的 FacesContext 实例。
getFacesContext
protected abstract FacesContext getFacesContext()
Convenience method to return the
FacesContextinstance for the current request.
abstract protected Renderer
getRenderer(FacesContext context)
一个便捷方法,返回与此组件关联的 Renderer 实例(如果有);否则返回 null。
| context |
当前请求的 FacesContext |
getRenderer
protected abstract Renderer getRenderer(FacesContext context)
Convenience method to return the
Rendererinstance associated with this component, if any; otherwise, returnnull.- Parameters:
context-FacesContextfor the current request
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!
javax.faces.component.UIComponent