Class BehaviorHolderWrapper
- All Implemented Interfaces:
ClientBehaviorHolder,PartialStateHolder,StateHolder,TransientStateHolder,ComponentSystemEventListener,FacesListener,SystemEventListenerHolder,EventListener
-
Field Summary
Fields inherited from class jakarta.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, FACETS_KEY, VIEW_LOCATION_KEY -
Constructor Summary
ConstructorsConstructorDescriptionBehaviorHolderWrapper(UIComponent parent, String virtualEvent, String event, jakarta.el.ValueExpression targets) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClientBehavior(String eventName, ClientBehavior behavior) Attaches aClientBehaviorto the component implementing this interface for the specified event.protected voidaddFacesListener(FacesListener listener) Add the specifiedFacesListenerto the set of listeners registered to receive event notifications from thisUIComponent.voidbroadcast(FacesEvent event) Broadcast the specifiedFacesEventto all registered event listeners who have expressed an interest in events of this type.voiddecode(FacesContext context) Decode any new state of thisUIComponentfrom the request contained in the specifiedFacesContext, and store this state as needed.voidencodeBegin(FacesContext context) If ourrenderedproperty istrue, render the beginning of the current state of thisUIComponentto the response contained in the specifiedFacesContext.voidencodeChildren(FacesContext context) voidencodeEnd(FacesContext context) findComponent(String expr) Search for and return theUIComponentwith anidthat matches the specified search expression (if any), according to the algorithm described below.Return a mutableMaprepresenting the attributes (and properties, see below) associated wth thisUIComponent, keyed by attribute name (which must be a String).intReturn the number of childUIComponents that are associated with thisUIComponent.Returns a non-null, unmodifiableMapthat contains the theClientBehaviors that have been attached to the component implementing this interface.getClientId(FacesContext context) Return a client-side identifier for this component, generating one if necessary.Returns the default event name for thisClientBehaviorHolderimplementation.Returns a non-null, unmodifiableCollectioncontaining the names of the logical events supported by the component implementing this interface.protected FacesContextConvenience method to return theFacesContextinstance for the current request.protected FacesListener[]getFacesListeners(Class clazz) Return an array of registeredFacesListeners that are instances of the specified class.Convenience method to return the named facet, if it exists, ornullotherwise.Return a mutableMaprepresenting the facetUIComponents associated with thisUIComponent, keyed by facet name (which must be a String).Return the identifier of the component family to which this component belongs.getId()Return the component identifier of thisUIComponent.Return the parentUIComponentof thisUIComponent, if any.getPassThroughAttributes(boolean create) This method has the same specification asUIComponent.getPassThroughAttributes()except that it is allowed to returnnullif and only if the argumentcreateisfalseand no pass through attribute data structure exists for this instance.protected RenderergetRenderer(FacesContext context) Convenience method to return theRendererinstance associated with this component, if any; otherwise, returnnull.Return theRenderertype for thisUIComponent(if any).booleanReturn a flag indicating whether this component is responsible for rendering its child components.jakarta.el.ValueExpressionjakarta.el.ValueExpressiongetValueExpression(String name) Return theValueExpressionused to calculate the value for the specified attribute or property name, if any.booleaninvokeOnComponent(FacesContext context, String clientId, ContextCallback callback) Starting at this component in the View hierarchy, search for a component with aclientIdequal to the argumentclientIdand, if found, call theContextCallback.invokeContextCallback(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent)method on the argumentcallback, passing the currentFacesContextand the found component as arguments.booleanisInView()Returntrueif this component is within the view hierarchy otherwisefalsebooleanReturntrueif this component (and its children) should be rendered during the Render Response phase of the request processing lifecycle.booleanIf true, the Object implementing this interface must not participate in state saving or restoring.voidprocessDecodes(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.voidprocessEvent(ComponentSystemEvent event) The default implementation performs the following action.voidprocessRestoreState(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.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.voidprocessUpdates(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.voidprocessValidators(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.voidqueueEvent(FacesEvent event) Queue an event for broadcast at the end of the current request processing lifecycle phase.protected voidremoveFacesListener(FacesListener listener) Remove the specifiedFacesListenerfrom the set of listeners registered to receive event notifications from thisUIComponent.voidrestoreState(FacesContext context, Object state) Perform any processing required to restore the state from the entries in the state Object.saveState(FacesContext context) Gets the state of the instance as aSerializableObject.voidSet the component identifier of thisUIComponent(if any).voidsetParent(UIComponent parent) Set the parentUIComponentof thisUIComponent.voidsetRendered(boolean rendered) Set therenderedproperty of thisUIComponent.voidsetRendererType(String rendererType) voidsetTransient(boolean newTransientValue) Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.voidsetValueExpression(String name, jakarta.el.ValueExpression binding) Set theValueExpressionused to calculate the value for the specified attribute or property name, if any.voidsubscribeToEvent(Class<? extends SystemEvent> eventClass, ComponentSystemEventListener componentListener) This implementation throwsUnsupportedOperationExceptionand is provided for the sole purpose of not breaking existing applications that extend this class.voidunsubscribeFromEvent(Class<? extends SystemEvent> eventClass, ComponentSystemEventListener componentListener) This implementation throwsUnsupportedOperationExceptionand is provided for the sole purpose of not breaking existing applications that extend this class.booleanvisitTree(VisitContext context, VisitCallback callback) Perform a tree visit starting at this node in the tree.Methods inherited from class jakarta.faces.component.UIComponent
clearInitialState, encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getFacetCount, getListenersForEventClass, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, initialStateMarked, isCompositeComponent, isVisitable, markInitialState, popComponentFromEL, pushComponentToEL, restoreTransientState, saveTransientState, setInView
-
Constructor Details
-
BehaviorHolderWrapper
public BehaviorHolderWrapper(UIComponent parent, String virtualEvent, String event, jakarta.el.ValueExpression targets)
-
-
Method Details
-
broadcast
Description copied from class:UIComponentBroadcast 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.If the
eventis an instance ofBehaviorEventand the currentcomponentis the source of theeventcallBehaviorEvent.getBehavior()to get theBehaviorfor the event. CallBehavior.broadcast(jakarta.faces.event.BehaviorEvent)on theBehaviorinstance.- Specified by:
broadcastin classUIComponent- Parameters:
event- TheFacesEventto be broadcast- Throws:
AbortProcessingException- Signal the Jakarta Faces implementation that no further processing on the current event should be performed- See Also:
-
decode
Description copied from class:UIComponentDecode 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().- Specified by:
decodein classUIComponent- Parameters:
context-FacesContextfor the request we are processing- See Also:
-
encodeBegin
Description copied from class:UIComponentIf our
renderedproperty istrue, render the beginning of the current state of thisUIComponentto the response contained in the specifiedFacesContext. CallUIComponent.pushComponentToEL(jakarta.faces.context.FacesContext,jakarta.faces.component.UIComponent). CallApplication.publishEvent(jakarta.faces.context.FacesContext, java.lang.Class<? extends jakarta.faces.event.SystemEvent>, java.lang.Object), passingPreRenderComponentEvent.classas the first argument and the component instance to be rendered as the second argument.If a
Rendereris associated with thisUIComponent, the actual encoding will be delegated toRenderer.encodeBegin(FacesContext, UIComponent).If our
renderedproperty isfalse, callUIComponent.pushComponentToEL(jakarta.faces.context.FacesContext,jakarta.faces.component.UIComponent)and return immediately.- Specified by:
encodeBeginin classUIComponent- Parameters:
context-FacesContextfor the response we are creating- Throws:
IOException- if an input/output error occurs while rendering- See Also:
-
encodeChildren
Description copied from class:UIComponentIf 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). If noRendereris associated with thisUIComponent, iterate over each of the children of this component and callUIComponent.encodeAll(jakarta.faces.context.FacesContext).- Specified by:
encodeChildrenin classUIComponent- Parameters:
context-FacesContextfor the response we are creating- Throws:
IOException- if an input/output error occurs while rendering- See Also:
-
encodeEnd
Description copied from class:UIComponentIf 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).Call
UIComponent.popComponentFromEL(jakarta.faces.context.FacesContext). before returning regardless of the value of therenderedproperty.- Specified by:
encodeEndin classUIComponent- Parameters:
context-FacesContextfor the response we are creating- Throws:
IOException- if an input/output error occurs while rendering- See Also:
-
findComponent
Description copied from class:UIComponentSearch for and return the
UIComponentwith anidthat matches the specified search expression (if any), according to the algorithm described below.WARNING: The found
UIComponentinstance, 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. SeeUIComponent.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 foundUIComponentinstance.UIComponent.invokeOnComponent(jakarta.faces.context.FacesContext, java.lang.String, jakarta.faces.component.ContextCallback)is also useful to find components given a simpleclientId.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 theUINamingContainer.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:- 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
- Specified by:
findComponentin classUIComponent- Parameters:
expr- Search expression identifying theUIComponentto be returned- Returns:
- the found
UIComponent, ornullif the component was not found. - See Also:
- Identify the
-
getAttributes
Description copied from class:UIComponentReturn 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.
- Specified by:
getAttributesin classUIComponent- Returns:
- the component attribute map.
- See Also:
- The
-
getPassThroughAttributes
Description copied from class:UIComponentThis method has the same specification as
UIComponent.getPassThroughAttributes()except that it is allowed to returnnullif and only if the argumentcreateisfalseand no pass through attribute data structure exists for this instance. The returnedMapimplementation must support all of the standard and optionalMapmethods, plus support the following additional requirements. The map must be stored in usingUIComponent.getStateHelper().The
Mapimplementation must implementjava.io.Serializable.Any attempt to add a
nullkey or value must throw aNullPointerException.Any attempt to add a key that is not a
Stringmust throw anIllegalArgumentException.For backward compatibility with components that extend directly from this class, a default implementation is provided that returns the empty map.
- Overrides:
getPassThroughAttributesin classUIComponent- Parameters:
create- iftrue, a newMapinstance will be created if it does not exist already. Iffalse, and there is no existingMapinstance, one will not be created andnullwill be returned.- Returns:
- A
Mapinstance, ornull.
-
getChildCount
public int getChildCount()Description copied from class:UIComponentReturn 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.- Specified by:
getChildCountin classUIComponent- Returns:
- the number of child components.
- See Also:
-
getChildren
Description copied from class:UIComponentReturn 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. -
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, passingPostAddToViewEvent.classas the first argument and the newly added component as the second argument if any the following cases are true.-
FacesContext.getCurrentPhaseId()returnsPhaseId.RESTORE_VIEWand partial state saving is enabled. -
FacesContext.isPostback()returnsfalseandFacesContext.getCurrentPhaseId()returns something other thanPhaseId.RESTORE_VIEW
-
- Specified by:
getChildrenin classUIComponent- Returns:
- the list of children.
- See Also:
- The
-
getClientId
Description copied from class:UIComponentReturn 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. CallUIComponent.getId()on this component and save the result as themyIdlocal variable. IfmyIdisnull, callcontext.getViewRoot().createUniqueId()and assign the result to myId. IfparentIdis non-null, letmyIdequalparentId +. CallUINamingContainer.getSeparatorChar(jakarta.faces.context.FacesContext)+ myIdRenderer.convertClientId(jakarta.faces.context.FacesContext, java.lang.String), passingmyId, and return the result.- Specified by:
getClientIdin classUIComponent- Parameters:
context- TheFacesContextfor the current request- Returns:
- the client id.
- See Also:
-
getFacet
Description copied from class:UIComponentConvenience 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.- Specified by:
getFacetin classUIComponent- Parameters:
name- Name of the desired facet- Returns:
- the component, or
null. - See Also:
-
getFacets
Description copied from class:UIComponentReturn 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
- Specified by:
getFacetsin classUIComponent- Returns:
- the map of facets.
- See Also:
- The
-
getFacetsAndChildren
Description copied from class:UIComponentReturn 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.- Specified by:
getFacetsAndChildrenin classUIComponent- Returns:
- the facets and children iterator.
- See Also:
-
getFamily
Description copied from class:UIComponentReturn 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. Note this method should NOT returnnull- Specified by:
getFamilyin classUIComponent- Returns:
- the component family (not null).
- See Also:
-
getId
Description copied from class:UIComponentReturn the component identifier of this
UIComponent.- Specified by:
getIdin classUIComponent- Returns:
- the component identifier.
- See Also:
-
getParent
Description copied from class:UIComponentReturn 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( ).- Specified by:
getParentin classUIComponent- Returns:
- the parent component.
- See Also:
-
getRendererType
Description copied from class:UIComponentReturn the
Renderertype for thisUIComponent(if any).- Specified by:
getRendererTypein classUIComponent- Returns:
- the renderer type.
- See Also:
-
getRendersChildren
public boolean getRendersChildren()Description copied from class:UIComponentReturn 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 Jakarta Faces Specification, component authors are encouraged to returntruefrom this method and rely onUIComponentBase.encodeChildren(jakarta.faces.context.FacesContext).- Specified by:
getRendersChildrenin classUIComponent- Returns:
trueif the component renders its children,falseotherwise.- See Also:
-
getValueExpression
Description copied from class:UIComponentReturn 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 Jakarta Faces 1.2 and later.
- Overrides:
getValueExpressionin classUIComponent- Parameters:
name- Name of the attribute or property for which to retrieve aValueExpression- Returns:
- the value expression, or
null.
-
invokeOnComponent
public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback) throws FacesException Description copied from class:UIComponentStarting at this component in the View hierarchy, search for a component with a
clientIdequal to the argumentclientIdand, if found, call theContextCallback.invokeContextCallback(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent)method on the argumentcallback, passing the currentFacesContextand the found component as arguments. This method is similar toUIComponent.findComponent(java.lang.String)but it does not support the leadingUINamingContainer.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 argumentclientId. If so, first callUIComponent.pushComponentToEL(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent), then call theContextCallback.invokeContextCallback(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent)method on the argument callback, passing through theFacesContextargument and passing this as the component argument. Then callUIComponent.popComponentFromEL(jakarta.faces.context.FacesContext). If anExceptionis thrown by the callback, wrap it in aFacesExceptionand re-throw it. Otherwise, returntrue.Otherwise, for each component returned by
UIComponent.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(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 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
UIComponent.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 invokeContextCallback(FacesContext context, UIComponent component) { found = component; } }); }- Overrides:
invokeOnComponentin classUIComponent- 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:
FacesException- if the argument Callback throws an Exception, it is wrapped in aFacesExceptionand re-thrown.- See Also:
-
isInView
public boolean isInView()Description copied from class:UIComponentReturn
trueif this component is within the view hierarchy otherwisefalse- Overrides:
isInViewin classUIComponent- Returns:
trueif within a view hierarchy,falseotherwise.- See Also:
-
isRendered
public boolean isRendered()Description copied from class:UIComponentReturn
trueif this component (and its children) should be rendered during the Render Response phase of the request processing lifecycle.- Specified by:
isRenderedin classUIComponent- Returns:
trueif the component should be rendered,falseotherwise.- See Also:
-
isTransient
public boolean isTransient()Description copied from interface:StateHolderIf true, the Object implementing this interface must not participate in state saving or restoring.
- Specified by:
isTransientin interfaceStateHolder- Returns:
trueif transient,falseotherwise.- See Also:
-
processDecodes
Description copied from class: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.
- If the
renderedproperty of thisUIComponentisfalse, skip further processing. - Call
UIComponent.pushComponentToEL(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent). - 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. - Call
UIComponent.popComponentFromEL(jakarta.faces.context.FacesContext)from inside of afinally block, just before returning. - If a
RuntimeExceptionis thrown during decode processing, callFacesContext.renderResponse()and re-throw the exception.
- Specified by:
processDecodesin classUIComponent- Parameters:
context-FacesContextfor the request we are processing- See Also:
- If the
-
processEvent
Description copied from class:UIComponentThe default implementation performs the following action. If the argument
eventis an instance ofPostRestoreStateEvent, callthis.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 theValueExpressionto bethis.- Specified by:
processEventin interfaceComponentSystemEventListener- Overrides:
processEventin classUIComponent- Parameters:
event- theComponentSystemEventinstance that is being processed.- Throws:
AbortProcessingException- if lifecycle processing should cease for this request.- See Also:
-
processRestoreState
Description copied from class: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.
- Call the
restoreState()method of this component. - Call
UIComponent.pushComponentToEL(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent). - Call the
processRestoreState()method of all facets and children of thisUIComponentin the order determined by a call togetFacetsAndChildren(). After returning from theprocessRestoreState()method on a child or facet, callUIComponent.popComponentFromEL(jakarta.faces.context.FacesContext)
This method may not be called if the state saving method is set to server.
- Specified by:
processRestoreStatein classUIComponent- Parameters:
context-FacesContextfor the request we are processingstate- the state.- See Also:
- Call the
-
processSaveState
Description copied from class: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.
- consult the
transientproperty of this component. If true, just returnnull. - Call
UIComponent.pushComponentToEL(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent). - 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. Ensure thatUIComponent.popComponentFromEL(jakarta.faces.context.FacesContext)is called correctly after each child or facet. - 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.
- Specified by:
processSaveStatein classUIComponent- Parameters:
context-FacesContextfor the request we are processing- Returns:
- the saved state.
- See Also:
- consult the
-
processUpdates
Description copied from class: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.
- If the
renderedproperty of thisUIComponentisfalse, skip further processing. - Call
UIComponent.pushComponentToEL(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent). - Call the
processUpdates()method of all facets and children of thisUIComponent, in the order determined by a call togetFacetsAndChildren(). After returning from theprocessUpdates()method on a child or facet, callUIComponent.popComponentFromEL(jakarta.faces.context.FacesContext)
- Specified by:
processUpdatesin classUIComponent- Parameters:
context-FacesContextfor the request we are processing- See Also:
- If the
-
processValidators
Description copied from class: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.
- If the
renderedproperty of thisUIComponentisfalse, skip further processing. - Call
UIComponent.pushComponentToEL(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent). - Call the
processValidators()method of all facets and children of thisUIComponent, in the order determined by a call togetFacetsAndChildren(). - After returning from calling
getFacetsAndChildren()callUIComponent.popComponentFromEL(jakarta.faces.context.FacesContext).
- Specified by:
processValidatorsin classUIComponent- Parameters:
context-FacesContextfor the request we are processing- See Also:
- If the
-
queueEvent
Description copied from class:UIComponentQueue 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.- Specified by:
queueEventin classUIComponent- Parameters:
event-FacesEventto be queued- See Also:
-
restoreState
Description copied from interface: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
UIComponentwith event handlers, validators, etc.) this method must call theStateHolder.restoreState(jakarta.faces.context.FacesContext, java.lang.Object)method on all those instances as well.If the
stateargument isnull, take no action and return.- Specified by:
restoreStatein interfaceStateHolder- Parameters:
context- the Faces context.state- the state.- See Also:
-
saveState
Description copied from interface:StateHolderGets the state of the instance as a
SerializableObject.If the class that implements this interface has references to instances that implement StateHolder (such as a
UIComponentwith event handlers, validators, etc.) this method must call theStateHolder.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 theStateManagerThis method must not alter the state of the implementing object. In other words, after executing this code:
Object state = component.saveState(facesContext);componentshould be the same as before executing it.The return from this method must be
Serializable- Specified by:
saveStatein interfaceStateHolder- Parameters:
context- the Faces context.- Returns:
- the saved state.
- See Also:
-
setId
Description copied from class:UIComponentSet 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.
- Specified by:
setIdin classUIComponent- Parameters:
id- The new component identifier, ornullto indicate that thisUIComponentdoes not have a component identifier- See Also:
-
setParent
Description copied from class:UIComponentSet the parent
UIComponentof thisUIComponent. Ifparent.isInView()returnstrue, calling this method will first cause aPreRemoveFromViewEventto be published, for this node, and then the children of this node. Then, once the re-parenting has occurred, aPostAddToViewEventwill 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()returnsPhaseId.RESTORE_VIEWand partial state saving is enabled. -
FacesContext.isPostback()returnsfalseandFacesContext.getCurrentPhaseId()returns something other thanPhaseId.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 childListor facetMap.- Specified by:
setParentin classUIComponent- Parameters:
parent- The new parent, ornullfor the root node of a component tree- See Also:
-
-
setRendered
public void setRendered(boolean rendered) Description copied from class:UIComponentSet the
renderedproperty of thisUIComponent.- Specified by:
setRenderedin classUIComponent- Parameters:
rendered- Iftruerender this component; otherwise, do not render this component- See Also:
-
setRendererType
Description copied from class:UIComponentSet the
Renderertype for thisUIComponent, ornullfor components that render themselves.- Specified by:
setRendererTypein classUIComponent- Parameters:
rendererType- Logical identifier of the type ofRendererto use, ornullfor components that render themselves- See Also:
-
setTransient
public void setTransient(boolean newTransientValue) Description copied from interface:StateHolderDenotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.
- Specified by:
setTransientin interfaceStateHolder- Parameters:
newTransientValue- boolean passtrueif this Object will not participate in state saving or restoring, otherwise passfalse.- See Also:
-
setValueExpression
Description copied from class:UIComponentSet 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(jakarta.el.ELContext)on the argument expression and pass the result as thevalueparameter in a call tothis.whereUIComponent.getAttributes().put(name, value)nameis the argumentname. If an exception is thrown as a result of callingValueExpression.getValue(jakarta.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 Jakarta Faces 1.2 and later.
- Overrides:
setValueExpressionin classUIComponent- Parameters:
name- Name of the attribute or property for which to set aValueExpressionbinding- TheValueExpressionto set, ornullto remove any currently setValueExpression- See Also:
-
subscribeToEvent
public void subscribeToEvent(Class<? extends SystemEvent> eventClass, ComponentSystemEventListener componentListener) Description copied from class:UIComponentThis implementation throws
UnsupportedOperationExceptionand is provided for the sole purpose of not breaking existing applications that extend this class.UIComponentBaseprovides the implementation of this method.- Overrides:
subscribeToEventin classUIComponent- Parameters:
eventClass- the event class.componentListener- the listener.- See Also:
-
unsubscribeFromEvent
public void unsubscribeFromEvent(Class<? extends SystemEvent> eventClass, ComponentSystemEventListener componentListener) Description copied from class:UIComponentThis implementation throws
UnsupportedOperationExceptionand is provided for the sole purpose of not breaking existing applications that extend this class.UIComponentBaseprovides the implementation of this method.- Overrides:
unsubscribeFromEventin classUIComponent- Parameters:
eventClass- the event class.componentListener- the component listener.- See Also:
-
visitTree
Description copied from class:UIComponentPerform a tree visit starting at this node in the tree.
UIComponent.visitTree() implementations do not invoke the
VisitCallbackdirectly, but instead callVisitContext.invokeVisitCallback(jakarta.faces.component.UIComponent, jakarta.faces.component.visit.VisitCallback)to invoke the callback. This allowsVisitContextimplementations to provide optimized tree traversals, for example by only calling theVisitCallbackfor a subset of components.UIComponent.visitTree() implementations must call UIComponent.pushComponentToEL() before performing the visit and UIComponent.popComponentFromEL() after the visit.
- Overrides:
visitTreein classUIComponent- Parameters:
context- theVisitContextfor this visitcallback- theVisitCallbackinstance whosevisitmethod will be called for each node visited.- Returns:
- component implementations may return
trueto 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. - See Also:
-
addFacesListener
Description copied from class:UIComponentAdd 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); } ... }- Specified by:
addFacesListenerin classUIComponent- Parameters:
listener- TheFacesListenerto be registered
-
getFacesContext
Description copied from class:UIComponentConvenience method to return the
FacesContextinstance for the current request.- Specified by:
getFacesContextin classUIComponent- Returns:
- the Faces context.
-
getFacesListeners
Description copied from class:UIComponentReturn 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.- Specified by:
getFacesListenersin classUIComponent- Parameters:
clazz- Class that must be implemented by aFacesListenerfor it to be returned- Returns:
- the Faces listeners, or a zero-length array.
-
getRenderer
Description copied from class:UIComponentConvenience method to return the
Rendererinstance associated with this component, if any; otherwise, returnnull.- Specified by:
getRendererin classUIComponent- Parameters:
context-FacesContextfor the current request- Returns:
- the renderer, or
null.
-
removeFacesListener
Description copied from class:UIComponentRemove the specified
FacesListenerfrom the set of listeners registered to receive event notifications from thisUIComponent.- Specified by:
removeFacesListenerin classUIComponent- Parameters:
listener- TheFacesListenerto be deregistered
-
addClientBehavior
Description copied from interface:ClientBehaviorHolderAttaches a
ClientBehaviorto the component implementing this interface for the specified event. Valid event names for a UIComponent implementation are defined byClientBehaviorHolder.getEventNames().- Specified by:
addClientBehaviorin interfaceClientBehaviorHolder- Parameters:
eventName- the logical name of the client-side event to attach the behavior to.behavior- theClientBehaviorinstance to attach for the specified event name.
-
getClientBehaviors
Description copied from interface:ClientBehaviorHolderReturns a non-null, unmodifiable
Mapthat contains the theClientBehaviors that have been attached to the component implementing this interface. The keys in thisMapare event names defined byClientBehaviorHolder.getEventNames().- Specified by:
getClientBehaviorsin interfaceClientBehaviorHolder- Returns:
- an unmodifiable map of client behaviors.
-
getDefaultEventName
Description copied from interface:ClientBehaviorHolderReturns the default event name for this
ClientBehaviorHolderimplementation. This must be one of the event names returned byClientBehaviorHolder.getEventNames()or null if the component does not have a default event.- Specified by:
getDefaultEventNamein interfaceClientBehaviorHolder- Returns:
- the default event name.
-
getEventNames
Description copied from interface:ClientBehaviorHolderReturns a non-null, unmodifiable
Collectioncontaining the names of the logical events supported by the component implementing this interface.- Specified by:
getEventNamesin interfaceClientBehaviorHolder- Returns:
- an unmodifiable collection of event names.
-
getTargets
public jakarta.el.ValueExpression getTargets()
-