|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
UIComponent is the base interface for all user interface
components in JavaServer Faces. The set of UIComponent
instances associated with a particular request and response are
organized into a tree under a root UIComponent that represents
the entire content of the request or response.
For the convenience of component developers, UIComponentBase
provides the default behavior that is specified for a
UIComponent, and is the base class for all of the standard
UIComponent implementations. Component writers are encouraged
to subclass UIComponentBase, instead of directly implementing this
interface, to reduce the impact of any future changes to the method
signatures of this interface.
| Field Summary | |
static char |
SEPARATOR_CHAR
The separator character used in component identifiers to demarcate navigation to a child naming container. |
| Method Summary | |
void |
addChild(int index,
UIComponent component)
Insert the specified UIComponent at the specified
position in the child list for this component. |
void |
addChild(UIComponent component)
Append the specified UIComponent to the end of the
child list for this component. |
void |
addFacet(java.lang.String facetName,
UIComponent facet)
Add the specified UIComponent as a facet
associated with the name specified by the facetName
argument, replacing any previous facet with that name. |
void |
addValidator(Validator validator)
Add a Validator instance to the set associated with
this UIComponent. |
boolean |
broadcast(FacesEvent event,
PhaseId phaseId)
Broadcast the specified FacesEvent to all registered
event listeners who have expressed an interest in events of this
type, for the specified PhaseId (or for any phase, if the
listener returns PhaseId.ANY_PHASE from its
getPhaseId() method. |
void |
clearChildren()
Remove all child UIComponents from the child list. |
void |
clearFacets()
Remove all facet UIComponents from this component. |
void |
clearValidators()
Clear any Validators that have been registered for
processing by this component. |
boolean |
containsChild(UIComponent component)
Return true if the specified UIComponent
is a direct child of this UIComponent; otherwise,
return false. |
void |
decode(FacesContext context)
Decode the current state of this UIComponent from the
request contained in the specified FacesContext, and attempt
to convert this state information into an object of the required type
for this component (optionally using the registered
Converter for this component, if there
is one. |
void |
encodeBegin(FacesContext context)
Render the beginning of the current state of this UIComponent to the response contained in the specified
FacesContext. |
void |
encodeChildren(FacesContext context)
Render the child UIComponents of this UIComponent,
following the rules described for encodeBegin() to acquire
the appropriate value to be rendered. |
void |
encodeEnd(FacesContext context)
Render the ending of the current state of this UIComponent, following the rules described for
encodeBegin() to acquire the appropriate value
to be rendered. |
UIComponent |
findComponent(java.lang.String expr)
Find the UIComponent named by the specified expression,
if any is found. |
java.lang.Object |
getAttribute(java.lang.String name)
Return the value of the attribute with the specified name (if any); otherwise, return null. |
java.util.Iterator |
getAttributeNames()
Return an Iterator over the names of all
currently defined attributes of this UIComponent that
have a non-null value. |
UIComponent |
getChild(int index)
Return the UIComponent at the specified position
in the child list for this component. |
int |
getChildCount()
Return the number of UIComponents on the child list
for this component. |
java.util.Iterator |
getChildren()
Return an Iterator over the child
UIComponents of this UIComponent,
in the order of their position in the child list. |
java.lang.String |
getClientId(FacesContext context)
Return a client-side identifier for this component, generating one if necessary. |
java.lang.String |
getComponentId()
Return the identifier of this UIComponent. |
java.lang.String |
getConverter()
Return the converter id of the Converter
that is registered for this component. |
UIComponent |
getFacet(java.lang.String name)
Return the facet UIComponent associated with the
specified name, if any. |
java.util.Iterator |
getFacetNames()
Return an Iterator over the names of the facet
UIComponents of this UIComponent. |
java.util.Iterator |
getFacetsAndChildren()
Return an Iterator over the facet followed by child
UIComponents of this UIComponent. |
UIComponent |
getParent()
Return the parent UIComponent of this
UIComponent, if any. |
java.lang.String |
getRendererType()
Return the Renderer type for this UIComponent
(if any). |
boolean |
getRendersChildren()
Return a flag indicating whether this component is responsible for rendering its child components. |
boolean |
getRendersSelf()
Return a flag indicating whether this component has concrete implementations of the decode() and
encodeXxx() methods, and is therefore suitable for
use in the direct implementation programming model
for rendering. |
java.util.Iterator |
getValidators()
Return an Iterator over the Validators
associated with this UIComponent. |
boolean |
isRendered()
Return true if this component (and its children)
should be rendered during the Render Response phase
of the request processing lifecycle. |
boolean |
isValid()
Return the current validity state of this component. |
void |
processDecodes(FacesContext context)
Perform the component tree processing required by the Apply Request Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows. |
void |
processReconstitutes(FacesContext context)
Perform the component tree processing required by the Reconstitute Component Tree 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 context)
Perform the component tree processing required by the Update Model Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows. |
void |
processValidators(FacesContext context)
Perform the component tree processing required by the Process Validations phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows. |
void |
reconstitute(FacesContext context)
Perform any processing required to correct the state of this component as a result of the owning component tree having been reconstructed during Reconstitute Component Tree phase of the request processing lifecycle. |
void |
removeChild(int index)
Remove the child UIComponent at the specified position
in the child list for this component. |
void |
removeChild(UIComponent component)
Remove the child UIComponent from the child list
for this component. |
void |
removeFacet(java.lang.String name)
Remove the facet UIComponent associated with the
specified name, if there is one. |
void |
removeValidator(Validator validator)
Remove a Validator instance from the set associated with
this UIComponent, if it was previously associated. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Set the new value of the attribute with the specified name, replacing any existing value for that name. |
void |
setComponentId(java.lang.String componentId)
Set the identifier of this UIComponent. |
void |
setConverter(java.lang.String converter)
Set the converter id of the Converter
that is registered for this component, or null to indicate
that there is no registered Converter. |
void |
setParent(UIComponent parent)
Set the parent UIComponent of this
UIComponent. |
void |
setRendered(boolean rendered)
Set the rendered property of this
UIComponent. |
void |
setRendererType(java.lang.String rendererType)
Set the Renderer type for this UIComponent,
or null for components that render themselves. |
void |
setValid(boolean valid)
Set the current validity state of this component. |
void |
updateModel(FacesContext context)
Update the model data associated with this UIComponent,
if any. |
void |
validate(FacesContext context)
Perform any correctness checks that this component wishes to perform on itself. |
| Field Detail |
public static final char SEPARATOR_CHAR
The separator character used in component identifiers to demarcate navigation to a child naming container.
| Method Detail |
public java.lang.Object getAttribute(java.lang.String name)
Return the value of the attribute with the specified name
(if any); otherwise, return null.
name - Name of the requested attribute
java.lang.NullPointerException - if name is
nullpublic java.util.Iterator getAttributeNames()
Return an Iterator over the names of all
currently defined attributes of this UIComponent that
have a non-null value.
public void setAttribute(java.lang.String name,
java.lang.Object value)
Set the new value of the attribute with the specified name, replacing any existing value for that name.
name - Name of the requested attributevalue - New value (or null to remove
any attribute value for the specified name
java.lang.IllegalArgumentException - if name represents
a read-only property of this component
java.lang.NullPointerException - if name
is nullpublic java.lang.String getClientId(FacesContext context)
Return a client-side identifier for this component, generating
one if necessary. Generation will be delegated to the associated
Renderer (if there is one).
context - The FacesContext for the current request
java.lang.NullPointerException - if context
is nullpublic java.lang.String getComponentId()
Return the identifier of this UIComponent.
public void setComponentId(java.lang.String componentId)
Set the identifier of this UIComponent.
componentId - The new identifier
java.lang.IllegalArgumentException - if componentId
is zero length or contains invalid characters
java.lang.NullPointerException - if componentId
is null
java.lang.IllegalArgumentException - if this
UIComponent instance is already in the tree and and
is not unique within the namespace of the closest ancestor that
is a naming container.public java.lang.String getConverter()
Return the converter id of the Converter
that is registered for this component.
public void setConverter(java.lang.String converter)
Set the converter id of the Converter
that is registered for this component, or null to indicate
that there is no registered Converter.
converter - New converter identifier (or null)public UIComponent getParent()
Return the parent UIComponent of this
UIComponent, if any.
public void setParent(UIComponent parent)
Set the parent UIComponent of this
UIComponent.
parent - The new parent, or null for the root node
of a component treepublic boolean isRendered()
Return true if this component (and its children)
should be rendered during the Render Response phase
of the request processing lifecycle.
public void setRendered(boolean rendered)
Set the rendered property of this
UIComponent.
rendered - If true render this component;
otherwise, do not render this componentpublic java.lang.String getRendererType()
Return the Renderer type for this UIComponent
(if any).
public void setRendererType(java.lang.String rendererType)
Set the Renderer type for this UIComponent,
or null for components that render themselves.
rendererType - Logical identifier of the type of
Renderer to use, or null for components
that render themselvespublic boolean getRendersChildren()
Return a flag indicating whether this component is responsible for rendering its child components.
public boolean getRendersSelf()
Return a flag indicating whether this component has concrete
implementations of the decode() and
encodeXxx() methods, and is therefore suitable for
use in the direct implementation programming model
for rendering.
public boolean isValid()
Return the current validity state of this component. The validity state of a component is adjusted at the following points during the request processing lifecycle:
true or false by decode(),
based on the success or failure of decoding a new local value for
this component.false by processValidations() if any
call to a validate() method returned
false.false by updateModel() if any conversion
or update error occurred.
public void setValid(boolean valid)
Set the current validity state of this component.
valid - The new validity statepublic void addChild(UIComponent component)
Append the specified UIComponent to the end of the
child list for this component.
If the child to be added has a non-null and valid component identifier, the identifier is added to the namespace of the closest ancestor that is a naming container.
It is valid for a component to have a null component identifier or a component identifier that is the empty string.
component - UIComponent to be added
java.lang.IllegalStateException - if the component identifier
of the new component is non-null, and is not unique in the
namespace of the closest ancestor that is a naming container.
java.lang.IllegalArgumentException - if the component is null.
java.lang.NullPointerException - if component
is null
public void addChild(int index,
UIComponent component)
Insert the specified UIComponent at the specified
position in the child list for this component.
If the child to be added has a non-null and valid component identifier, the identifier is added to the namespace of the closest ancestor that is a naming container.
It is valid for a component to have a null component identifier or a component identifier that is the empty string.
index - Zero-relative index at which to add this
UIComponentcomponent - The UIComponent to be added
java.lang.IllegalStateException - if the component identifier
of the new component is non-null, and is not unique in the
namespace of the closest ancestor that is a naming container.
java.lang.IllegalArgumentException - if the component is null.
java.lang.IndexOutOfBoundsException - if the index is out of range
((index < 0) || (index > size()))
java.lang.NullPointerException - if component is nullpublic void clearChildren()
Remove all child UIComponents from the child list.
public boolean containsChild(UIComponent component)
Return true if the specified UIComponent
is a direct child of this UIComponent; otherwise,
return false.
component - UIComponent to be checked
java.lang.NullPointerException - if component
is nullpublic UIComponent findComponent(java.lang.String expr)
Find the UIComponent named by the specified expression,
if any is found. This is done by locating the closest parent
UIComponent that is a NamingContainer, and
calling its findComponentInNamespace() method.
The specified expr may contain either a
component identifier, or a set of component identifiers separated
by SEPARATOR_CHAR characters.
expr - Expression identifying the UIComponent
to be returned
UIComponent, or null
if the component was not found.
java.lang.NullPointerException - if expr
is nullpublic UIComponent getChild(int index)
Return the UIComponent at the specified position
in the child list for this component.
index - Position of the desired component
java.lang.IndexOutOfBoundsException - if index is out of range
((index < 0) || (index >= size()))public int getChildCount()
Return the number of UIComponents on the child list
for this component.
public java.util.Iterator getChildren()
Return an Iterator over the child
UIComponents of this UIComponent,
in the order of their position in the child list. If this
component has no children, an empty Iterator
is returned.
public void removeChild(int index)
Remove the child UIComponent at the specified position
in the child list for this component.
index - Position of the component to be removed
java.lang.IndexOutOfBoundsException - if the index is out of range
((index < 0) || (index >= size()))public void removeChild(UIComponent component)
Remove the child UIComponent from the child list
for this component.
component - Child component to be removed
java.lang.IllegalArgumentException - if component is
not a child of this component
java.lang.NullPointerException - if component is null
public void addFacet(java.lang.String facetName,
UIComponent facet)
Add the specified UIComponent as a facet
associated with the name specified by the facetName
argument, replacing any previous facet with that name. The
newly added facet will have its parent
property set to this component.
facetName - The name of this facetfacet - The new facet UIComponent
java.lang.NullPointerException - if the either of the
facetName or facet arguments are
null.public void clearFacets()
Remove all facet UIComponents from this component.
public UIComponent getFacet(java.lang.String name)
Return the facet UIComponent associated with the
specified name, if any. Otherwise, return null.
name - Name of the facet to be retrieved
java.lang.NullPointerException - if name
is nullpublic java.util.Iterator getFacetNames()
Return an Iterator over the names of the facet
UIComponents of this UIComponent. If
this component has no facets, an empty Iterator is
returned.
public void removeFacet(java.lang.String name)
Remove the facet UIComponent associated with the
specified name, if there is one. The removed facet
will have its parent property cleared.
name - Name of the facet to be removed
java.lang.NullPointerException - if name
is nullpublic java.util.Iterator getFacetsAndChildren()
Return an Iterator over the facet followed by child
UIComponents of this UIComponent.
Facets are returned in an undefined order, followed by
all the children in the order they are stored in the child list. If this
component has no facets or children, an empty Iterator
is returned.
public void addValidator(Validator validator)
Add a Validator instance to the set associated with
this UIComponent.
validator - The Validator to add
java.lang.NullPointerException - if validator
is nullpublic void clearValidators()
Clear any Validators that have been registered for
processing by this component.
public java.util.Iterator getValidators()
Return an Iterator over the Validators
associated with this UIComponent.
public void removeValidator(Validator validator)
Remove a Validator instance from the set associated with
this UIComponent, if it was previously associated.
Otherwise, do nothing.
validator - The Validator to remove
public boolean broadcast(FacesEvent event,
PhaseId phaseId)
throws AbortProcessingException
Broadcast the specified FacesEvent to all registered
event listeners who have expressed an interest in events of this
type, for the specified PhaseId (or for any phase, if the
listener returns PhaseId.ANY_PHASE from its
getPhaseId() method. The order in which
registered listeners are notified is implementation dependent.
After all interested listeners have been notified, return
false if this event does not have any listeners
interested in this event in future phases of the request processing
lifecycle. Otherwise, return true.
event - The FacesEvent to be broadcastphaseId - The PhaseId of the current phase of the
request processing lifecycle
AbortProcessingException - Signal the JavaServer Faces
implementation that no further processing on the current event
should be performed
java.lang.IllegalArgumentException - if the implementation class
of this FacesEvent is not supported by this component
java.lang.IllegalStateException - if PhaseId.ANY_PHASE is passed
for the phase identifier
java.lang.NullPointerException - if event or
phaseId is null
public void decode(FacesContext context)
throws java.io.IOException
Decode the current state of this UIComponent from the
request contained in the specified FacesContext, and attempt
to convert this state information into an object of the required type
for this component (optionally using the registered
Converter for this component, if there
is one.
If conversion is successful:
setValue() and passing the new value.valid property of this component
to true.If conversion is not successful:
context.addMessage().valid property of this comonent
to false.During decoding, events may be enqueued for later processing
(by event listeners who have registered an interest), by calling
addFacesEvent() on the associated FacesContext.
context - FacesContext for the request we are processing
java.io.IOException - if an input/output error occurs during decoding
java.lang.NullPointerException - if context
is null
public void encodeBegin(FacesContext context)
throws java.io.IOException
Render the beginning of the current state of this
UIComponent to the response contained in the specified
FacesContext. If the conversion attempted in a previous call
to decode() for this component failed, the state
information saved during execution of decode() should be
utilized to reproduce the incorrect input. If the conversion was
successful, or if there was no previous call to decode(),
the value to be displayed should be acquired by calling
currentValue(), and rendering the value as appropriate.
context - FacesContext for the response we are creating
java.io.IOException - if an input/output error occurs while rendering
java.lang.NullPointerException - if context
is null
public void encodeChildren(FacesContext context)
throws java.io.IOException
Render the child UIComponents of this UIComponent,
following the rules described for encodeBegin() to acquire
the appropriate value to be rendered. This method will only be called
if the rendersChildren property is true.
context - FacesContext for the response we are creating
java.io.IOException - if an input/output error occurs while rendering
java.lang.NullPointerException - if context
is null
public void encodeEnd(FacesContext context)
throws java.io.IOException
Render the ending of the current state of this
UIComponent, following the rules described for
encodeBegin() to acquire the appropriate value
to be rendered.
context - FacesContext for the response we are creating
java.io.IOException - if an input/output error occurs while rendering
java.lang.NullPointerException - if context
is null
public void reconstitute(FacesContext context)
throws java.io.IOException
Perform any processing required to correct the state of this component as a result of the owning component tree having been reconstructed during Reconstitute Component Tree phase of the request processing lifecycle. The default implementation of this method does nothing.
context - FacesContext for the request we are processing
java.io.IOException - if an input/output error occurs during processing
java.lang.NullPointerException - if context
is nullpublic void updateModel(FacesContext context)
Update the model data associated with this UIComponent,
if any. The default implementation in UIComponentBase does
no processing; concrete implementations of components that represent
controls that can be altered by users (such as UIInput must
provide an apppropriate implementation of this method.
context - FacesContext for the request we are processing
java.lang.NullPointerException - if context
is nullpublic void validate(FacesContext context)
Perform any correctness checks that this component wishes to perform
on itself. This method will be called during the
Process Validations phase of the request processing
lifecycle. If errors are encountered, appropriate Message
instances should be added to the FacesContext for the current
request, and the valid property of this UIComponent
should be set to false.
context - FacesContext for the request we are processing
java.lang.NullPointerException - if context
is null
public void processReconstitutes(FacesContext context)
throws java.io.IOException
Perform the component tree processing required by the Reconstitute Component Tree phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.
processReconstitutes() method of all facets
and children of this UIComponent in the order determined
by a call to getFacetsAndChildren().reconstitute() method of this component.
context - FacesContext for the request we are processing
java.io.IOException - if an input/output error occurs during processing
java.lang.NullPointerException - if context
is null
public void processDecodes(FacesContext context)
throws java.io.IOException
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.
processDecodes() method of all facets
and children of this UIComponent, in the order determined
by a call to getFacetsAndChildren().decode() method of this component.
context - FacesContext for the request we are processing
java.io.IOException - if an input/output error occurs during decoding
java.lang.NullPointerException - if context
is nullpublic void processValidators(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.
processValidators() method of all facets
and children of this UIComponent, in the order determined
by a call to getFacetsAndChildren().valid property of this component is
currently true:
validate() method of each
Validator registered for this UIComponent.validate() method of this component.valid property of this component
to the result returned from the validate()
method.valid property of this UIComponent
is now false, call
FacesContext.renderResponse()
to transfer control at the end of the current phase.
context - FacesContext for the request we are processing
java.lang.NullPointerException - if context
is nullpublic void processUpdates(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.
processUpdates() method of all facets
and children of this UIComponent, in the order determined
by a call to getFacetsAndChildren().updateModel() method of this component.valid property of this UIComponent
is now false, call
FacesContext.renderResponse()
to transfer control at the end of the current phase.
context - FacesContext for the request we are processing
java.lang.NullPointerException - if context
is null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||