Class UIRepeat
- java.lang.Object
-
- jakarta.faces.component.UIComponent
-
- jakarta.faces.component.UIComponentBase
-
- jakarta.faces.component.UINamingContainer
-
- com.sun.faces.facelets.component.UIRepeat
-
- All Implemented Interfaces:
NamingContainer,PartialStateHolder,StateHolder,TransientStateHolder,UniqueIdVendor,ComponentSystemEventListener,FacesListener,SystemEventListenerHolder,EventListener
public class UIRepeat extends UINamingContainer
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOMPONENT_FAMILYstatic StringCOMPONENT_TYPE-
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, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, FACETS_KEY, VIEW_LOCATION_KEY
-
Fields inherited from interface jakarta.faces.component.NamingContainer
SEPARATOR_CHAR
-
-
Constructor Summary
Constructors Constructor Description UIRepeat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbroadcast(FacesEvent event)Broadcast the specifiedFacesEventto all registered event listeners who have expressed an interest in events of this type.voidencodeChildren(FacesContext faces)IntegergetBegin()StringgetClientId(FacesContext faces)Return a client-side identifier for this component, generating one if necessary.IntegergetEnd()StringgetFamily()Return the identifier of the component family to which this component belongs.IntegergetOffset()booleangetRendersChildren()Return a flag indicating whether this component is responsible for rendering its child components.IntegergetSize()IntegergetStep()ObjectgetValue()StringgetVar()StringgetVarStatus()booleaninvokeOnComponent(FacesContext faces, 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.voidprocess(FacesContext faces, PhaseId phase)voidprocessDecodes(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.voidprocessUpdates(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.voidprocessValidators(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.voidqueueEvent(FacesEvent event)Queue an event for broadcast at the end of the current request processing lifecycle phase.voidrestoreState(FacesContext faces, Object object)Perform any processing required to restore the state from the entries in the state Object.ObjectsaveState(FacesContext faces)Gets the state of the instance as aSerializableObject.voidsetBegin(Integer begin)voidsetEnd(Integer end)voidsetOffset(Integer offset)voidsetSize(Integer size)voidsetStep(Integer step)voidsetValue(Object value)voidsetVar(String var)voidsetVarStatus(String varStatus)booleanvisitTree(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, markInitialState, 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 Detail
-
COMPONENT_TYPE
public static final String COMPONENT_TYPE
- See Also:
- Constant Field Values
-
COMPONENT_FAMILY
public static final String COMPONENT_FAMILY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getFamily
public String 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- Overrides:
getFamilyin classUINamingContainer- Returns:
- the component family (not null).
-
setEnd
public void setEnd(Integer end)
-
getEnd
public Integer getEnd()
-
setSize
public void setSize(Integer size)
-
getSize
public Integer getSize()
-
setOffset
public void setOffset(Integer offset)
-
getOffset
public Integer getOffset()
-
setBegin
public void setBegin(Integer begin)
-
getBegin
public Integer getBegin()
-
setStep
public void setStep(Integer step)
-
getStep
public Integer getStep()
-
getVar
public String getVar()
-
setVar
public void setVar(String var)
-
getVarStatus
public String getVarStatus()
-
setVarStatus
public void setVarStatus(String varStatus)
-
getValue
public Object getValue()
-
setValue
public void setValue(Object value)
-
getClientId
public String getClientId(FacesContext faces)
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.- Overrides:
getClientIdin classUIComponentBase- Parameters:
faces- TheFacesContextfor the current request- Returns:
- the client id.
-
process
public void process(FacesContext faces, PhaseId phase)
-
invokeOnComponent
public boolean invokeOnComponent(FacesContext faces, String clientId, ContextCallback callback) throws FacesException
Description copied from class:UIComponentBaseStarting 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 classUIComponentBase- Parameters:
faces- 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.
-
visitTree
public boolean visitTree(VisitContext context, VisitCallback callback)
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 classUINamingContainer- Parameters:
context- theVisitContextfor this visitcallback- theVisitCallbackinstance whosevisitmethod will be called for each node visited.- Returns:
trueif tree should be visited,falseotherwise.- See Also:
UIComponent.visitTree(jakarta.faces.component.visit.VisitContext, jakarta.faces.component.visit.VisitCallback)
-
processDecodes
public void processDecodes(FacesContext faces)
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.
- Overrides:
processDecodesin classUIComponentBase- Parameters:
faces-FacesContextfor the request we are processing
- If the
-
processUpdates
public void processUpdates(FacesContext faces)
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)
- Overrides:
processUpdatesin classUIComponentBase- Parameters:
faces-FacesContextfor the request we are processing
- If the
-
processValidators
public void processValidators(FacesContext faces)
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).
- Overrides:
processValidatorsin classUIComponentBase- Parameters:
faces-FacesContextfor the request we are processing- See Also:
PreValidateEvent,PostValidateEvent
- If the
-
broadcast
public void broadcast(FacesEvent event) throws AbortProcessingException
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.- Overrides:
broadcastin classUIComponentBase- Parameters:
event- TheFacesEventto be broadcast- Throws:
AbortProcessingException- Signal the Jakarta Faces implementation that no further processing on the current event should be performed
-
queueEvent
public void queueEvent(FacesEvent event)
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.- Overrides:
queueEventin classUIComponentBase- Parameters:
event-FacesEventto be queued
-
restoreState
public void restoreState(FacesContext faces, Object object)
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- Overrides:
restoreStatein classUIComponentBase- Parameters:
faces- the Faces context.object- the state.
-
saveState
public Object saveState(FacesContext faces)
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- Overrides:
saveStatein classUIComponentBase- Parameters:
faces- the Faces context.- Returns:
- the saved state.
-
encodeChildren
public void encodeChildren(FacesContext faces) throws IOException
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).- Overrides:
encodeChildrenin classUIComponentBase- Parameters:
faces-FacesContextfor the response we are creating- Throws:
IOException- if an input/output error occurs while rendering
-
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).- Overrides:
getRendersChildrenin classUIComponentBase- Returns:
trueif the component renders its children,falseotherwise.
-
-