C.2 Render-Independent Components
JSF defines a number of interfaces for
behavior that can be applied to component classes independent of
their place in the class hierarchy and a class hierarchy containing
classes for the standard render-independent components. It also
defines a few model classes used as values for the standard component
classes.
This section described the interfaces first and then the classes.
Each interface or class section contains a brief description of the
type, a table with information about the fully qualified type name
and inheritance information, and a list of field, constructor, and
method descriptions.
C.2.1 Component Interfaces
This interface contains all methods
related to firing and handling a
javax.faces.event.ActionEvent. All component
classes that fire this event, such as command components, must
implement this interface.
Synopsis
Interface name:
|
javax.faces.component.ActionSource
|
Extends:
|
None
|
Implemented by:
|
javax.faces.component.UICommand
|
Methods
- public void addActionListener(javax.faces.event.ActionListener l)
-
Adds the ActionListener to the list of listeners
for the ActionEvent this component fires.
- public javax.faces.el.MethodBinding getAction()
-
Returns the MethodBinding for the action method
that should be invoked to handle the ActionEvent
this component fires or null if no method is
bound.
- public javax.faces.el.MethodBinding getActionListener()
-
Returns the MethodBinding for the action listener
method that should be invoked to handle the
ActionEvent this component fires or
null if no method is bound.
- public javax.faces.event.ActionListener[] getActionListeners()
-
Returns all ActionListener instances registered
with this component or an empty array if none is registered.
- public boolean isImmediate()
-
Returns true if the ActionEvent
should be processed in the Apply Request Values phase or
false if it should be processed in the Invoke
Application Phase.
- public void removeActionListener(javax.faces.event.ActionListener l)
-
Removes the ActionListener from the list of
listeners for the ActionEvent this component
fires.
- public void setAction(javax.faces.el.MethodBinding action)
-
Sets the MethodBinding for the action method that
should be invoked to handle the ActionEvent this
component fires.
- public void setActionListener(javax.faces.el.MethodBinding almb)
-
Sets the MethodBinding for the action listener
method that should be invoked to handle the
ActionEvent this component fires.
- public void setImmediate(boolean immediate)
-
Sets the phase where the ActionEvent should be
processed: true for the Apply Request Values phase
or false for the Invoke Application Phase.
This interface contains all
methods related to processing of a
component value that can be set by an application user, including
firing and handling a
javax.faces.event.ValueChangeEvent. All classes
that have an editable value and fire this event must implement this
interface.
Synopsis
Interface name:
|
javax.faces.component.EditableValueHolder
|
Extends:
|
javax.faces.component.ValueHolder
|
Implemented by:
|
javax.faces.component.UIInput
|
Methods
- public void addValidator(javax.faces.validator.Validator validator)
-
Adds the Validator to the list of validator for
this component's value.
- public void addValueChangeListener(javax.faces.event.ValueChangeListener l)
-
Adds the ValueChangeListener to the list of
listeners for the ValueChangeEvent this component
fires.
- public Object getSubmittedValue()
-
Returns the submitted value for this component, i.e., the unconverted
value extracted from the request data or a value in a format known
only to the component or its renderer.
- public javax.faces.el.MethodBinding getValidator()
-
Returns the MethodBinding for the validator method
that should be invoked to validate this component's
value or null if no method is bound.
- public javax.faces.validator.Validator[] getValidators()
-
Returns all Validator instances registered with
this component or an empty array if none is registered.
- public javax.faces.el.MethodBinding getValueChangeListener()
-
Returns the MethodBinding for the value change
method that should be invoked to handle the
ValueChangeEvent this component fires or
null if no method is bound.
- public javax.faces.event.ValueChangeListener[] getValueChangeListeners()
-
Returns all ValueChangeListener instances
registered with this component or an empty array if none is
registered.
- public boolean isImmediate()
-
Returns true if the
ValueChangeEvent should be processed in the Apply
Request Values phase or false if it should be
processed in the Process Validations phase.
- public boolean isLocalValueSet()
-
Returns true if the local value for this component
has been set, either explicitly by application code or implicitly
after successful validation of the submitted value.
- public boolean isRequired()
-
Returns true if a value must be submitted for this
component.
- public boolean isValid()
-
Returns true if the submitted value has been
successfully converted and validated.
- public void removeValidator(javax.faces.validator.Validator validator)
-
Removes the Validator from the list of validator
for this component's value.
- public void removeValueChangeListener(javax.faces.event.ValueChangeListener l)
-
Removes the ValueChangeListener from the list of
listeners for the ValueChangeEvent this component
fires.
- public void setImmediate(boolean immediate)
-
Sets the phase where the ValueChangeEvent should
be processed: true for the Apply Request Values
phase or false for the Process Validations phase.
- public void setLocalValueSet(boolean isLocalValueSet)
-
Sets the localValueSet property value.
- public void setRequired(boolean isRequired)
-
Sets the required property value.
- public void setSubmittedValue(Object submittedValue)
-
Sets the submitted value for this component, i.e., the unconverted
value extracted from the request data or a value in a format known
only to the component or its renderer.
- public void setValid(boolean isValid)
-
Sets the valid property value.
- public void setValidator(javax.faces.el.MethodBinding validator)
-
Sets the MethodBinding for the validator method
that should be invoked to validate this component's
value.
- public void setValueChangeListener(javax.faces.el.MethodBinding vclmb)
-
Sets the MethodBinding for the value change method
that should be invoked to handle the
ValueChangeEvent this component fires.
This is an empty interface that
marks a component class as a naming
container. The javax.faces.component.UIComponent
findComponent() and getClientId(
) methods use naming container parents in their processing.
See these methods for details.
Synopsis
Interface name:
|
javax.faces.component.NamingContainer
|
Extends:
|
None
|
Implemented by:
|
javax.faces.component.UIData,
javax.faces.component.UIForm,
javax.faces.component.UINamingContainer
|
Fields
- public static char SEPARATOR_CHAR
-
The component ID separator character; a colon.
This interface contains all
methods related to saving and
restoring view state for a component or an instance attached to a
component. All component classes must implement this interface.
Synopsis
Interface name:
|
javax.faces.component.StateHolder
|
Extends:
|
None
|
Implemented by:
|
javax.faces.component.UIComponent,
javax.faces.convert.DateTimeConverter,
javax.faces.convert.NumberConverter,
javax.faces.validator.DoubleRangeValidator,
javax.faces.validator.LengthValidator,
javax.faces.validator.LongRangeValidator
|
Methods
- public boolean isTransient()
-
Returns true if no state should be saved and
restored for this instance.
- public void restoreState(javax.faces.context.FacesContext context, Object state)
-
Restores the state for this instance from the provided value; an
Object previously returned by the
saveState() method.
- public Object saveState(javax.faces.context.FacesContext context)
-
Returns the state for this instance as an Object
to be passed to the restoreState() method when
the instance is restored for the next request.
- public void setTransient(boolean isTransient)
-
Sets the transient property value.
This interface contains all
methods related to processing of a
component value that cannot be set by an application user, only by an
application developer. All classes that have a value that can be
converted must implement this interface.
Synopsis
Interface name:
|
javax.faces.component.ValueHolder
|
Extends:
|
None
|
Implemented by:
|
javax.faces.component.UIInput,javax.faces.component.UIOutput
|
Methods
- public javax.faces.convert.Converter getConverter()
-
Returns the Converter used to convert this
component's value or null if none
is registered.
- public Object getLocalValue()
-
Returns the local value of this component, without evaluating the
value javax.faces.el.ValueBinding if set, or
null if the component doesn't
have a local value.
- public Object getValue()
-
Returns the value of this component, from the local value or by
evaluating the value javax.faces.el.ValueBinding
if it doesn't have a local value, or
null if the component doesn't
have a value at all.
- public void setConverter(javax.faces.convert.Converter converter)
-
Sets the Converter used to convert this
component's value.
- public void setValue(Object localValue)
-
Sets the local value of this component.
C.2.2 Component Classes
This class represents a column component that may be used as a child of a
javax.faces.component.UIData component or a custom
component. A column component acts as a container for other
components used to represent the column data. It can be equipped with
header and footer facets. A component of this type is rendered by its
parent.
Synopsis
Class name:
|
javax.faces.component.UIColumn
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.Column.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.Column.
Constructor
- public UIColumn()
-
Creates a new instance.
Methods
- public String getFamily()
-
Returns the component family ID.
- public javax.faces.component.UIComponent getFooter()
-
Returns the footer facet or null if none is set.
- public javax.faces.component.UIComponent getHeader()
-
Returns the header facet or null if none is set.
- public void setFooter(javax.faces.component.UIComponent footer)
-
Sets the footer facet.
- public void setHeader(javax.faces.component.UIComponent header)
-
Sets the header facet.
This class represents a command component. A command component
lets the user issue a command to the application, either to adjust
the view or initiate backend processing. It's often
rendered as button or a link, and it must be a child component of a
form component, directly or indirectly. The default
rendererType is
javax.faces.Button. When triggered by a user, the command component fires an
ActionEvent, which can be handled by the
application through an action method or one or more listeners, in the
order: javax.faces.event.ActionListener instances
(in the order they are registered), the action listener method, and
then the action method.
Synopsis
Class name:
|
javax.faces.component.UICommand
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.ActionSource,javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.Command.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.Command.
Constructor
- public UICommand()
-
Creates a new instance.
Methods
- public void addActionListener(javax.faces.event.ActionListener l)
-
Adds the ActionListener to the list of listeners
for the ActionEvent this component fires.
- public void broadcast(javax.faces.event.FacesEvent event) throws javax.faces.event.AbortProcessingException
-
Extends the inherited behavior by passing an
ActionEvent to the action listener method (if any)
and to the default ActionListener registered for
the application to invoke the action method (if any).
- public javax.faces.el.MethodBinding getAction()
-
Returns the MethodBinding for the action method
that should be invoked to handle the ActionEvent
this component fires or null if no method is
bound.
- public javax.faces.el.MethodBinding getActionListener()
-
Returns the MethodBinding for the action listener
method that should be invoked to handle the
ActionEvent this component fires or
null if no method is bound.
- public javax.faces.event.ActionListener[] getActionListeners()
-
Returns all ActionListener instances registered
with this component or an empty array if none is registered.
- public String getFamily()
-
Returns the component family ID.
- public Object getValue()
-
Returns the component value.
- public boolean isImmediate()
-
Returns true if the ActionEvent
should be processed in the Apply Request Values phase or
false if it should be processed in the Invoke
Application Phase.
- public void queueEvent(javax.faces.event.FacesEvent event)
-
Specializes the inherited behavior by setting the
PhaseId for an ActionEvent to
PhaseId.APPLY_REQUEST_VALUES if the
immediate property is set to
true and to
PhaseId.INVOKE_APPLICATION if
it's set to false before letting
the superclass handle the method call.
- public void removeActionListener(javax.faces.event.ActionListener l)
-
Removes the ActionListener from the list of
listeners for the ActionEvent this component
fires.
- public void restoreState(javax.faces.context.FacesContext context, Object state)
-
Restores the state for this instance from the provided value; an
Object previously returned by the
saveState() method.
- public Object saveState(javax.faces.context.FacesContext context)
-
Returns the state for this instance as an Object
to be passed to the restoreState() method when
the instance is restored for the next request.
- public void setAction(javax.faces.el.MethodBinding action)
-
Sets the MethodBinding for the action method that
should be invoked to handle the ActionEvent this
component fires.
- public void setActionListener(javax.faces.el.MethodBinding almb)
-
Sets the MethodBinding for the action listener
method that should be invoked to handle the
ActionEvent this component fires.
- public void setImmediate(boolean immediate)
-
Sets the phase where the ActionEvent should be
processed: true for the Apply Request Values phase
or false for the Invoke Application Phase.
- public void setValue(Object localValue)
-
Sets the local value of this component.
UIComponent and UIComponentBase | |
The UIComponent class is an abstract
class that defines all methods
shared by all JSF components. The UIComponentBase
class is a concrete subclass of UIComponent that
provides default implementations for all methods.
It's used as the base class for all other JSF
standard component classes and can also be used as the base class for
custom classes.
Synopsis
Class name:
|
javax.faces.component.UIComponent
|
Extends:
|
None
|
Implements:
|
javax.faces.component.StateHolder
|
Class name:
|
javax.faces.component.UIComponentBase
|
Extends:
|
javax.faces.component.UIComponent
|
Implements:
|
javax.faces.component.StateHolder
|
Constructor
- public UIComponentBase()
-
Creates a new UIComponentBase instance.
Methods
- protected void addFacesListener(javax.faces.event.FacesListener l)
-
Adds the FacesListener subclass to the list of
listeners for the FacesEvent subclasses this
component fires. This method is used by all subclasses to register
specific event listeners.
- public boolean broadcast(javax.faces.event.FacesEvent event) throws javax.faces.event.AbortProcessingException
-
Invokes all registered event listeners for the specific
FacesEvent subclass in the order they were
registered.
- public void decode(javax.faces.context.FacesContext context)
-
Reads the submitted value for the component from the request
information available through the FacesContext.
- public void encodeBegin(javax.faces.context.FacesContext context) throws java.io.IOException
-
If the rendered property is set to true, delegates
the call to the registered renderer if any.
- public void encodeChildren(javax.faces.context.FacesContext context) throws java.io.IOException
-
If the rendered property is set to true, delegates
the call to the registered renderer if any.
- public void encodeEnd(javax.faces.context.FacesContext context) throws java.io.IOException
-
If the rendered property is set to true, delegates
the call to the registered renderer if any.
- public javax.faces.component.UIComponent findComponent(String expr)
-
Returns the component with an ID matching the search expression, or
null if not found. The search expression is one
component ID or a colon-separated list of component IDs expressing a
naming container path, which may start with a colon representing the
component tree root. The component to use as the starting point for
the search is the root component if the expression starts with a
colon; otherwise it's the closest parent component
(or this component) that implements the
NamingContainer interface or the root if no such
component is found. The component is then located by calling
findComponent() on the starting point component
with the first part of the expression, and then recursively through
the component tree as long as findComponent()
returns a naming container, removing parts of the expression until
only a single expression part remains, which is the component ID for
the requested component.
- public java.util.Map getAttributes()
-
Returns a mutable Map representing all generic
attributes and all component properties. The Map
get() and put() methods uses
the property accessor methods for a key matching a property name, and
reads or writes the value the same way as a regular
Map for all other keys.
- public int getChildCount()
-
Returns the number of children without creating a
List for the children if it
doesn't exists already.
- public java.util.List getChildren()
-
Returns a mutable List for child references. Only
elements of type UIComponent can be added, and the
child's parent property is set or
reset when a child is added or removed.
- public String getClientId(javax.faces.context.FacesContext context)
-
Returns an ID value suitable for unique identification of the
component in the generated markup. The ID is composed by
concatenating the value returned from the closest parent that
implements the NamingContainer interface (if any)
with the value returned by the getId() method,
separated by a colon. If the component has a renderer, its
convertClientId() method is called to adjust the
ID value based on the markup to be rendered if needed.
- protected javax.faces.context.FacesContext getFacesContext()
-
Returns the FacesContext instance for the current
request.
- protected javax.faces.event.FacesListener[] getFacesListeners(Class c)
-
Returns all FacesListener subclass instances
registered for the FacesEvent subclasses this
component fires. This method is used by all subclasses to get its
specific event listeners.
- public javax.faces.component.UIComponent getFacet(String name)
-
Returns the named facet (or null if it
doesn't exist) without creating a
Map for the facets if it doesn't
exists already.
- public java.util.Map getFacets()
-
Returns a mutable Map for facet references, with
the facet names as keys and the components as values. Only elements
of type UIComponent can be added, and the
facet's parent property is set or
reset when a child is added or removed.
- public java.util.Iterator getFacetsAndChildren()
-
Returns an Iterator for all facets and child
components, with the facets in an undefined order followed by the
child components in the order they were added.
- abstract public String getFamily()
-
Returns the component family ID.
- public String getId()
-
Returns the component ID.
- public javax.faces.component.UIComponent getParent()
-
Returns the component's parent or
null if none.
- protected javax.faces.render.Renderer getRenderer(javax.faces.context.FacesContext context)
-
Returns the component's renderer or
null if none.
- public String getRendererType()
-
Returns the component's renderer type or
null if none.
- public boolean getRendersChildren()
-
If the component has a renderer, delegates the call to the renderer;
otherwise, returns false.
- public javax.faces.el.ValueBinding getValueBinding(String name)
-
Returns the ValueBinding for the named property or
null if none is registered.
- public boolean isRendered()
-
Returns true if the component (and its children)
should be rendered.
- public boolean isTransient()
-
Returns true if no state should be saved and
restored for this instance.
- public void processDecodes(javax.faces.context.FacesContext context)
-
If the rendered property is set to
true, calls getFacetsAndChildren(
) and then calls the processDecodes()
method on each returned facet and component, followed by a call to
the decode() method for this component. If any
exception is thrown by a facet or component, calls the
FacesContext renderResponse()
method to continue the request processing in the Render Response
phase and rethrows the exception.
- public void processRestoreState(javax.faces.context.FacesContext context, Object state)
-
If the application is configured to save state in the client, calls
getFacetsAndChildren() and then calls the
processRestoreState() method on each returned
facet and component, followed by a call to the restoreState(
) method for this component.
- public Object processSaveState(javax.faces.context.FacesContext context)
-
If the application is configured to save state in the client and the
transient property is set to
false, calls getFacetsAndChildren(
) and then calls the processSaveState()
method on each returned facet and component, followed by a call to
the saveState() method for this component.
Returns an Object representing the child state
combined with the component's own state.
- public void processUpdates(javax.faces.context.FacesContext context)
-
If the rendered property is set to
true, calls getFacetsAndChildren(
) and then calls the processUpdates()
method on each returned facet and component.
- public void processValidators(javax.faces.context.FacesContext context)
-
If the rendered property is set to
true, calls getFacetsAndChildren(
) and then calls the processValidators(
) method on each returned facet and component.
- pubic void queueEvent(javax.faces.event.FacesEvent event)
-
Delegates the call to the parent component, eventually reaching the
UIViewRoot component.
- protected void removeFacesListener(javax.faces.event.FacesListener l)
-
Removes the FacesListener subclass from the list
of listeners for the FacesEvent subclasses this
component fires. This method is used by all subclasses to deregister
specific event listeners.
- public static Object restoreAttachedState(javax.faces.context.FacesContext context, Object objectsState);
-
Returns an Object for which the state was
previously saved by saveAttachedState().
- public void restoreState(javax.faces.context.FacesContext context, Object state)
-
Restores the state for this instance from the provided value; an
Object previously returned by the
saveState() method.
- public static Object saveAttachedState(javax.faces.context.FacesContext context, Object object);
-
Returns an Object representing the state of the
provided Object. The state for the provided object
is retrieved by calling the saveState() method if
it implements the StateHolder interface or enough
information needed to restore the object later (e.g., the class name
or the serialized state). If the provided object is a
List, the state for all elements is saved.
- public Object saveState(javax.faces.context.FacesContext context)
-
Returns the state for this instance as an Object
to be passed to the restoreState() method when
the instance is restored for the next request.
- public void setId(String id)
-
Sets the id property value. The ID must start with
a letter other than underscore and may be followed by letters,
digits, underscores, and dashes. The ID must be unique among all
components within the view or among the children of the closest
parent that implements the NamingContainer
interface.
- public void setParent(javax.faces.component.UIComponent parent)
-
Sets the parent for this component.
- public void setRendered(boolean isRendered)
-
Sets the rendered property value.
- public void setRendererType(String rendererType)
-
Sets the renderer type for the component.
- public void setTransient(boolean isTransient)
-
Sets the transient property value.
- public void setValueBinding(String name, javax.faces.el.ValueBinding vb)
-
Sets the names property to a ValueBinding
instance, to be evaluated when the value is needed, or if
it's for the value property,
needs to be written during the Update Model phase. Unless otherwise
stated for a subclass, all component properties except
id and parent can be set to a
value binding instead of an explicit value.
This class represents a component that iterates through
tabular data, letting its
javax.faces.component.UIColumn component children
process the data for each row. It can be equipped with header and
footer facets. The default rendererType is
javax.faces.Table.
Class name:
|
javax.faces.component.UIData
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.NamingContainer,
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.Data.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.Data.
Constructor
- public UIData()
-
Creates a new instance.
Methods
- public boolean broadcast(javax.faces.event.FacesEvent event) throws javax.faces.event.AbortProcessingException
-
Unwraps the event, calls setRowIndex() with the
index embedded in the wrapped event, and delegates the unwrapped
event broadcasting to the real source component. See also
queueEvent().
- public void encodeBegin(javax.faces.context.FacesContext context) throws java.io.IOException
-
Before delegating to the superclass, resets the cached child
component per-row values unless an error message is queued for one of
them.
- public String getClientId(javax.faces.context.FacesContext context)
-
Returns a client ID that includes the current value of the
rowIndex property, unless it's
-1. This ensures that the child components get a unique client ID per
row.
- public String getFamily()
-
Returns the component family ID.
- public int getFirst()
-
Returns the zero-based index for the first row to process.
- public javax.faces.component.UIComponent getFooter()
-
Returns the footer facet or null if none is set.
- public javax.faces.component.UIComponent getHeader()
-
Returns the header facet or null if none is set.
- public int getRowCount()
-
Returns the number of rows in the component's data
model or -1 if the number of rows is unknown.
- public Object getRowData()
-
Returns the Object representing the row at the
current rowIndex or null if the
index is -1.
- public int getRowIndex()
-
Returns the zero-based index for the current row or -1 if no row is
currently processed.
- public Object getValue()
-
Returns the Object representing all rows.
- public String getVar()
-
Returns the name of the request scope variable holding the current
row object while the row is processed.
- public boolean isRowAvailable()
-
Returns true if the current
rowIndex value represents a row in the data model.
- public void processDecodes(javax.faces.context.FacesContext context)
-
If the rendered property is set to
true, calls setRowIndex() with
the value -1, calls the processDecodes() method
on all facets in the order they are returned by
getFacets( ).keySet( ).iterator(), and then the
processDecodes() method on all
UIColumn children's facets. For
the number of rows defined by the rows property,
starting with row defined by the first property,
calls setRowIndex() with the index for the row,
and if isRowAvailable() returns
true, calls getChildren() and
then the processDecodes() method on each returned
UIColumn component, followed by a call to the
decode() method for this component. Calls
setRowIndex() with the value -1. If any exception
is thrown by a facet or component, calls the
FacesContext renderResponse()
method to continue the request processing in the Render Response
phase and rethrows the exception.
- public void processUpdates(javax.faces.context.FacesContext context)
-
If the rendered property is set to
true, calls setRowIndex() with
the value -1, calls the processUpdates() method
on all facets in the order they are returned by
getFacets( ).keySet( ).iterator(), and then calls
the processUpdates() method on all
UIColumn children's facets. For
the number of rows defined by the rows property,
starting with row defined by the first property,
calls setRowIndex() with the index for the row,
and if isRowAvailable() returns
true, calls getChildren() and
then the processUpdates() method on each returned
UIColumn component. Calls setRowIndex(
) with the value -1.
- public void processValidators(javax.faces.context.FacesContext context)
-
If the rendered property is set to
true, calls setRowIndex() with
the value -1, calls the processValidator() method
on all facets in the order they are returned by
getFacets( ).keySet( ).iterator(), and then calls
the processValidators() method on all
UIColumn children's facets. For
the number of rows defined by the rows property,
starting with row defined by the first property,
calls setRowIndex() with the index for the row,
and if isRowAvailable() returns
true, calls getChildren() and
then the processValidators() method on each
returned UIColumn component. Calls
setRowIndex() with the value -1.
- pubic void queueEvent(javax.faces.event.FacesEvent event)
-
Before delegating the call to the parent component, wraps the event
along with the current rowIndex value and itself
as the event source in an instance of an inner class that extends
FacesEvent.
- public void restoreState(javax.faces.context.FacesContext context, Object state)
-
Restores the state for this instance from the provided value; an
Object previously returned by the
saveState() method.
- public Object saveState(javax.faces.context.FacesContext context)
-
Returns the state for this instance as an Object
to be passed to the restoreState() method when
the instance is restored for the next request.
- public void setFirst(int first)
-
Sets the zero-based index of the first row to process.
- public void setFooter(javax.faces.component.UIComponent footer)
-
Sets the footer facet.
- public void setHeader(javax.faces.component.UIComponent header)
-
Sets the header facet.
- public void setRowIndex(int rowIndex)
-
Sets the zero-based index of the currently processed row or -1 if no
row is processed.
- public void setRows(int rows)
-
Sets the number of rows to process or 0 if all rows should be
processed.
- public void setValue(Object value)
-
Sets the data model representing the tabular data. If the object
isn't of type DataModel, creates
a wrapper of an appropriate type around it, one of
ArrayDataModel, ListDataModel,
ResultDataModel,
ResultSetDataModel, or
ScalarDataModel.
- public void setValueBinding(String name, javax.faces.el.ValueBinding vb)
-
Throws an IllegalArgumentException if the name is
var or rowIndex before
delegating the processing to the superclass.
- public void setVar(String var)
-
Sets the name of the request scope variable holding the current row
object while the row is processed.
This class represents a form component. A
form component acts as a
container for other components, typically input components, and
ensures that input component children process input only when the
form they belong to is the submitted form. The default
rendererType is
javax.faces.Form.
Class name:
|
javax.faces.component.UIForm
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.NamingContainer,
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.Form.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.Form.
Constructor
- public UIForm()
-
Creates a new instance.
Methods
- public String getFamily()
-
Returns the component family ID.
- public boolean isSubmitted()
-
Returns true if submitting this form triggered the
current request.
- public void processDecodes(javax.faces.context.FacesContext context)
-
Call to the decode() method for this component to
ensure that the submitted property is set before
decoding the children. If the submitted property
is set to true, calls
getFacetsAndChildren() and then calls the
processDecodes() method on each returned facet
and component.
- public void processUpdates(javax.faces.context.FacesContext context)
-
If the submitted property is set to
true, calls getFacetsAndChildren(
) and then calls the processUpdates()
method on each returned facet and component.
- public void processValidators(javax.faces.context.FacesContext context)
-
If the submitted property is set to
true, calls getFacetsAndChildren(
) and then calls the processValidators(
) method on each returned facet and component.
- public void setSubmitted(boolean submitted)
-
Sets the submitted property value. This method must be called by the
component's renderer during the Apply Request Values
phase.
This class represents a graphic image component. A graphic image
component can be used standalone or as a child of a component with a
link renderer, to render a clickable link image. The default
rendererType is
javax.faces.Image.
Class name:
|
javax.faces.component.UIGraphic
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.Graphic.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.Graphic.
Constructor
- public UIGraphic()
-
Creates a new instance.
Methods
- public String getFamily()
-
Returns the component family ID.
- public String getUrl()
-
Returns the image URL.
- public Object getValue()
-
Returns the component's value (the image URL).
- public javax.faces.el.ValueBinding getValueBinding(String name)
-
If the name is url, calls the superclass with the
name value instead. Delegates request for all
other properties to the superclass directly.
- public void restoreState(javax.faces.context.FacesContext context, Object state)
-
Restores the state for this instance from the provided value; an
Object previously returned by the
saveState() method.
- public Object saveState(javax.faces.context.FacesContext context)
-
Returns the state for this instance as an Object
to be passed to the restoreState() method when
the instance is restored for the next request.
- public void setUrl(String url)
-
Sets the image URL.
- public void setValue(Object value)
-
Sets the component's value (the image URL).
- public void setValueBinding(String name, javax.faces.el.ValueBinding vb)
-
If the name is url, calls the superclass with the
name value instead. Delegates request for all
other properties to the superclass directly.
This class represents an input component. The user can enter a
value for an input component, which is then saved as a property of an
application class after conversion and validation. The default
rendererType is
javax.faces.Text. When the value entered by a user is different than the previous
value, the input component fires a
ValueChangeEvent, which can be handled by the
application through a value changed event method or one or more
listeners, in the order:
javax.faces.event.ValueChangeListener instances
(in the order they are registered), and then the value change
listener method.
Class name:
|
javax.faces.component.UIInput
|
Extends:
|
javax.faces.component.UIOutput
|
Implements:
|
javax.faces.component.EditableValueHolder,
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.Input.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.Input.
- public static String CONVERSION_MESSAGE_ID
-
The ID for the conversion error message:
javax.faces.component.UIInput.CONVERSION.
- public static String REQUIRED_MESSAGE_ID
-
The ID for the required value error message:
javax.faces.component.UIInput.REQUIRED.
Constructor
- public UIInput()
-
Creates a new instance.
Methods
- public void addValidator(javax.faces.validator.Validator validator)
-
Adds the Validator to the list of validator for
this component's value.
- public void addValueChangeListener(javax.faces.event.ValueChangeListener l)
-
Adds the ValueChangeListener to the list of
listeners for the ValueChangeEvent this component
fires.
- public void broadcast(javax.faces.event.FacesEvent event) throws javax.faces.event.AbortProcessingException
-
Extends the inherited behavior by passing a
ValueChangeEvent to the value change listener
method (if any).
- protected boolean compareValues(Object previous, Object value)
-
Returns true if the new value differs from the
previous value, taking null values into
consideration; returns false if both values are
null and true if only one of
them is null.
- public void decode()
-
Sets the valid property to true
before delegating the call to the superclass.
- public String getFamily()
-
Returns the component family ID.
- public Object getSubmittedValue()
-
Returns the submitted value for this component, i.e., the unconverted
value extracted from the request data or a value in a format known
only to the component or its renderer.
- public javax.faces.el.MethodBinding getValidator()
-
Returns the MethodBinding for the validator method
that should be invoked to validate this component's
value, or null if no method is bound.
- public javax.faces.validator.Validator[] getValidators()
-
Returns all Validator instances registered with
this component or an empty array if none is registered.
- public javax.faces.el.MethodBinding getValueChangeListener()
-
Returns the MethodBinding for the value change
method that should be invoked to handle the
ValueChangeEvent this component fires or
null if no method is bound.
- public javax.faces.event.ValueChangeListener[] getValueChangeListeners()
-
Returns all ValueChangeListener instances
registered with this component or an empty array if none is
registered.
- public boolean isImmediate()
-
Returns true if the
ValueChangeEvent should be processed in the Apply
Request Values phase, or false if it should be
processed in the Process Validations phase.
- public boolean isLocalValueSet()
-
Returns true if the local value for this component
has been set, either explicitly by application code or implicitly
after successful validation of the submitted value.
- public boolean isRequired()
-
Returns true if a value must be submitted for this
component.
- public boolean isValid()
-
Returns true if the submitted value has been
successfully converted and validated.
- public void processDecodes(javax.faces.context.FacesContext context)
-
Extends the inherited behavior by calling validate(
) if the immediate property is set to
true. If the validation fails, calls the
FacesContext renserResponse()
method.
- public void processUpdates(javax.faces.context.FacesContext context)
-
Extends the inherited behavior by calling updateModel(
). If updating the model fails, calls the
FacesContext renserResponse()
method.
- public void processValidators(javax.faces.context.FacesContext context)
-
Extends the inherited behavior by calling validate(
) if the immediate property is set to
false. If the validation fails, calls the
FacesContext renderResponse()
method.
- public void removeValidator(javax.faces.validator.Validator validator)
-
Removes the Validator from the list of validator
for this component's value.
- public void removeValueChangeListener(javax.faces.event.ValueChangeListener l)
-
Removes the ValueChangeListener from the list of
listeners for the ValueChangeEvent this component
fires.
- public void restoreState(javax.faces.context.FacesContext context, Object state)
-
Restores the state for this instance from the provided value; an
Object previously returned by the
saveState() method.
- public Object saveState(javax.faces.context.FacesContext context)
-
Returns the state for this instance as an Object
to be passed to the restoreState() method when
the instance is restored for the next request.
- public void setImmediate(boolean immediate)
-
Sets the phase where the ValueChangeEvent should
be processed: true for the Apply Request Values
phase or false for the Process Validations phase.
- public void setLocalValueSet(boolean isLocalValueSet)
-
Sets the localValueSet property value.
- public void setRequired(boolean isRequired)
-
Sets the required property value.
- public void setSubmittedValue(Object submittedValue)
-
Sets the submitted value for this component, i.e., the unconverted
value extracted from the request data or a value in a format known
only to the component or its renderer.
- public void setValid(boolean isValid)
-
Sets the valid property value.
- public void setValidator(javax.faces.el.MethodBinding validator)
-
Sets the MethodBinding for the validator method
that should be invoked to validate this component's
value.
- public void setValue(Object value)
-
Extends the inherited behavior by calling setLocalValueSet(
) with the value true.
- public void setValueChangeListener(javax.faces.el.MethodBinding vclmb)
-
Sets the MethodBinding for the value change method
that should be invoked to handle the
ValueChangeEvent this component fires.
- public void updateModel(javax.faces.context.FacesContext context)
-
If the valid and the
localValueSet properties are set to
true and there's a
ValueBinding set for the value
property, calls the setValue() method on the
ValueBinding. If the setValue(
) call is successful, clears the local value and calls
setLocalValueSet() with the value
false. If the setValue() call
fails, calls the addMessage() method on the
current FacesContext with a
CONVERSION_MESSAGE_ID message, and calls
setValid() with the value
false.
- public void validate(javax.faces.context.FacesContext context)
-
If getSubmittedValue() returns a
non-null value, convert the value to the data type
for the local value by calling getConvertedValue(
) on the renderer (if any) or getAsObject(
) on the Converter returned by
getConverter() (if any), or the
Converter returned by the
Application createConverter()
method for data type of the ValueBinding (if any).
If the conversion fails, calls the addMessage()
method on the current FacesContext with a
CONVERSION_MESSAGE_ID message, and calls
setValid() with the value
false. If the conversion is successful or no
Converter was found, verifies that the local value
isn't null or an empty
String if the required property
is set to true, and calls addMessage(
) with a REQUIRED_MESSAGE_ID message if
it is. Otherwise, calls the validate() method on
each registered Validator, followed by a call to
the validator method binding (if any), catching any
ValidatorException and calling
addMessage() with the message from the exception
and setValid() with the value
false if one is thrown. If the validation is
successful, stores the new value, and sets the submitted value to
null, and if compareValues()
returns true, queues a
ValueChangeEvent.
This class represents a message component. A message component
renders the first message queued for a specific component, if any.
The default rendererType is
javax.faces.Message.
Class name:
|
javax.faces.component.UIMessage
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.Message.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.Message.
Constructor
- public UIMessage()
-
Creates a new instance.
Methods
- public String getFamily()
-
Returns the component family ID.
- public String getFor()
-
Returns the client ID of the component to render a message for.
- public boolean isShowDetail()
-
Returns true if the message details are rendered.
- public boolean isShowSummary()
-
Returns true if the message summary are rendered.
- public void restoreState(javax.faces.context.FacesContext context, Object state)
-
Restores the state for this instance from the provided value; an
Object previously returned by the
saveState() method.
- public Object saveState(javax.faces.context.FacesContext context)
-
Returns the state for this instance as an Object
to be passed to the restoreState() method when
the instance is restored for the next request.
- public void setFor(String clientID)
-
Sets the client ID of the component to render a message for.
- public void setShowDetail(boolean showDetail)
-
Sets the showDetail property. The default is
true.
- public void setShowSummary(boolean showSummary)
-
Sets the showSummary property. The default is
false.
This class represents a messages component. A messages component
renders message queued for a specific component as well as
"global messages" (messages queued
without a component ID). The default rendererType
is javax.faces.Messages.
Class name:
|
javax.faces.component.UIMessages
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.Messages.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.Messages.
Constructor
- public UIMessages( );
-
Creates a new instance.
Methods
- public String getFamily()
-
Returns the component family ID.
- public boolean isGlobalOnly()
-
Returns true if only global messages are rendered.
- public boolean isShowDetail()
-
Returns true if the message details are rendered.
- public boolean isShowSummary()
-
Returns true if the message summary are rendered.
- public void restoreState(javax.faces.context.FacesContext context, Object state)
-
Restores the state for this instance from the provided value; an
Object previously returned by the
saveState() method.
- public Object saveState(javax.faces.context.FacesContext context)
-
Returns the state for this instance as an Object
to be passed to the restoreState() method when
the instance is restored for the next request.
- public void setGlobalOnly(boolean globalOnly)
-
Sets the globalOnly property. The default is
false.
- public void setShowDetail(boolean showDetail)
-
Sets the showDetail property. The default is
false.
- public void setShowSummary(boolean showSummary)
-
Sets the showSummary property. The default is
true.
This class represents a naming container component. A naming
container component is used as a container for child components to
ensure that their client IDs are unique in a view by combining the
naming container's component ID with the child
components' IDs. An instance of this class
represents a JSF subview and it can also be used as a base class for
other components that need to be naming containers. It
doesn't have a default
rendererType.
Class name:
|
javax.faces.component.UINamingContainer
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.NamingContainer,
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.NamingContainer.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.NamingContainer.
Constructor
- public UINamingContainer()
-
Creates a new instance.
Methods
- public String getFamily()
-
Returns the component family ID.
This class represents an output component. An output component
renderers its value, which may be bound to a property of an
application class, possibly converted to a different data type. The
default rendererType is
javax.faces.Text.
Class name:
|
javax.faces.component.UIOutput
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.StateHolder,
javax.faces.component.ValueHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.Output.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.Output.
Constructor
- public UIOutput()
-
Creates a new instance.
Methods
- public javax.faces.convert.Converter getConverter()
-
Returns the Converter used to convert this
component's value or null if none
is registered.
- public String getFamily()
-
Returns the component family ID.
- public Object getLocalValue()
-
Returns the local value of this component, without evaluating the
value javax.faces.el.ValueBinding if set, or
null if the component doesn't
have a local value.
- public Object getValue()
-
Returns the value of this component, from the local value or by
evaluating the value javax.faces.el.ValueBinding
if it doesn't have a local value, or
null if the component doesn't
have a value at all.
- public void restoreState(javax.faces.context.FacesContext context, Object state)
-
Restores the state for this instance from the provided value; an
Object previously returned by the
saveState() method.
- public Object saveState(javax.faces.context.FacesContext context)
-
Returns the state for this instance as an Object
to be passed to the restoreState() method when
the instance is restored for the next request.
- public void setConverter(javax.faces.convert.Converter converter)
-
Sets the Converter used to convert this
component's value.
- public void setValue(Object localValue)
-
Sets the local value of this component.
This class represents a panel component. A panel component is
a container for other components. It doesn't have a
default rendererType.
Class name:
|
javax.faces.component.UIPanel
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.Panel.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.Panel.
Constructor
- public UIPanel()
-
Creates a new instance.
Methods
- public String getFamily()
-
Returns the component family ID.
This class represents a parameter component. A parameter component
provides a, possibly named, parameter value to its parent, such as a
link component. The parameter component's value is
rendered by its parent.
Class name:
|
javax.faces.component.UIParameter
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.Parameter.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.Parameter.
Constructor
- public UIParameter()
-
Creates a new instance.
Methods
- public String getFamily()
-
Returns the component family ID.
- public String getName()
-
Returns the parameter name or null if it
doesn't have a name.
- public Object getValue()
-
Returns the parameter value.
- public void restoreState(javax.faces.context.FacesContext context, Object state)
-
Restores the state for this instance from the provided value; an
Object previously returned by the
saveState() method.
- public Object saveState(javax.faces.context.FacesContext context)
-
Returns the state for this instance as an Object
to be passed to the restoreState() method when
the instance is restored for the next request.
- public void setName(String name)
-
Sets the parameter name.
- public void setValue(Object value)
-
Sets the parameter value.
This class represents a select boolean component. A select Boolean
component lets the user set its value to true or
false, which is then saved as a property of an
application class after conversion and validation. The default
rendererType is
javax.faces.Checkbox. When the value entered by a user is different than the previous
value, the input component fires a
ValueChangeEvent, which can be handled by the
application through a value changed event method or one or more
listeners, in the order:
javax.faces.event.ValueChangeListener instances
(in the order they are registered), and then the value change
listener method.
Class name:
|
javax.faces.component.UISelectBoolean
|
Extends:
|
javax.faces.component.UIInput
|
Implements:
|
javax.faces.component.EditableValueHolder,
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.SelectBoolean.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.SelectBoolean.
Constructor
- public UISelectBoolean()
-
Creates a new instance.
Methods
- public String getFamily()
-
Returns the component family ID.
- public javax.faces.el.ValueBinding getValueBinding(String name)
-
If the name is selected, calls the superclass with
the name value instead. Delegates request for all
other properties to the superclass directly.
- public boolean isSelected()
-
Returns the component's value converted to a
boolean.
- public void setSelected(boolean selected)
-
Sets the component's value.
- public void setValueBinding(String name, javax.faces.el.ValueBinding vb)
-
If the name is selected, calls the superclass with
the name value instead. Delegates request for all
other properties to the superclass directly.
This class represents a select items component. A select item
component represents a choice for its parent (which must be a
component that lets the user select among a number of choices),
either as a SelectItem instance or through the
itemDescription, itemDisabled,
itemLabel, and itemValue
properties. The select item component's value is
rendered by its parent.
Class name:
|
javax.faces.component.UISelectItem
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.SelectItem.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.SelectItem.
Constructor
- public UISelectItem()
-
Creates a new instance.
Methods
- public String getFamily()
-
Returns the component family ID.
- public String getItemDescription()
-
Returns the item description.
- public String getItemLabel()
-
Returns the item label.
- public Object getItemValue()
-
Returns the item value.
- public Object getValue()
-
Returns the component value, an explicitly set
SelectItem instance.
- public boolean isItemDisabled()
-
Returns true if the item is disabled.
- public void restoreState(javax.faces.context.FacesContext context, Object state)
-
Restores the state for this instance from the provided value; an
Object previously returned by the
saveState() method.
- public Object saveState(javax.faces.context.FacesContext context)
-
Returns the state for this instance as an Object
to be passed to the restoreState() method when
the instance is restored for the next request.
- public void setItemDescription(String itemDescription)
-
Sets the item description.
- public void setItemDisabled(boolean itemDisabled)
-
Sets the itemDisabled property value.
- public void setItemLabel(String itemLabel)
-
Sets the item label.
- public void setItemValue(Object value)
-
Returns the item value.
- public void setValue(Object value)
-
Sets the component value, a SelectItem instance.
This class represents a select items component. A select item
component represents one or more choices for its parent (which must
be a component that lets the user select among a number of choices),
either as a SelectItem instance, a
SelectItem[], a
java.util.Collection with
SelectItem instances, or a
java.util.Map with keys to use as item labels and
values to use as item values. The select items
component's value is rendered by its parent.
Class name:
|
javax.faces.component.UISelectItems
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.UISelectItems.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.UISelectItems.
Constructor
- public UISelectItems()
-
Creates a new instance.
Methods
- public String getFamily()
-
Returns the component family ID.
- public Object getValue()
-
Returns the component value.
- public void restoreState(javax.faces.context.FacesContext context, Object state)
-
Restores the state for this instance from the provided value; an
Object previously returned by the
saveState() method.
- public Object saveState(javax.faces.context.FacesContext context)
-
Returns the state for this instance as an Object
to be passed to the restoreState() method when
the instance is restored for the next request.
- public void setValue(Object value)
-
Sets the component value, a SelectItem instance, a
SelectItem[], a
java.util.Collection with
SelectItem instances, or a
java.util.Map with keys to use as item labels and
values to use as item values.
This class represents a select-many component. A select-many
component lets the user select one or more items among a set of items
represented by UISelectItem and
UISelectItems components, which is then saved as a
property of an application class after conversion and validation. If
the component is bound to a property, the data type for the select
items must be the same basic type (either a primitive type or the
corresponding boxed type) as the property data type. The default
rendererType is
javax.faces.Listbox. When the selections made by a user is different than the previous
selection, the component fires a ValueChangeEvent,
which can be handled by the application through a value changed event
method or one or more listeners, in the order:
javax.faces.event.ValueChangeListener instances
(in the order they are registered), and then the value change
listener method.
Class name:
|
javax.faces.component.UISelectMany
|
Extends:
|
javax.faces.component.UIInput
|
Implements:
|
javax.faces.component.EditableValueHolder,
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.SelectMany.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.SelectMany.
- public static String INVALID_MESSAGE_ID
-
The ID for the invalid value error message:
javax.faces.component.UISelectMany.INVALID.
Constructor
- public UISelectMany()
-
Creates a new instance.
Methods
- protected boolean compareValues(Object previous, Object value)
-
Returns true if the new selection differs from the
previous selection, regardless of the elements order.
- public String getFamily()
-
Returns the component family ID.
- public Object[] getSelectedValues()
-
Returns the selected values.
- public javax.faces.el.ValueBinding getValueBinding(String name)
-
If the name is selectedValues, calls the
superclass with the name value instead. Delegates
request for all other properties to the superclass directly.
- public void setSelectedValues(Object[] selectedValues)
-
Sets the selected values.
- public void setValueBinding(String name, javax.faces.el.ValueBinding vb)
-
If the name is selectedValues, calls the
superclass with the name value instead. Delegates
request for all other properties to the superclass directly.
- public void validate(javax.faces.context.FacesContext context)
-
Extends the inherited behavior by verifying that all selected values
match the available choices. If not, calls the addMessage(
) method on the current FacesContext
with a INVALID_MESSAGE_ID message and calls
setValid() with the value
false.
This class represents a select-one component. A select-one
component lets the user select one item among a set of items
represented by UISelectItem and
UISelectItems components, which is then saved as a
property of an application class after conversion and validation. If
the component is bound to a property, the data type for the select
items must be the same basic type (either a primitive type or the
corresponding boxed type) as the property data type. The default
rendererType is
javax.faces.Menu. When the selections made by a user is different than the previous
selection, the component fires a ValueChangeEvent,
which can be handled by the application through a value changed event
method or one or more listeners, in the order:
javax.faces.event.ValueChangeListener instances
(in the order they are registered), and then the value change
listener method.
Class name:
|
javax.faces.component.UISelectOne
|
Extends:
|
javax.faces.component.UIInput
|
Implements:
|
javax.faces.component.EditableValueHolder,
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.SelectOne.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.SelectOne.
- public static String INVALID_MESSAGE_ID
-
The ID for the invalid value error message:
javax.faces.component.UISelectOne.INVALID.
Constructor
- public UISelectOne()
-
Creates a new instance.
Methods
- public String getFamily()
-
Returns the component family ID.
- public void validate(javax.faces.context.FacesContext context)
-
Extends the inherited behavior by verifying that the selected value
matches one of the available choices. If not, calls the
addMessage() method on the current
FacesContext with a
INVALID_MESSAGE_ID message and calls
setValid() with the value
false.
This class represents a view root component. A view root component
sits at the top of the component tree and acts as the container for
all the other components in the view. It's not
rendered.
Class name:
|
javax.faces.component.UIViewRoot
|
Extends:
|
javax.faces.component.UIComponentBase
|
Implements:
|
javax.faces.component.StateHolder
|
Fields
- public static String COMPONENT_FAMILY
-
The component family: javax.faces.ViewRoot.
- public static String COMPONENT_TYPE
-
The component family: javax.faces.View.
- public static String UNIQUE_ID_PREFIX
-
The prefix used for automatically created component IDs:
_id.
Constructor
- public UIViewRoot()
-
Creates a new instance.
Methods
- public String createUniqueId()
-
Returns an automatically generated component ID that is unique within
the view, prefixed with UNIQUE_ID_PREFIX.
- public void encodeBegin()
-
Resets the state used by createUniqueId().
- public String getFamily()
-
Returns the component family ID.
- public java.util.Locale getLocale()
-
Returns the view's Locale,
calculated by ViewHandler
calculateLocale() if not set.
- public String getRenderKitId()
-
Returns the view's render kit ID or
RenderKitFactory.HTML_BASIC_RENDER_KIT if not set.
- public String getViewId()
-
Returns the view ID.
- public void processApplication(javax.faces.context.FacesContext context)
-
Iterates over all events queued for any phase and call the
broadcast() method on the source component for
each, and then does the same for all events queued for the Invoke
Application phase. Returns when there are no more events for these
phases.
- public void processDecodes(javax.faces.context.FacesContext context)
-
Extends the inherited behavior by iterating over all events queued
for any phase and calling the broadcast() method
on the source component for each, and then does the same for all
events queued for the Apply Request Values phase. Clears the event
queue if broadcasting the events caused the
FacesContext renderResponse()
method to be called. Returns when there are no more events for these
phases.
- public void processUpdates(javax.faces.context.FacesContext context)
-
Extends the inherited behavior by iterating over all events queued
for any phase and calling the broadcast() method
on the source component for each, and then does the same for all
events queued for the Update Model Values phase. Returns when there
are no more events for these phases.
- public void processValidators(javax.faces.context.FacesContext context)
-
Extends the inherited behavior by iterating over all events queued
for any phase and calling the broadcast() method
on the source component for each, and then does the same for all
events queued for the Process Validations phase. Clears the event
queue if broadcasting the events caused the
FacesContext renderResponse()
method to be called. Returns when there are no more events for these
phases.
- public void queueEvent(javax.faces.event.FacesEvent event)
-
Adds the event to the event queue.
- public void restoreState(javax.faces.context.FacesContext context, Object state)
-
Restores the state for this instance from the provided value; an
Object previously returned by the
saveState() method.
- public Object saveState(javax.faces.context.FacesContext context)
-
Returns the state for this instance as an Object
to be passed to the restoreState() method when
the instance is restored for the next request.
- public void setLocale(java.util.Locale locale)
-
Sets the view's Locale.
- public void setRenderKitId(String renderKitId)
-
Sets the view's render kit ID.
- public void setViewId(String viewId)
-
Sets the view ID.
C.2.3 Model Classes and Interfaces
This class wraps an array to expose it as a
DataModel for a UIData
component.
Class name:
|
javax.faces.model.ArrayDataModel
|
Extends:
|
javax.faces.model.DataModel
|
Implements:
|
None
|
Constructors
- public ArrayDataModel()
-
Creates a new, empty instance.
- public ArrayDataModel(Object[] array)
-
Creates a new instance wrapping an array.
Methods
- public int getRowCount()
-
Returns the number of elements in the array or -1 if the array
isn't set.
- public Object getRowData()
-
Returns the array element for the current row index or
null if the array isn't set or
there's no such element.
- public int getRowIndex()
-
Returns the zero-based index for the current row or -1 if no row is
selected.
- public Object getWrappedData()
-
Returns the array, or null if the array
isn't set.
- public boolean isRowAvailable()
-
Returns true if the array is set and the current
row index is between 0 and the last index of the array.
- public void setRowIndex(int index)
-
Sets the zero-based index for the current row or to -1 if no row is
selected.
- public void setWrappedData(Object data)
-
Sets the array.
This abstract class represents the model for a
UIData component.
Class name:
|
javax.faces.model.DataModel
|
Extends:
|
None
|
Implements:
|
None
|
Constructor
- public DataModel()
-
Creates a new, empty instance.
Methods
- public void addDataModelListener(javax.faces.model.DataModelListener l)
-
Adds the DataModelListener to the list of
listeners for the DataModelEvent this model fires.
- public javax.faces.model.DataModelListener[] getDataModelListeners()
-
Returns all DataModelListener instances registered
for the model.
- public abstract int getRowCount()
-
Returns the number of rows represented by the model or -1 if unknown.
- public abstract Object getRowData()
-
Returns an object representing the current row index or
null if there is no row data for the row index.
- public abstract int getRowIndex()
-
Returns the zero-based index for the current row or -1 if no row is
selected.
- public abstract Object getWrappedData()
-
Returns the raw data wrapped by this model or null
if the data isn't set.
- public abstract boolean isRowAvailable()
-
Returns true if the current row index matches an
existing row.
- public void removeDataModelListener(javax.faces.model.DataModelListener l)
-
Removes the DataModelListener from the list of
listeners for the DataModelEvent this model fires.
- public abstract void setRowIndex(int index)
-
Sets the zero-based index for the current row or to -1 if no row is
selected.
- public abstract void setWrappedData(Object data)
-
Sets the data containing rows.
This class represents an event fired by the DataModel
class.
Class name:
|
javax.faces.model.DataModelEvent
|
Extends:
|
java.util.EventObject
|
Implements:
|
java.io.Serializable
|
Constructor
- public DataModelEvent(javax.faces.model.DataModel, int index, Object data)
-
Creates a new instance for the specified model, row index, and row
data.
Methods
- public javax.faces.model.DataModel getDataModel()
-
Returns the DataModel that fired the event.
- public Object getRowData()
-
Returns the Object holding the data for the row
the event refers to or null if it
doesn't refer to a row.
- public int getRowIndex()
-
Returns the index for the row the event refers to or -1 if it
doesn't refer to a row.
This interface is implemented by listeners
interested in the
DataModelEvent fired by instances of the
DataModel class.
Synopsis
Interface name:
|
javax.faces.model.DataModelListener
|
Extends:
|
None
|
Implemented by:
|
Application classes
|
Methods
- public void rowSelected(javax.faces.model.DataModelEvent event)
-
Handles the event signaling that a row in the model has been selected.
This class wraps a java.util.List to
expose it as a
DataModel for a UIData
component.
Class name:
|
javax.faces.model.ListDataModel
|
Extends:
|
javax.faces.model.DataModel
|
Implements:
|
None
|
Constructors
- public ListDataModel()
-
Creates a new, empty instance.
- public ListDataModel(java.util.List list)
-
Creates a new instance wrapping a List instance.
Methods
- public int getRowCount()
-
Returns the size of the list, or -1 if the list
isn't set.
- public Object getRowData()
-
Returns the list element for the current row index or
null if the list isn't set or
there's no such element.
- public int getRowIndex()
-
Returns the zero-based index for the current row or -1 if no row is
selected.
- public Object getWrappedData()
-
Returns the List object or null
if the list isn't set.
- public boolean isRowAvailable()
-
Returns true if the list is set and the current
row index is between 0 and the last index of the list.
- public void setRowIndex(int index)
-
Sets the zero-based index for the current row or to -1 if no row is
selected.
- public void setWrappedData(Object data)
-
Sets the List instance.
This class wraps a
javax.servlet.jsp.jstl.sql.Result to expose it as
a DataModel for a UIData
component.
Class name:
|
javax.faces.model.ResultDataModel
|
Extends:
|
javax.faces.model.DataModel
|
Implements:
|
None
|
Constructors
- public ResultDataModel()
-
Creates a new, empty instance.
- public ResultDataModel(javax.servlet.jsp.jstl.sql.Result result)
-
Creates a new instance wrapping a Result instance.
Methods
- public int getRowCount()
-
Returns the size of the array returned by the
Result getRows() method or -1
if the result isn't set.
- public Object getRowData()
-
Returns the element for the current row index in the array returned
by the Result getRows()
method, or null if the result
isn't set or there's no such
element.
- public int getRowIndex()
-
Returns the zero-based index for the current row or -1 if no row is
selected.
- public Object getWrappedData()
-
Returns the Result instance or
null if the result isn't set.
- public boolean isRowAvailable()
-
Returns true if the list is set and the current
row index is between 0 and the last index of the array returned by
the Result getRows() method.
- public void setRowIndex(int index)
-
Sets the zero-based index for the current row or to -1 if no row is
selected.
- public void setWrappedData(Object data)
-
Sets the Result instance.
This class wraps a
java.sql.ResultSet to expose it as a
DataModel for a UIData
component. The ResultSet must be scrollable, and
if the UIData component has input components bound
to columns in this model, it must be updatable.
Class name:
|
javax.faces.model.ResultSetDataModel
|
Extends:
|
javax.faces.model.DataModel
|
Implements:
|
None
|
Constructors
- public ResultSetDataModel()
-
Creates a new, empty instance.
- public ResultSetDataModel(java.sql.ResultSet resultSet)
-
Creates a new instance wrapping a ResultSet
instance.
Methods
- public int getRowCount()
-
Returns -1 because the number of rows is unknown until all rows have
been retrieved.
- public Object getRowData()
-
Returns a java.util.Map with the column values for
the columns in the current row, with the column names as
case-insensitive keys, or null if the result set
isn't set or there's no such row.
- public int getRowIndex()
-
Returns the zero-based index for the current row or -1 if no row is
selected.
- public Object getWrappedData()
-
Returns the ResultSet instance or
null if the result set isn't set.
- public boolean isRowAvailable()
-
Returns true if the result set is set and if
calling the ResultSet absolute(
) method with current row index plus one returns
true.
- public void setRowIndex(int index)
-
Sets the zero-based index for the current row or to -1 if no row is
selected.
- public void setWrappedData(Object data)
-
Sets the ResultSet instance.
This class wraps any Object to expose
it
as a DataModel with one row for a
UIData component.
Class name:
|
javax.faces.model.ScalarDataModel
|
Extends:
|
javax.faces.model.DataModel
|
Implements:
|
None
|
Constructors
- public ScalarDataModel()
-
Creates a new, empty instance.
- public ScalarDataModel(Object object)
-
Creates a new instance wrapping as Object instance.
Methods
- public int getRowCount()
-
Returns 1, or -1 if the object isn't set.
- public Object getRowData()
-
Returns the object or null if the object
isn't set.
- public int getRowIndex()
-
Returns the zero-based index for the current row or -1 if no row is
selected.
- public Object getWrappedData()
-
Returns the object or null if the object
isn't set.
- public boolean isRowAvailable()
-
Returns true if the object is set and the current
row index is 0.
- public void setRowIndex(int index)
-
Sets the zero-based index for the current row or to -1 if no row is
selected.
- public void setWrappedData(Object data)
-
Sets the Object instance.
This class represents a selectable item
for UISelectOne and
UISelectMany components.
Class name:
|
javax.faces.model.SelectItem
|
Extends:
|
None
|
Implements:
|
java.io.Serializable
|
Constructors
- public SelectItem()
-
Creates a new, empty instance.
- public SelectItem(Object value)
-
Creates a new instance with the specified item value.
- public SelectItem(Object value, String label)
-
Creates a new instance with the specified item value and label.
- public SelectItem(Object value, String label, String description)
-
Creates a new instance with the specified item value, label, and
description.
- public SelectItem(Object value, String label, String description,boolean disabled)
-
Creates a new instance with the specified item value, label,
description, and disabled flag.
Methods
- public String getDescription()
-
Returns the description or null if not set.
- public String getLabel()
-
Returns the label or null if not set.
- public Object getValue()
-
Returns the value or null if not set.
- public boolean isDisabled()
-
Returns the disabled flag.
- public void setDescription(String description)
-
Sets the description.
- public void setDisabled(boolean isDisabled)
-
Sets the disabled flag.
- public void setLabel(String label)
-
Sets the label.
- public void setValue(Object value)
-
Sets the value.
This class represents a grouping
of
selectable items for UISelectOne and
UISelectMany components, typically rendered as a
submenu. The standard renderers use the label
property value as the submenu label and ignore the value. While
instances of this class can be included in the
selectItems property value, forming nested groups,
the standard renderers support only one-level grouping.
Class name:
|
javax.faces.model.SelectItemGroup
|
Extends:
|
javax.faces.model.SelectItem
|
Implements:
|
java.io.Serializable
|
Constructors
- public SelectItemGroup()
-
Creates a new, empty instance.
- public SelectItem(String label)
-
Creates a new instance with the specified label.
- public SelectItem(String label, String description, boolean disabled javax.faces.model.SelectItem[] selectItems)
-
Creates a new instance with the specified label, description,
disabled flag, and SelectItem instances.
Methods
- public javax.faces.model.SelectItem[] getSelectItems()
-
Returns the SelectItem instances in the group or
null if not set.
- public setSelectItems(javax.faces.model.SelectItem[] selectItems)
-
Sets the SelectItem instances in the group.
|