public class BehaviorHolderWrapper
extends jakarta.faces.component.UIComponent
implements jakarta.faces.component.behavior.ClientBehaviorHolder
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEY| Constructor and Description |
|---|
BehaviorHolderWrapper(jakarta.faces.component.UIComponent parent,
String virtualEvent,
String event,
jakarta.el.ValueExpression targets) |
| Modifier and Type | Method and Description |
|---|---|
void |
addClientBehavior(String eventName,
jakarta.faces.component.behavior.ClientBehavior behavior)
Attaches a |
protected void |
addFacesListener(jakarta.faces.event.FacesListener listener)
Add the specified
FacesListener to the set of listeners registered to receive event notifications from this
UIComponent. |
void |
broadcast(jakarta.faces.event.FacesEvent event)
Broadcast the specified
FacesEvent to all registered event listeners who have expressed an interest in events
of this type. |
void |
decode(jakarta.faces.context.FacesContext context)
Decode any new state of this
UIComponent from the request contained in the specified FacesContext,
and store this state as needed. |
void |
encodeBegin(jakarta.faces.context.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. |
void |
encodeChildren(jakarta.faces.context.FacesContext context)
If our
rendered property is true, render the child UIComponents of this
UIComponent. |
void |
encodeEnd(jakarta.faces.context.FacesContext context)
If our
rendered property is true, render the
ending of the current state of this UIComponent. |
jakarta.faces.component.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. |
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). |
int |
getChildCount()
Return the number of child
UIComponents that are associated with this UIComponent. |
List<jakarta.faces.component.UIComponent> |
getChildren()
Return a mutable
List representing the child
UIComponents associated with this component. |
Map<String,List<jakarta.faces.component.behavior.ClientBehavior>> |
getClientBehaviors()
Returns a non-null, unmodifiable |
String |
getClientId(jakarta.faces.context.FacesContext context)
Return a client-side identifier for this component, generating one if necessary.
|
String |
getDefaultEventName()
Returns the default event name for this |
Collection<String> |
getEventNames()
Returns a non-null, unmodifiable |
protected jakarta.faces.context.FacesContext |
getFacesContext()
Convenience method to return the
FacesContext instance for the current request. |
protected jakarta.faces.event.FacesListener[] |
getFacesListeners(Class clazz)
Return an array of registered
FacesListeners that are instances of the specified class. |
jakarta.faces.component.UIComponent |
getFacet(String name)
Convenience method to return the named facet, if it exists, or
null otherwise. |
Map<String,jakarta.faces.component.UIComponent> |
getFacets()
Return a mutable
Map representing the facet UIComponents associated with this
UIComponent, keyed by facet name (which must be a String). |
Iterator<jakarta.faces.component.UIComponent> |
getFacetsAndChildren()
Return an
Iterator over the facet followed by child UIComponents of this UIComponent. |
String |
getFamily()
Return the identifier of the component family to which this component belongs. |
String |
getId()
Return the component identifier of this
UIComponent. |
jakarta.faces.component.UIComponent |
getParent()
Return the parent
UIComponent of this UIComponent, if any. |
Map<String,Object> |
getPassThroughAttributes(boolean create)
This method has the same specification as |
protected jakarta.faces.render.Renderer |
getRenderer(jakarta.faces.context.FacesContext context)
Convenience method to return the
Renderer instance associated with this component, if any; otherwise, return
null. |
String |
getRendererType()
Return the
Renderer type for this UIComponent (if any). |
boolean |
getRendersChildren()
Return a flag indicating whether this component is responsible for rendering its child components.
|
jakarta.el.ValueExpression |
getTargets() |
jakarta.faces.el.ValueBinding |
getValueBinding(String name)
Deprecated.
|
jakarta.el.ValueExpression |
getValueExpression(String name)
Return the
ValueExpression used to calculate the value for the specified attribute or property name, if any. |
boolean |
invokeOnComponent(jakarta.faces.context.FacesContext context,
String clientId,
jakarta.faces.component.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(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent) method on the argument callback, passing the current
FacesContext and the found component as arguments. |
boolean |
isInView()
Return |
boolean |
isRendered()
Return
true if this component (and its children) should be rendered during the Render Response
phase of the request processing lifecycle. |
boolean |
isTransient()
If true, the Object implementing this interface must not participate in state saving or restoring.
|
void |
processDecodes(jakarta.faces.context.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.
|
void |
processEvent(jakarta.faces.event.ComponentSystemEvent event)
The default implementation performs the following action. |
void |
processRestoreState(jakarta.faces.context.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.
|
Object |
processSaveState(jakarta.faces.context.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.
|
void |
processUpdates(jakarta.faces.context.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.
|
void |
processValidators(jakarta.faces.context.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.
|
void |
queueEvent(jakarta.faces.event.FacesEvent event)
Queue an event for broadcast at the end of the current request processing lifecycle phase.
|
protected void |
removeFacesListener(jakarta.faces.event.FacesListener listener)
Remove the specified
FacesListener from the set of listeners registered to receive event notifications from
this UIComponent. |
void |
restoreState(jakarta.faces.context.FacesContext context,
Object state)
Perform any processing required to restore the state from the entries
in the state Object.
|
Object |
saveState(jakarta.faces.context.FacesContext context)
Gets the state of the instance as a
Serializable Object. |
void |
setId(String id)
Set the component identifier of this
UIComponent (if any). |
void |
setParent(jakarta.faces.component.UIComponent parent)
Set the parent |
void |
setRendered(boolean rendered)
Set the
rendered property of this UIComponent. |
void |
setRendererType(String rendererType)
Set the
Renderer type for this UIComponent, or null for components that render
themselves. |
void |
setTransient(boolean newTransientValue)
Denotes whether or not the Object implementing this interface must or
must not participate in state saving or restoring.
|
void |
setValueBinding(String name,
jakarta.faces.el.ValueBinding binding)
Deprecated.
|
void |
setValueExpression(String name,
jakarta.el.ValueExpression binding)
Set the
ValueExpression used to calculate the value for the specified attribute or property name, if any. |
void |
subscribeToEvent(Class<? extends jakarta.faces.event.SystemEvent> eventClass,
jakarta.faces.event.ComponentSystemEventListener componentListener)
This implementation throws |
void |
unsubscribeFromEvent(Class<? extends jakarta.faces.event.SystemEvent> eventClass,
jakarta.faces.event.ComponentSystemEventListener componentListener)
This implementation throws |
boolean |
visitTree(jakarta.faces.component.visit.VisitContext context,
jakarta.faces.component.visit.VisitCallback callback)
Perform a tree visit starting at this node in the tree. |
clearInitialState, encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getFacetCount, getListenersForEventClass, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, initialStateMarked, isCompositeComponent, isVisitable, markInitialState, popComponentFromEL, pushComponentToEL, restoreTransientState, saveTransientState, setInViewpublic void broadcast(jakarta.faces.event.FacesEvent event)
throws jakarta.faces.event.AbortProcessingException
jakarta.faces.component.UIComponent
Broadcast the specified FacesEvent to 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.
If the event is an instance of BehaviorEvent and the current
component is the source of the event call
BehaviorEvent.getBehavior() to get the Behavior
for the event.
Call
Behavior.broadcast(jakarta.faces.event.BehaviorEvent) on the
Behavior instance.
broadcast in class jakarta.faces.component.UIComponentevent - The FacesEvent to be broadcastjakarta.faces.event.AbortProcessingException - Signal the Jakarta Server Faces implementation that no further processing on the
current event should be performedUIComponent.broadcast(jakarta.faces.event.FacesEvent)public void decode(jakarta.faces.context.FacesContext context)
jakarta.faces.component.UIComponent
Decode any new state of this UIComponent from the request contained in the specified FacesContext,
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().
decode in class jakarta.faces.component.UIComponentcontext - FacesContext for the request we are processingUIComponent.decode(jakarta.faces.context.FacesContext)public void encodeBegin(jakarta.faces.context.FacesContext context)
throws IOException
jakarta.faces.component.UIComponent
If our rendered property is true, render the
beginning of the current state of this UIComponent to the response contained in the specified
FacesContext. Call
UIComponent.pushComponentToEL(jakarta.faces.context.FacesContext,jakarta.faces.component.UIComponent). Call
Application.publishEvent(jakarta.faces.context.FacesContext, java.lang.Class<? extends jakarta.faces.event.SystemEvent>, java.lang.Object), passing
PreRenderComponentEvent.class as the first argument and the component
instance to be rendered as the second argument.
If a Renderer is associated with this UIComponent, the actual encoding will be delegated to
Renderer.encodeBegin(FacesContext, UIComponent).
If our rendered property is false, call
UIComponent.pushComponentToEL(jakarta.faces.context.FacesContext,jakarta.faces.component.UIComponent) and return
immediately.
encodeBegin in class jakarta.faces.component.UIComponentcontext - FacesContext for the response we are creatingIOException - if an input/output error occurs while renderingUIComponent.encodeBegin(jakarta.faces.context.FacesContext)public void encodeChildren(jakarta.faces.context.FacesContext context)
throws IOException
jakarta.faces.component.UIComponent
If our rendered property is true, render the child UIComponents of this
UIComponent. This method will only be called if the rendersChildren property is
true.
If a Renderer is associated with this UIComponent, the actual encoding will be delegated to
Renderer.encodeChildren(FacesContext, UIComponent). If no Renderer
is associated with this UIComponent, iterate over each of the children of this component and call
UIComponent.encodeAll(jakarta.faces.context.FacesContext).
encodeChildren in class jakarta.faces.component.UIComponentcontext - FacesContext for the response we are creatingIOException - if an input/output error occurs while renderingUIComponent.encodeChildren(jakarta.faces.context.FacesContext)public void encodeEnd(jakarta.faces.context.FacesContext context)
throws IOException
jakarta.faces.component.UIComponent
If our rendered property is true, render the
ending of the current state of this UIComponent.
If a Renderer is associated with this UIComponent, the actual encoding will be delegated to
Renderer.encodeEnd(FacesContext, UIComponent).
Call UIComponent.popComponentFromEL(jakarta.faces.context.FacesContext). before returning regardless of the value of the rendered
property.
encodeEnd in class jakarta.faces.component.UIComponentcontext - FacesContext for the response we are creatingIOException - if an input/output error occurs while renderingUIComponent.encodeEnd(jakarta.faces.context.FacesContext)public jakarta.faces.component.UIComponent findComponent(String expr)
jakarta.faces.component.UIComponent
Search for and return the UIComponent with an id that
matches the specified search expression (if any), according to the algorithm described below.
WARNING: The found UIComponent instance, if any, is returned without regard for its
tree traversal context. Retrieving an Jakarta Expression Language-bound attribute from the component is not safe.
Jakarta Expression Language expressions can contain implicit objects, such as #{component}, which assume
they are being evaluated within the scope of a tree traversal context. Evaluating expressions with these kinds of
implicit objects outside of a tree traversal context produces undefined results. See UIComponent.invokeOnComponent(jakarta.faces.context.FacesContext, java.lang.String, jakarta.faces.component.ContextCallback) for a
method that does correctly account for the tree traversal context when operating on the found
UIComponent instance. UIComponent.invokeOnComponent(jakarta.faces.context.FacesContext, java.lang.String, jakarta.faces.component.ContextCallback) is also useful to find components given a simple
clientId.
Component identifiers are required to be unique within the scope of the closest ancestor NamingContainer that
encloses this component (which might be this component itself). If there are no NamingContainer components in
the ancestry of this component, the root component in the tree is treated as if it were a NamingContainer,
whether or not its class actually implements the NamingContainer interface.
A search expression consists of either an identifier (which is matched exactly against the id
property of a UIComponent, or a series of such identifiers linked by the
UINamingContainer.getSeparatorChar(jakarta.faces.context.FacesContext) character value. The search algorithm should operates as follows, though
alternate alogrithms may be used as long as the end result is the same:
UIComponent that will be the base for searching, by stopping as soon as one of the following
conditions is met:
UIComponent of 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.UIComponent is a NamingContainer it will serve as the basis.NamingContainer is encountered, it will be the
base.NamingContainer is encountered) the root UIComponent will be the base.id that matches, within the scope of the base
component. The match is performed as follows:
id property, and then
recursively through the facets and children of the base UIComponent (except that if a descendant
NamingContainer is found, its own facets and children are not searched).NamingContainer by the rules in the previous bullet point. Then, the
findComponent() method of this NamingContainer will be called, passing the remainder of the
search expression.findComponent in class jakarta.faces.component.UIComponentexpr - Search expression identifying the UIComponent to be returnedUIComponent, or null if the component was not found.UIComponent.findComponent(java.lang.String)public Map<String,Object> getAttributes()
jakarta.faces.component.UIComponent
Return a mutable Map representing the attributes (and properties, see below) associated wth this
UIComponent, keyed by attribute name (which must be a String). The returned implementation must support all
of the standard and optional Map methods, plus support the following additional requirements:
Map implementation must implement the java.io.Serializable interface.null key or value must throw a NullPointerException.ClassCastException.UIComponent's implementation class,
the following methods will have special behavior:
containsKey - Return false.get() - If the property is readable, call the getter method and return the returned value (wrapping
primitive values in their corresponding wrapper classes); otherwise throw IllegalArgumentException.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 to null, throw IllegalArgumentException.remove - Throw IllegalArgumentException.getAttributes in class jakarta.faces.component.UIComponentUIComponent.getAttributes()public Map<String,Object> getPassThroughAttributes(boolean create)
jakarta.faces.component.UIComponent
This method has the same specification as UIComponent.getPassThroughAttributes() except that it is allowed to return
null if and only if the argument create is false and no pass through attribute data structure
exists for this instance. The returned Map implementation must support all of the standard and optional
Map methods, plus support the following additional requirements. The map must be stored in using
UIComponent.getStateHelper().
The Map implementation must implement java.io.Serializable.
Any attempt to add a null key or value must throw a NullPointerException.
Any attempt to add a key that is not a String must throw an IllegalArgumentException.
For backward compatibility with components that extend directly from this class, a default implementation is provided that returns the empty map.
getPassThroughAttributes in class jakarta.faces.component.UIComponentcreate - if true, a new Map instance will be created if it does not exist already. If
false, and there is no existing Map instance, one will not be created and null
will be returned.Map instance, or null.public int getChildCount()
jakarta.faces.component.UIComponent
Return the number of child UIComponents that are associated with this UIComponent. If there are no
children, this method must return 0. The method must not cause the creation of a child component list.
getChildCount in class jakarta.faces.component.UIComponentUIComponent.getChildCount()public List<jakarta.faces.component.UIComponent> getChildren()
jakarta.faces.component.UIComponent
Return a mutable List representing the child
UIComponents associated with this component. The returned implementation must support all of the standard and
optional List methods, plus support the following additional requirements:
List implementation must implement the java.io.Serializable interface.null must throw a NullPointerExceptionUIComponent must throw a ClassCastException.parent property of the child must be set to this
component instance. If the parent property 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).parent property of the child must be set to
null.
After the child component has been added to the view, Application.publishEvent(jakarta.faces.context.FacesContext, java.lang.Class<? extends jakarta.faces.event.SystemEvent>, java.lang.Object) must
be called, passing PostAddToViewEvent.class as the first argument and the
newly added component as the second argument if any the following cases are true.
FacesContext.getCurrentPhaseId() returns PhaseId.RESTORE_VIEW
and partial state saving is enabled.
FacesContext.isPostback() returns false and
FacesContext.getCurrentPhaseId() returns something other than
PhaseId.RESTORE_VIEW
getChildren in class jakarta.faces.component.UIComponentUIComponent.getChildren()public String getClientId(jakarta.faces.context.FacesContext context)
jakarta.faces.component.UIComponent
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
id property of the component is changed, or the component is placed in a NamingContainer whose
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. Call getContainerClientId() on it and save the result as the
parentId local variable. Call UIComponent.getId() on this component and save the result as the
myId local variable. If myId is null, call
context.getViewRoot().createUniqueId() and assign the result to myId. If parentId is
non-null, let myId equal parentId
+ . Call UINamingContainer.getSeparatorChar(jakarta.faces.context.FacesContext) + myIdRenderer.convertClientId(jakarta.faces.context.FacesContext, java.lang.String), passing
myId, and return the result.
getClientId in class jakarta.faces.component.UIComponentcontext - The FacesContext for the current requestUIComponent.getClientId(jakarta.faces.context.FacesContext)public jakarta.faces.component.UIComponent getFacet(String name)
jakarta.faces.component.UIComponent
Convenience method to return the named facet, if it exists, or null otherwise. If the requested facet
does not exist, the facets Map must not be created.
getFacet in class jakarta.faces.component.UIComponentname - Name of the desired facetnull.UIComponent.getFacet(java.lang.String)public Map<String,jakarta.faces.component.UIComponent> getFacets()
jakarta.faces.component.UIComponent
Return a mutable Map representing the facet UIComponents associated with this
UIComponent, keyed by facet name (which must be a String). The returned implementation must support all of
the standard and optional Map methods, plus support the following additional requirements:
Map implementation must implement the java.io.Serializable interface.null key or value must throw a NullPointerException.UIComponent must throw a ClassCastException.UIComponent is added:
parent property of the component must be set to this component instance.parent property 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).UIComponent is removed:
parent property of the facet must be set to null.getFacets in class jakarta.faces.component.UIComponentUIComponent.getFacets()public Iterator<jakarta.faces.component.UIComponent> getFacetsAndChildren()
jakarta.faces.component.UIComponent
Return an Iterator over the facet followed by child UIComponents of this UIComponent.
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 empty Iterator is returned.
The returned Iterator must not support the remove() operation.
getFacetsAndChildren in class jakarta.faces.component.UIComponentUIComponent.getFacetsAndChildren()public String getFamily()
jakarta.faces.component.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 appropriate Renderer for this
component instance. Note this method should NOT return null
getFamily in class jakarta.faces.component.UIComponentUIComponent.getFamily()public String getId()
jakarta.faces.component.UIComponent
Return the component identifier of this UIComponent.
getId in class jakarta.faces.component.UIComponentUIComponent.getId()public jakarta.faces.component.UIComponent getParent()
jakarta.faces.component.UIComponent
Return the parent UIComponent of this UIComponent, 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 from getParent( ).
getParent in class jakarta.faces.component.UIComponentUIComponent.getParent()public String getRendererType()
jakarta.faces.component.UIComponent
Return the Renderer type for this UIComponent (if any).
getRendererType in class jakarta.faces.component.UIComponentUIComponent.getRendererType()public boolean getRendersChildren()
jakarta.faces.component.UIComponent
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 calls Renderer.getRendersChildren() and returns the result. If it doesn't, it returns false. As of
version 1.2 of the Jakarta Server Faces Specification, component authors are encouraged to return true
from this method and rely on UIComponentBase.encodeChildren(jakarta.faces.context.FacesContext).
getRendersChildren in class jakarta.faces.component.UIComponenttrue if the component renders its children, false otherwise.UIComponent.getRendersChildren()@Deprecated public jakarta.faces.el.ValueBinding getValueBinding(String name)
jakarta.faces.component.UIComponent
Call through to UIComponent.getValueExpression(java.lang.String) and examine the result. If the result is an instance of the wrapper class
mandated in UIComponent.setValueBinding(java.lang.String, jakarta.faces.el.ValueBinding), extract the ValueBinding instance and return it. Otherwise, wrap
the result in an implementation of ValueBinding, and return it.
getValueBinding in class jakarta.faces.component.UIComponentname - Name of the attribute or property for which to retrieve a ValueBindingUIComponent.getValueBinding(java.lang.String)public jakarta.el.ValueExpression getValueExpression(String name)
jakarta.faces.component.UIComponent
Return the ValueExpression used 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 Jakarta Server Faces 1.2 and later.
getValueExpression in class jakarta.faces.component.UIComponentname - Name of the attribute or property for which to retrieve a ValueExpressionnull.UIComponent.getValueExpression(java.lang.String)public boolean invokeOnComponent(jakarta.faces.context.FacesContext context,
String clientId,
jakarta.faces.component.ContextCallback callback)
throws jakarta.faces.FacesException
jakarta.faces.component.UIComponent
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(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent) method on the argument callback, passing the current
FacesContext and the found component as arguments. This method is similar to UIComponent.findComponent(java.lang.String) but it
does not support the leading UINamingContainer.getSeparatorChar(jakarta.faces.context.FacesContext) syntax for searching from the root of the
View.
The default implementation will first check if this.getClientId() is equal to the argument
clientId. If so, first call UIComponent.pushComponentToEL(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent), then call
the ContextCallback.invokeContextCallback(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent) method on the argument callback, passing through the
FacesContext argument and passing this as the component argument. Then
call UIComponent.popComponentFromEL(jakarta.faces.context.FacesContext). If an Exception is thrown by the callback, wrap it in a
FacesException and re-throw it. Otherwise, return true.
Otherwise, for each component returned by UIComponent.getFacetsAndChildren(), call invokeOnComponent()
passing the arguments to this method, in order. The first time invokeOnComponent() returns true, abort
traversing the rest of the Iterator and return true.
When calling ContextCallback.invokeContextCallback(jakarta.faces.context.FacesContext, jakarta.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 argument clientId. For example, an iterating component such as
UIData will need to set its row index to correctly reflect the argument clientId before finding
the appropriate child component backed by the correct row. When the callback returns, either normally or by throwing
an Exception the 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 UIComponent.getFacetsAndChildren() returned true from
invokeOnComponent(), return false.
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 invokeContextCallback(FacesContext context,
UIComponent component) {
found = component;
}
});
}
invokeOnComponent in class jakarta.faces.component.UIComponentcontext - the FacesContext for the current requestclientId - the client identifier of the component to be passed to the argument callback.callback - an implementation of the Callback interface.true if the a component with the given clientId is found, the callback method was
successfully invoked passing that component as an argument, and no Exception was thrown. Returns false
if no component with the given clientId is found.jakarta.faces.FacesException - if the argument Callback throws an Exception, it is wrapped in a FacesException
and re-thrown.UIComponent.invokeOnComponent(jakarta.faces.context.FacesContext, java.lang.String,
jakarta.faces.component.ContextCallback)public boolean isInView()
jakarta.faces.component.UIComponent
Return true if this component is within the view hierarchy otherwise false
isInView in class jakarta.faces.component.UIComponenttrue if within a view hierarchy, false otherwise.UIComponent.isInView()public boolean isRendered()
jakarta.faces.component.UIComponent
Return true if this component (and its children) should be rendered during the Render Response
phase of the request processing lifecycle.
isRendered in class jakarta.faces.component.UIComponenttrue if the component should be rendered, false otherwise.UIComponent.isRendered()public boolean isTransient()
jakarta.faces.component.StateHolderIf true, the Object implementing this interface must not participate in state saving or restoring.
isTransient in interface jakarta.faces.component.StateHoldertrue if transient, false otherwise.StateHolder.isTransient()public void processDecodes(jakarta.faces.context.FacesContext context)
jakarta.faces.component.UIComponentPerform 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.
rendered property of this UIComponent is false, skip further
processing.UIComponent.pushComponentToEL(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent).processDecodes() method of all facets and children of this UIComponent, in the
order determined by a call to getFacetsAndChildren().decode() method of this component.UIComponent.popComponentFromEL(jakarta.faces.context.FacesContext) from inside of a finally block, just before returning.RuntimeException is thrown during decode processing, call FacesContext.renderResponse()
and re-throw the exception.processDecodes in class jakarta.faces.component.UIComponentcontext - FacesContext for the request we are processingUIComponent.processDecodes(jakarta.faces.context.FacesContext)public void processEvent(jakarta.faces.event.ComponentSystemEvent event)
throws jakarta.faces.event.AbortProcessingException
jakarta.faces.component.UIComponent
The default implementation performs the following action. If the argument event is an instance of
PostRestoreStateEvent, call this.UIComponent.getValueExpression(java.lang.String) passing the literal string
“binding”, without the quotes, as the argument. If the result is non-null, set the value of
the ValueExpression to be this.
processEvent in interface jakarta.faces.event.ComponentSystemEventListenerprocessEvent in class jakarta.faces.component.UIComponentevent - the ComponentSystemEvent instance that is being processed.jakarta.faces.event.AbortProcessingException - if lifecycle processing should cease for this request.UIComponent.processEvent(jakarta.faces.event.ComponentSystemEvent)public void processRestoreState(jakarta.faces.context.FacesContext context,
Object state)
jakarta.faces.component.UIComponentPerform 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.
restoreState() method of this component.UIComponent.pushComponentToEL(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent).processRestoreState() method of all facets and children of this UIComponent in the
order determined by a call to getFacetsAndChildren(). After returning
from the processRestoreState() method on a child or facet, call
UIComponent.popComponentFromEL(jakarta.faces.context.FacesContext)This method may not be called if the state saving method is set to server.
processRestoreState in class jakarta.faces.component.UIComponentcontext - FacesContext for the request we are processingstate - the state.UIComponent.processRestoreState(jakarta.faces.context.FacesContext, java.lang.Object)public Object processSaveState(jakarta.faces.context.FacesContext context)
jakarta.faces.component.UIComponentPerform 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.
transient property of this component. If true, just return null.UIComponent.pushComponentToEL(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent).processSaveState() method of all facets and children of this UIComponent in the
order determined by a call to getFacetsAndChildren(), skipping children and facets that are transient.
Ensure that UIComponent.popComponentFromEL(jakarta.faces.context.FacesContext) is called correctly after each child or facet.saveState() method of this component.This method may not be called if the state saving method is set to server.
processSaveState in class jakarta.faces.component.UIComponentcontext - FacesContext for the request we are processingUIComponent.processSaveState(jakarta.faces.context.FacesContext)public void processUpdates(jakarta.faces.context.FacesContext context)
jakarta.faces.component.UIComponentPerform 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.
rendered property of this UIComponent is false, skip further
processing.UIComponent.pushComponentToEL(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent).processUpdates() method of all facets and children of this UIComponent, in the
order determined by a call to getFacetsAndChildren(). After returning
from the processUpdates() method on a child or facet, call
UIComponent.popComponentFromEL(jakarta.faces.context.FacesContext)processUpdates in class jakarta.faces.component.UIComponentcontext - FacesContext for the request we are processingUIComponent.processUpdates(jakarta.faces.context.FacesContext)public void processValidators(jakarta.faces.context.FacesContext context)
jakarta.faces.component.UIComponentPerform 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.
rendered property of this UIComponent is false, skip further
processing.UIComponent.pushComponentToEL(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent).processValidators() method of all facets and children of this UIComponent, in the
order determined by a call to getFacetsAndChildren().getFacetsAndChildren() call
UIComponent.popComponentFromEL(jakarta.faces.context.FacesContext).processValidators in class jakarta.faces.component.UIComponentcontext - FacesContext for the request we are processingUIComponent.processValidators(jakarta.faces.context.FacesContext)public void queueEvent(jakarta.faces.event.FacesEvent event)
jakarta.faces.component.UIComponent
Queue an event for broadcast at the end of the current request processing lifecycle phase. The default implementation
in UIComponentBase must delegate this call to the queueEvent() method of the parent
UIComponent.
queueEvent in class jakarta.faces.component.UIComponentevent - FacesEvent to be queuedUIComponent.queueEvent(jakarta.faces.event.FacesEvent)public void restoreState(jakarta.faces.context.FacesContext context,
Object state)
jakarta.faces.component.StateHolderPerform 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 the StateHolder.restoreState(jakarta.faces.context.FacesContext, java.lang.Object)
method on all those instances as well.
If the state argument is null, take no action and return.
restoreState in interface jakarta.faces.component.StateHoldercontext - the Faces context.state - the state.StateHolder.restoreState(jakarta.faces.context.FacesContext, java.lang.Object)public Object saveState(jakarta.faces.context.FacesContext context)
jakarta.faces.component.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 the StateHolder.saveState(jakarta.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 the StateManager
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 interface jakarta.faces.component.StateHoldercontext - the Faces context.StateHolder.saveState(jakarta.faces.context.FacesContext)public void setId(String id)
jakarta.faces.component.UIComponent
Set the component identifier of this UIComponent (if any). Component identifiers must obey the following
syntax restrictions:
Component identifiers must also obey the following semantic restrictions (note that this restriction is
NOT enforced by the setId() implementation):
UIComponent that is a NamingContainer, or within the scope of the entire component
tree if there is no such ancestor that is a NamingContainer.setId in class jakarta.faces.component.UIComponentid - The new component identifier, or null to indicate that this UIComponent does not have
a component identifierUIComponent.setId(java.lang.String)public void setParent(jakarta.faces.component.UIComponent parent)
jakarta.faces.component.UIComponent
Set the parent UIComponent of this
UIComponent. If
parent.isInView() returns true, calling this method will first cause a
PreRemoveFromViewEvent to be published, for this node, and then the children of this
node. Then, once the re-parenting has occurred, a PostAddToViewEvent will be published as
well, first for this node, and then for the node's children, but only if any
of the following conditions are true.
FacesContext.getCurrentPhaseId() returns PhaseId.RESTORE_VIEW
and partial state saving is enabled.
FacesContext.isPostback() returns false and
FacesContext.getCurrentPhaseId() returns something other than
PhaseId.RESTORE_VIEW
This method must never be called by developers; a UIComponent's internal implementation will call it
as components are added to or removed from a parent's child List or facet Map.
setParent in class jakarta.faces.component.UIComponentparent - The new parent, or null for the root node of a component treeUIComponent.setParent(jakarta.faces.component.UIComponent)public void setRendered(boolean rendered)
jakarta.faces.component.UIComponent
Set the rendered property of this UIComponent.
setRendered in class jakarta.faces.component.UIComponentrendered - If true render this component; otherwise, do not render this componentUIComponent.setRendered(boolean)public void setRendererType(String rendererType)
jakarta.faces.component.UIComponent
Set the Renderer type for this UIComponent, or null for components that render
themselves.
setRendererType in class jakarta.faces.component.UIComponentrendererType - Logical identifier of the type of Renderer to use, or null for components
that render themselvesUIComponent.setRendererType(java.lang.String)public void setTransient(boolean newTransientValue)
jakarta.faces.component.StateHolderDenotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.
setTransient in interface jakarta.faces.component.StateHoldernewTransientValue - boolean pass true if this Object will
not participate in state saving or restoring, otherwise pass false.StateHolder.setTransient(boolean)@Deprecated public void setValueBinding(String name, jakarta.faces.el.ValueBinding binding)
jakarta.faces.component.UIComponent
Wrap the argument binding in an implementation of ValueExpression and call through to
UIComponent.setValueExpression(java.lang.String, jakarta.el.ValueExpression).
setValueBinding in class jakarta.faces.component.UIComponentname - Name of the attribute or property for which to set a ValueBindingbinding - The ValueBinding to set, or null to remove any currently set ValueBindingUIComponent.setValueBinding(java.lang.String, jakarta.faces.el.ValueBinding)public void setValueExpression(String name, jakarta.el.ValueExpression binding)
jakarta.faces.component.UIComponent
Set the ValueExpression used to calculate the value for the specified attribute or property name, if any.
The implementation must call Expression.isLiteralText() on the argument expression. If
isLiteralText() returns true, invoke ValueExpression.getValue(jakarta.el.ELContext) on the argument
expression and pass the result as the value parameter in a call to this. where UIComponent.getAttributes().put(name, value)name is the argument name. If an exception
is thrown as a result of calling ValueExpression.getValue(jakarta.el.ELContext), wrap it in a FacesException
and re-throw it. If isLiteralText() returns false, simply store the un-evaluated
expression argument in the collection of ValueExpressions under the key given by the
argument name.
This method must be overridden and implemented for components that comply with Jakarta Server Faces 1.2 and later.
setValueExpression in class jakarta.faces.component.UIComponentname - Name of the attribute or property for which to set a ValueExpressionbinding - The ValueExpression to set, or null to remove any currently set
ValueExpressionUIComponent.setValueExpression(java.lang.String, jakarta.el.ValueExpression)public void subscribeToEvent(Class<? extends jakarta.faces.event.SystemEvent> eventClass, jakarta.faces.event.ComponentSystemEventListener componentListener)
jakarta.faces.component.UIComponent
This implementation throws UnsupportedOperationException and is provided for the sole purpose of not
breaking existing applications that extend this class. UIComponentBase provides the implementation of this
method.
subscribeToEvent in class jakarta.faces.component.UIComponenteventClass - the event class.componentListener - the listener.UIComponent.subscribeToEvent(java.lang.Class,
jakarta.faces.event.ComponentSystemEventListener)public void unsubscribeFromEvent(Class<? extends jakarta.faces.event.SystemEvent> eventClass, jakarta.faces.event.ComponentSystemEventListener componentListener)
jakarta.faces.component.UIComponent
This implementation throws UnsupportedOperationException and is provided for the sole purpose of not
breaking existing applications that extend this class. UIComponentBase provides the implementation of this
method.
unsubscribeFromEvent in class jakarta.faces.component.UIComponenteventClass - the event class.componentListener - the component listener.UIComponent.unsubscribeFromEvent(java.lang.Class,
jakarta.faces.event.ComponentSystemEventListener)public boolean visitTree(jakarta.faces.component.visit.VisitContext context,
jakarta.faces.component.visit.VisitCallback callback)
jakarta.faces.component.UIComponentPerform a tree visit starting at this node in the tree.
UIComponent.visitTree() implementations do not invoke the VisitCallback directly, but instead call
VisitContext.invokeVisitCallback(jakarta.faces.component.UIComponent, jakarta.faces.component.visit.VisitCallback) to invoke the callback. This allows VisitContext implementations to
provide optimized tree traversals, for example by only calling the VisitCallback for a subset of components.
UIComponent.visitTree() implementations must call UIComponent.pushComponentToEL() before performing the visit and UIComponent.popComponentFromEL() after the visit.
visitTree in class jakarta.faces.component.UIComponentcontext - the VisitContext for this visitcallback - the VisitCallback instance whose visit method will be called for each node
visited.true to indicate that the tree visit is complete (eg. all
components that need to be visited have been visited). This results in the tree visit being short-circuited such that
no more components are visited.
UIComponent.visitTree(jakarta.faces.component.visit.VisitContext,
jakarta.faces.component.visit.VisitCallback)protected void addFacesListener(jakarta.faces.event.FacesListener listener)
jakarta.faces.component.UIComponent
Add the specified FacesListener to the set of listeners registered to receive event notifications from this
UIComponent. It is expected that UIComponent classes 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);
}
...
}
addFacesListener in class jakarta.faces.component.UIComponentlistener - The FacesListener to be registeredprotected jakarta.faces.context.FacesContext getFacesContext()
jakarta.faces.component.UIComponent
Convenience method to return the FacesContext instance for the current request.
getFacesContext in class jakarta.faces.component.UIComponentprotected jakarta.faces.event.FacesListener[] getFacesListeners(Class clazz)
jakarta.faces.component.UIComponent
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 of clazz.
getFacesListeners in class jakarta.faces.component.UIComponentclazz - Class that must be implemented by a FacesListener for it to be returnedprotected jakarta.faces.render.Renderer getRenderer(jakarta.faces.context.FacesContext context)
jakarta.faces.component.UIComponent
Convenience method to return the Renderer instance associated with this component, if any; otherwise, return
null.
getRenderer in class jakarta.faces.component.UIComponentcontext - FacesContext for the current requestnull.protected void removeFacesListener(jakarta.faces.event.FacesListener listener)
jakarta.faces.component.UIComponent
Remove the specified FacesListener from the set of listeners registered to receive event notifications from
this UIComponent.
removeFacesListener in class jakarta.faces.component.UIComponentlistener - The FacesListener to be deregisteredpublic void addClientBehavior(String eventName, jakarta.faces.component.behavior.ClientBehavior behavior)
jakarta.faces.component.behavior.ClientBehaviorHolder
Attaches a ClientBehavior to the component implementing this interface for the specified event. Valid event
names for a UIComponent implementation are defined by ClientBehaviorHolder.getEventNames().
addClientBehavior in interface jakarta.faces.component.behavior.ClientBehaviorHoldereventName - the logical name of the client-side event to attach the behavior to.behavior - the ClientBehavior instance to attach for the specified event name.public Map<String,List<jakarta.faces.component.behavior.ClientBehavior>> getClientBehaviors()
jakarta.faces.component.behavior.ClientBehaviorHolder
Returns a non-null, unmodifiable Map that contains the the ClientBehaviors that have been
attached to the component implementing this interface. The keys in this Map are event names defined by
ClientBehaviorHolder.getEventNames().
getClientBehaviors in interface jakarta.faces.component.behavior.ClientBehaviorHolderpublic String getDefaultEventName()
jakarta.faces.component.behavior.ClientBehaviorHolder
Returns the default event name for this ClientBehaviorHolder implementation. This must be one of the
event names returned by ClientBehaviorHolder.getEventNames() or null if the component does not have a default event.
getDefaultEventName in interface jakarta.faces.component.behavior.ClientBehaviorHolderpublic Collection<String> getEventNames()
jakarta.faces.component.behavior.ClientBehaviorHolder
Returns a non-null, unmodifiable Collection containing the names of the logical events supported by the
component implementing this interface.
getEventNames in interface jakarta.faces.component.behavior.ClientBehaviorHolderpublic jakarta.el.ValueExpression getTargets()
Copyright © 2010–2022 JBoss by Red Hat. All rights reserved.