|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
javax.faces.component Class UIComponent
java.lang.Objectjavax.faces.component.UIComponent
- 所有已实现的接口:
- StateHolder
- 直接已知子类:
- UIComponentBase
public abstract class UIComponent
- extends Object
- implements StateHolder
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.
| 字段摘要 | |
|---|---|
protected Map<String,ValueExpression> |
bindings
|
| 构造器摘要 | |
|---|---|
UIComponent()
|
|
| 方法摘要 | |
|---|---|
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. |
| 类方法继承 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 |
| 字段详细信息 |
|---|
bindings
protected Map<String,ValueExpression> bindings
| 构造器详细信息 |
|---|
UIComponent
public UIComponent()
| 方法详细信息 |
|---|
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
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.- 参数:
name- Name of the attribute or property for which to retrieve aValueBinding- 抛出异常:
NullPointerException- ifnameisnull
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).- 参数:
name- Name of the attribute or property for which to set aValueBindingbinding- TheValueBindingto set, ornullto remove any currently setValueBinding- 抛出异常:
IllegalArgumentException- ifnameis one ofidorparentNullPointerException- ifnameisnull
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.
- 参数:
name- Name of the attribute or property for which to retrieve aValueExpression- 抛出异常:
NullPointerException- ifnameisnull- 从以下版本开始:
- 1.2
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.
- 参数:
name- Name of the attribute or property for which to set aValueExpressionbinding- TheValueExpressionto set, ornullto remove any currently setValueExpression- 抛出异常:
IllegalArgumentException- ifnameis one ofidorparentNullPointerException- ifnameisnull- 从以下版本开始:
- 1.2
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.- 参数:
context- TheFacesContextfor the current request- 抛出异常:
NullPointerException- ifcontextisnull
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.- 抛出异常:
NullPointerException- ifcontextisnull- 从以下版本开始:
- 1.2
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.
getId
public abstract String getId()
Return the component identifier of this
UIComponent.
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.
- 参数:
id- The new component identifier, ornullto indicate that thisUIComponentdoes not have a component identifier- 抛出异常:
IllegalArgumentException- ifidis not syntactically valid
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( ).
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.- 参数:
parent- The new parent, ornullfor the root node of a component tree
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.
setRendered
public abstract void setRendered(boolean rendered)
Set the
renderedproperty of thisUIComponent.- 参数:
rendered- Iftruerender this component; otherwise, do not render this component
getRendererType
public abstract String getRendererType()
Return the
Renderertype for thisUIComponent(if any).
setRendererType
public abstract void setRendererType(String rendererType)
Set the
Renderertype for thisUIComponent, ornullfor components that render themselves.- 参数:
rendererType- Logical identifier of the type ofRendererto use, ornullfor components that render themselves
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).
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
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.
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
- 参数:
expr- Search expression identifying theUIComponentto be returned- 返回:
- the found
UIComponent, ornullif the component was not found. - 抛出异常:
IllegalArgumentException- if an intermediate identifier in a search expression identifies aUIComponentthat is not aNamingContainerNullPointerException- ifexprisnull
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; } }); }- 参数:
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.- 返回:
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.- 抛出异常:
NullPointerException- if any of the arguments are nullFacesException- if the argument Callback throws an Exception, it is wrapped in aFacesExceptionand re-thrown.- 从以下版本开始:
- 1.2
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
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().- 从以下版本开始:
- 1.2
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.- 参数:
name- Name of the desired facet
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.
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.- 参数:
event- TheFacesEventto be broadcast- 抛出异常:
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
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().- 参数:
context-FacesContextfor the request we are processing- 抛出异常:
NullPointerException- ifcontextisnull
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).- 参数:
context-FacesContextfor the response we are creating- 抛出异常:
IOException- if an input/output error occurs while renderingNullPointerException- ifcontextisnull
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).- 参数:
context-FacesContextfor the response we are creating- 抛出异常:
IOException- if an input/output error occurs while renderingNullPointerException- ifcontextisnull
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).- 参数:
context-FacesContextfor the response we are creating- 抛出异常:
IOException- if an input/output error occurs while renderingNullPointerException- ifcontextisnull
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.- 抛出异常:
IOException- if an input/output error occurs while renderingNullPointerException- ifcontextisnull- 从以下版本开始:
- 1.2
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); } ... }- 参数:
listener- TheFacesListenerto be registered- 抛出异常:
NullPointerException- iflistenerisnull
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.- 参数:
clazz- Class that must be implemented by aFacesListenerfor it to be returned- 抛出异常:
IllegalArgumentException- ifclassis not, and does not implement,FacesListenerNullPointerException- ifclazzisnull
removeFacesListener
protected abstract void removeFacesListener(FacesListener listener)
Remove the specified
FacesListenerfrom the set of listeners registered to receive event notifications from thisUIComponent.- 参数:
listener- TheFacesListenerto be deregistered- 抛出异常:
NullPointerException- iflistenerisnull
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.- 参数:
event-FacesEventto be queued- 抛出异常:
IllegalStateException- if this component is not a descendant of aUIViewRootNullPointerException- ifeventisnull
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
- 参数:
context-FacesContextfor the request we are processing- 抛出异常:
NullPointerException- ifcontextisnull
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
- 参数:
context-FacesContextfor the request we are processing- 抛出异常:
NullPointerException- ifcontextisnull
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
- 参数:
context-FacesContextfor the request we are processing- 抛出异常:
NullPointerException- ifcontextisnull
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
- 参数:
context-FacesContextfor the request we are processing- 抛出异常:
NullPointerException- ifcontextisnull
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
- 参数:
context-FacesContextfor the request we are processing- 抛出异常:
NullPointerException- ifcontextisnull
getFacesContext
protected abstract FacesContext getFacesContext()
Convenience method to return the
FacesContextinstance for the current request.
getRenderer
protected abstract Renderer getRenderer(FacesContext context)
Convenience method to return the
Rendererinstance associated with this component, if any; otherwise, returnnull.- 参数:
context-FacesContextfor the current request
|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.
javax.faces.component.UIComponent