public class UIRepeat extends UINamingContainer
Modifier and Type | Field and Description |
---|---|
static String |
COMPONENT_FAMILY |
static String |
COMPONENT_TYPE |
SEPARATOR_CHAR_PARAM_NAME
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
SEPARATOR_CHAR
Constructor and Description |
---|
UIRepeat() |
Modifier and Type | Method and Description |
---|---|
void |
broadcast(FacesEvent event)
Broadcast the specified
FacesEvent to all registered event listeners who
have expressed an interest in events of this type. |
void |
encodeChildren(FacesContext faces)
|
Integer |
getBegin() |
String |
getClientId(FacesContext faces)
Return a client-side identifier for this component, generating one if necessary.
|
Integer |
getEnd() |
String |
getFamily()
Return the identifier of the component family to which this component belongs. |
Integer |
getOffset() |
boolean |
getRendersChildren()
Return a flag indicating whether this component is responsible for rendering its
child components.
|
Integer |
getSize() |
Integer |
getStep() |
Object |
getValue() |
String |
getVar() |
String |
getVarStatus() |
boolean |
invokeOnComponent(FacesContext faces,
String clientId,
ContextCallback callback)
Starting at this component in the View
hierarchy, search for a component with a
clientId equal to the
argument clientId and, if found, call the
ContextCallback.invokeContextCallback(javax.faces.context.FacesContext, javax.faces.component.UIComponent) method on the argument
callback , passing the current FacesContext and the found
component as arguments. |
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.
|
Object |
saveState(FacesContext faces)
Gets the state of the instance as a
Serializable Object. |
void |
setBegin(Integer begin) |
void |
setEnd(Integer end) |
void |
setOffset(Integer offset) |
void |
setSize(Integer size) |
void |
setStep(Integer step) |
void |
setValue(Object value) |
void |
setVar(String var) |
void |
setVarStatus(String varStatus) |
boolean |
visitTree(VisitContext context,
VisitCallback callback)
Perform a tree visit starting at this node in the tree. |
createUniqueId, getSeparatorChar
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, getValueBinding, isRendered, isTransient, markInitialState, processRestoreState, processSaveState, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isTransient, setTransient
public static final String COMPONENT_TYPE
public static final String COMPONENT_FAMILY
public String getFamily()
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 UINamingContainer
public void setEnd(Integer end)
public Integer getEnd()
public void setSize(Integer size)
public Integer getSize()
public void setOffset(Integer offset)
public Integer getOffset()
public void setBegin(Integer begin)
public Integer getBegin()
public void setStep(Integer step)
public Integer getStep()
public String getVar()
public void setVar(String var)
public String getVarStatus()
public void setVarStatus(String varStatus)
public Object getValue()
public void setValue(Object value)
public String getClientId(FacesContext faces)
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(javax.faces.context.FacesContext)
+ myIdRenderer.convertClientId(javax.faces.context.FacesContext, java.lang.String)
, passing myId
, and return the result.
getClientId
in class UIComponentBase
faces
- The FacesContext
for the current requestpublic void process(FacesContext faces, PhaseId phase)
public boolean invokeOnComponent(FacesContext faces, String clientId, ContextCallback callback) throws FacesException
UIComponentBase
Starting at this component in the View
hierarchy, search for a component with a clientId
equal to the
argument clientId
and, if found, call the
ContextCallback.invokeContextCallback(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
method on the argument
callback
, passing the current FacesContext
and the found
component as arguments. This method is similar to UIComponent.findComponent(java.lang.String)
but it
does not support the leading UINamingContainer.getSeparatorChar(javax.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(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
, then
call the ContextCallback.invokeContextCallback(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
method on the argument
callback, passing through the FacesContext
argument and passing this
as the component argument. Then call
UIComponent.popComponentFromEL(javax.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(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
the implementation of
this method must guarantee that the state of the component passed to the callback
correctly reflects the component's position in the View hierarchy with respect to
any state found in the 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 UIComponentBase
faces
- 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.FacesException
- if the argument Callback throws an Exception, it is wrapped in a
FacesException
and re-thrown.public boolean visitTree(VisitContext context, VisitCallback callback)
UIComponent
Perform a tree visit starting at this node in the tree.
UIComponent.visitTree() implementations do not invoke the VisitCallback
directly, but instead call VisitContext.invokeVisitCallback(javax.faces.component.UIComponent, javax.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 UINamingContainer
context
- the VisitContext
for this visitcallback
- the VisitCallback
instance whose visit
method
will be called for each node visited.true
if tree should be visited, false
otherwise.UIComponent.visitTree(javax.faces.component.visit.VisitContext, javax.faces.component.visit.VisitCallback)
public void processDecodes(FacesContext faces)
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.
rendered
property of this UIComponent
is
false
, skip further processing.UIComponent.pushComponentToEL(javax.faces.context.FacesContext, javax.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(javax.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 UIComponentBase
faces
- FacesContext
for the request we are processingpublic void processUpdates(FacesContext faces)
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.
rendered
property of this UIComponent
is
false
, skip further processing.UIComponent.pushComponentToEL(javax.faces.context.FacesContext, javax.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(javax.faces.context.FacesContext)
processUpdates
in class UIComponentBase
faces
- FacesContext
for the request we are processingpublic void processValidators(FacesContext faces)
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.
rendered
property of this UIComponent
is
false
, skip further processing.UIComponent.pushComponentToEL(javax.faces.context.FacesContext, javax.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(javax.faces.context.FacesContext)
.processValidators
in class UIComponentBase
faces
- FacesContext
for the request we are processingPreValidateEvent
,
PostValidateEvent
public void broadcast(FacesEvent event) throws AbortProcessingException
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(javax.faces.event.BehaviorEvent)
on the Behavior
instance.
broadcast
in class UIComponentBase
event
- The FacesEvent
to be broadcastAbortProcessingException
- Signal the Jakarta Server Faces implementation that no further processing
on the current event should be performedpublic void queueEvent(FacesEvent event)
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 UIComponentBase
event
- FacesEvent
to be queuedpublic void restoreState(FacesContext faces, Object object)
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 the StateHolder.restoreState(javax.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 StateHolder
restoreState
in class UIComponentBase
faces
- the Faces context.object
- the state.public Object saveState(FacesContext faces)
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(javax.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 StateHolder
saveState
in class UIComponentBase
faces
- the Faces context.public void encodeChildren(FacesContext faces) throws IOException
UIComponent
If our rendered
property is true
, render the child
UIComponent
s 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(javax.faces.context.FacesContext)
.
encodeChildren
in class UIComponentBase
faces
- FacesContext
for the response we are creatingIOException
- if an input/output error occurs while renderingpublic boolean getRendersChildren()
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(javax.faces.context.FacesContext)
.
getRendersChildren
in class UIComponentBase
true
if the component renders its children, false
otherwise.Comments to: faces-dev@eclipse.org.
Copyright © 2019 Eclipse Foundation. All rights reserved.
Use is subject to license terms.