- All Implemented Interfaces:
NamingContainer
,PartialStateHolder
,StateHolder
,TransientStateHolder
,UniqueIdVendor
,ComponentSystemEventListener
,FacesListener
,SystemEventListenerHolder
,EventListener
-
Field Summary
Fields inherited from class jakarta.faces.component.UINamingContainer
SEPARATOR_CHAR_PARAM_NAME
Fields inherited from class jakarta.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, FACETS_KEY, VIEW_LOCATION_KEY
Fields inherited from interface jakarta.faces.component.NamingContainer
SEPARATOR_CHAR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
broadcast
(FacesEvent event) Broadcast the specifiedFacesEvent
to all registered event listeners who have expressed an interest in events of this type.void
encodeChildren
(FacesContext faces) getBegin()
getClientId
(FacesContext faces) Return a client-side identifier for this component, generating one if necessary.getEnd()
Return the identifier of the component family to which this component belongs.boolean
Return a flag indicating whether this component is responsible for rendering its child components.getSize()
getStep()
getValue()
getVar()
boolean
invokeOnComponent
(FacesContext faces, String clientId, ContextCallback callback) Starting at this component in the View hierarchy, search for a component with aclientId
equal to the argumentclientId
and, if found, call theContextCallback.invokeContextCallback(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent)
method on the argumentcallback
, passing the currentFacesContext
and the found component as arguments.boolean
Returns whether row state is preserved as persetRowStatePreserved(boolean)
.void
Override the base class method to take special action if the method is being invoked whenStateManager.IS_BUILDING_INITIAL_STATE
is true and therowStatePreserved
property for this instance istrue
.void
process
(FacesContext faces, PhaseId phase) void
processDecodes
(FacesContext faces) 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
processUpdates
(FacesContext faces) 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
(FacesContext faces) 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
(FacesEvent event) Queue an event for broadcast at the end of the current request processing lifecycle phase.void
restoreState
(FacesContext faces, Object object) Perform any processing required to restore the state from the entries in the state Object.saveState
(FacesContext faces) Gets the state of the instance as aSerializable
Object.void
void
void
void
setRowStatePreserved
(boolean rowStatePreserved) Boolean flag directing how the per-row component state ofEditableValueHolder
children should be handled across requests on the same view.void
void
void
void
void
setVarStatus
(String varStatus) boolean
visitTree
(VisitContext context, VisitCallback callback) Perform a tree visit starting at this node in the tree.Methods inherited from class jakarta.faces.component.UINamingContainer
createUniqueId, getSeparatorChar
Methods inherited from class jakarta.faces.component.UIComponentBase
addClientBehavior, addFacesListener, clearInitialState, decode, encodeBegin, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, isRendered, isTransient, processRestoreState, processSaveState, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, subscribeToEvent, unsubscribeFromEvent
Methods inherited from class jakarta.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jakarta.faces.component.StateHolder
isTransient, setTransient
-
Field Details
-
COMPONENT_TYPE
- See Also:
-
COMPONENT_FAMILY
- See Also:
-
-
Constructor Details
-
UIRepeat
public UIRepeat()
-
-
Method Details
-
getFamily
Description copied from class:UIComponent
Return the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the
rendererType
property, may be used to select the appropriateRenderer
for this component instance. Note this method should NOT returnnull
- Overrides:
getFamily
in classUINamingContainer
- Returns:
- the component family (not null).
-
setEnd
-
getEnd
-
setSize
-
getSize
-
setOffset
-
getOffset
-
setBegin
-
getBegin
-
setStep
-
getStep
-
setRowStatePreserved
public void setRowStatePreserved(boolean rowStatePreserved) Boolean flag directing how the per-row component state of
EditableValueHolder
children should be handled across requests on the same view. If set totrue
, then state forEditableValueHolder
components in each row will not be discarded before a new row is rendered. If not specified, the default value isfalse
.This attribute should be set only when the current repeat component contains
UIForm
children which in turn containsEditableValueHolder
children. This will only work reliably when the data model of the current repeat component does not change across requests on the same view by e.g. sorting, adding or removing rows. The alternative is to usec:forEach
instead.- Parameters:
rowStatePreserved
- Whether to preserve row state while rendering- Since:
- 4.1
-
isRowStatePreserved
public boolean isRowStatePreserved()Returns whether row state is preserved as per
setRowStatePreserved(boolean)
.- Returns:
- Whether row state is preserved.
- Since:
- 4.1
-
getVar
-
setVar
-
getVarStatus
-
setVarStatus
-
getValue
-
setValue
-
getClientId
Description copied from class: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 aNamingContainer
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
. CallgetContainerClientId()
on it and save the result as theparentId
local variable. CallUIComponent.getId()
on this component and save the result as themyId
local variable. IfmyId
isnull
, callcontext.getViewRoot().createUniqueId()
and assign the result to myId. IfparentId
is non-null
, letmyId
equalparentId +
. CallUINamingContainer.getSeparatorChar(jakarta.faces.context.FacesContext)
+ myIdRenderer.convertClientId(jakarta.faces.context.FacesContext, java.lang.String)
, passingmyId
, and return the result.- Overrides:
getClientId
in classUIComponentBase
- Parameters:
faces
- TheFacesContext
for the current request- Returns:
- the client id.
-
process
-
invokeOnComponent
public boolean invokeOnComponent(FacesContext faces, String clientId, ContextCallback callback) throws FacesException Description copied from class:UIComponentBase
Starting at this component in the View hierarchy, search for a component with a
clientId
equal to the argumentclientId
and, if found, call theContextCallback.invokeContextCallback(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent)
method on the argumentcallback
, passing the currentFacesContext
and 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 theFacesContext
argument and passing this as the component argument. Then callUIComponent.popComponentFromEL(jakarta.faces.context.FacesContext)
. If anException
is thrown by the callback, wrap it in aFacesException
and 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 theIterator
and 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 asUIData
will need to set its row index to correctly reflect the argumentclientId
before finding the appropriate child component backed by the correct row. When the callback returns, either normally or by throwing anException
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()
returnedtrue
frominvokeOnComponent()
, 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:
invokeOnComponent
in classUIComponentBase
- Parameters:
faces
- theFacesContext
for the current requestclientId
- the client identifier of the component to be passed to the argument callback.callback
- an implementation of the Callback interface.- Returns:
true
if the a component with the givenclientId
is found, the callback method was successfully invoked passing that component as an argument, and no Exception was thrown. Returnsfalse
if no component with the givenclientId
is found.- Throws:
FacesException
- if the argument Callback throws an Exception, it is wrapped in aFacesException
and re-thrown.
-
visitTree
Description copied from class:UIComponent
Perform a tree visit starting at this node in the tree.
UIComponent.visitTree() implementations do not invoke the
VisitCallback
directly, but instead callVisitContext.invokeVisitCallback(jakarta.faces.component.UIComponent, jakarta.faces.component.visit.VisitCallback)
to invoke the callback. This allowsVisitContext
implementations to provide optimized tree traversals, for example by only calling theVisitCallback
for a subset of components.UIComponent.visitTree() implementations must call UIComponent.pushComponentToEL() before performing the visit and UIComponent.popComponentFromEL() after the visit.
- Overrides:
visitTree
in classUINamingContainer
- Parameters:
context
- theVisitContext
for this visitcallback
- theVisitCallback
instance whosevisit
method will be called for each node visited.- Returns:
true
if tree should be visited,false
otherwise.- See Also:
-
processDecodes
Description copied from class:UIComponent
Perform the component tree processing required by the Apply Request Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.
- If the
rendered
property of thisUIComponent
isfalse
, 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
RuntimeException
is thrown during decode processing, callFacesContext.renderResponse()
and re-throw the exception.
- Overrides:
processDecodes
in classUIComponentBase
- Parameters:
faces
-FacesContext
for the request we are processing
- If the
-
processUpdates
Description copied from class:UIComponent
Perform the component tree processing required by the Update Model Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.
- If the
rendered
property of thisUIComponent
isfalse
, 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)
- Overrides:
processUpdates
in classUIComponentBase
- Parameters:
faces
-FacesContext
for the request we are processing
- If the
-
processValidators
Description copied from class:UIComponent
Perform the component tree processing required by the Process Validations phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.
- If the
rendered
property of thisUIComponent
isfalse
, 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)
.
- Overrides:
processValidators
in classUIComponentBase
- Parameters:
faces
-FacesContext
for the request we are processing- See Also:
- If the
-
broadcast
Description copied from class: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 ofBehaviorEvent
and the currentcomponent
is the source of theevent
callBehaviorEvent.getBehavior()
to get theBehavior
for the event. CallBehavior.broadcast(jakarta.faces.event.BehaviorEvent)
on theBehavior
instance.- Overrides:
broadcast
in classUIComponentBase
- Parameters:
event
- TheFacesEvent
to be broadcast- Throws:
AbortProcessingException
- Signal the Jakarta Faces implementation that no further processing on the current event should be performed
-
queueEvent
Description copied from class: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 thequeueEvent()
method of the parentUIComponent
.- Overrides:
queueEvent
in classUIComponentBase
- Parameters:
event
-FacesEvent
to be queued
-
markInitialState
public void markInitialState()Override the base class method to take special action if the method is being invoked when
StateManager.IS_BUILDING_INITIAL_STATE
is true and therowStatePreserved
property for this instance istrue
.The additional action taken is to traverse the descendents and save their state without regard to any particular row value.
- Specified by:
markInitialState
in interfacePartialStateHolder
- Overrides:
markInitialState
in classUIComponentBase
- Since:
- 4.1
-
restoreState
Description copied from interface:StateHolder
Perform any processing required to restore the state from the entries in the state Object.
If the class that implements this interface has references to instances that also implement StateHolder (such as a
UIComponent
with event handlers, validators, etc.) this method must call theStateHolder.restoreState(jakarta.faces.context.FacesContext, java.lang.Object)
method on all those instances as well.If the
state
argument isnull
, take no action and return.- Specified by:
restoreState
in interfaceStateHolder
- Overrides:
restoreState
in classUIComponentBase
- Parameters:
faces
- the Faces context.object
- the state.
-
saveState
Description copied from interface:StateHolder
Gets the state of the instance as a
Serializable
Object.If the class that implements this interface has references to instances that implement StateHolder (such as a
UIComponent
with event handlers, validators, etc.) this method must call theStateHolder.saveState(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 theStateManager
This method must not alter the state of the implementing object. In other words, after executing this code:
Object state = component.saveState(facesContext);
component
should be the same as before executing it.The return from this method must be
Serializable
- Specified by:
saveState
in interfaceStateHolder
- Overrides:
saveState
in classUIComponentBase
- Parameters:
faces
- the Faces context.- Returns:
- the saved state.
-
encodeChildren
Description copied from class:UIComponent
If our
rendered
property istrue
, render the childUIComponent
s of thisUIComponent
. This method will only be called if therendersChildren
property istrue
.If a
Renderer
is associated with thisUIComponent
, the actual encoding will be delegated toRenderer.encodeChildren(FacesContext, UIComponent)
. If noRenderer
is associated with thisUIComponent
, iterate over each of the children of this component and callUIComponent.encodeAll(jakarta.faces.context.FacesContext)
.- Overrides:
encodeChildren
in classUIComponentBase
- Parameters:
faces
-FacesContext
for the response we are creating- Throws:
IOException
- if an input/output error occurs while rendering
-
getRendersChildren
public boolean getRendersChildren()Description copied from class: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 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 returntrue
from this method and rely onUIComponentBase.encodeChildren(jakarta.faces.context.FacesContext)
.- Overrides:
getRendersChildren
in classUIComponentBase
- Returns:
true
if the component renders its children,false
otherwise.
-