Class Hierarchy All Classes All Fields and Methods

 

Class javax.faces.component.UIData

java.lang.Object
        javax.faces.component.UIComponent
                javax.faces.component.UIComponentBase
                        javax.faces.component.UIData

public class UIData
implements NamingContainer
extends UIComponentBase

UIData is a UIComponent that supports data binding to a collection of data objects represented by a DataModel instance, which is the current value of this component itself (typically established via a ValueBinding). During iterative processing over the rows of data in the data model, the object for the current row is exposed as a request attribute under the key specified by the var property.

Only children of type UIColumn should be processed by renderers associated with this component.

By default, the rendererType property is set to javax.faces.Table. This value can be changed by calling the setRendererType() method.

Field Index
Field Description
COMPONENT_FAMILY The standard component family for this component.
COMPONENT_TYPE The standard component type for this component.

Constructor Index
Constructor Description
UIData() Create a new UIData instance with default property values.

Method Index
Method Description
void broadcast(FacesEvent) Override the default broadcast processing to unwrap any wrapped FacesEvent and reset the current row index, before the event is actually broadcast.
void encodeBegin(FacesContext) In addition to the default behavior, ensure that any saved per-row state for our child input components is discarded unless it is needed to rerender the current page with errors.
String getClientId(FacesContext) Return a client identifier for this component that includes the current value of the rowIndex property, if it is not set to -1.
String getFamily()  
int getFirst() Return the zero-relative row number of the first row to be displayed.
UIComponent getFooter() Return the footer facet of this component (if any).
UIComponent getHeader() Return the header facet of this component (if any).
int getRowCount() Return the number of rows in the underlying data model.
Object getRowData() Return the data object representing the data for the currently selected row index, if any.
int getRowIndex() Return the zero-relative index of the currently selected row.
int getRows() Return the number of rows to be displayed, or zero for all remaining rows in the table.
Object getValue() Return the value of the UIData.
String getVar() Return the request-scope attribute under which the data object for the current row will be exposed when iterating.
boolean isRowAvailable() Return a flag indicating whether there is rowData available at the current rowIndex.
void processDecodes(FacesContext) Override the default processDecodes processing to perform the following steps.
void processUpdates(FacesContext) Override the default processUpdates processing to perform the following steps.
void processValidators(FacesContext) Override the default processValidators processing to perform the following steps.
void queueEvent(FacesEvent) Override the default queueEvent processing to wrap any queued events in a wrapper so that we can reset the current row index in broadcast().
void restoreState(FacesContext, Object)  
Object saveState(FacesContext)  
void setFirst(int) Set the zero-relative row number of the first row to be displayed.
void setFooter(UIComponent) Set the footer facet of this component.
void setHeader(UIComponent) Set the header facet of this component.
void setRowIndex(int) Set the zero relative index of the current row, or -1 to indicate that no row is currently selected, by implementing the following algorithm.
void setRows(int) Set the number of rows to be displayed, or zero for all remaining rows in the table.
void setValue(Object) Set the value of the UIData.
void setValueBinding(String, ValueBinding) Set the ValueBinding used to calculate the value for the specified attribute or property name, if any.
void setVar(String) Set the request-scope attribute under which the data object for the current row wil be exposed when iterating.

 

Fields

 

COMPONENT_FAMILY

public static final java.lang.String COMPONENT_FAMILY

The standard component family for this component.

 

COMPONENT_TYPE

public static final java.lang.String COMPONENT_TYPE

The standard component type for this component.

 

Constructors

 

UIData

public UIData() 

Create a new UIData instance with default property values.

 

Methods

 

broadcast

public void broadcast(FacesEvent event) throws AbortProcessingException

Override the default broadcast processing to unwrap any wrapped FacesEvent and reset the current row index, before the event is actually broadcast. For events that we did not wrap (in queueEvent()), default processing will occur.

 

encodeBegin

public void encodeBegin(FacesContext context) throws IOException

In addition to the default behavior, ensure that any saved per-row state for our child input components is discarded unless it is needed to rerender the current page with errors.

 

getClientId

public String getClientId(FacesContext context) 

Return a client identifier for this component that includes the current value of the rowIndex property, if it is not set to -1. This implies that multiple calls to getClientId() may return different results, but ensures that child components can themselves generate row-specific client identifiers (since UIData is a NamingContainer).

 

getFamily

public String getFamily() 

 

getFirst

public int getFirst() 

Return the zero-relative row number of the first row to be displayed.

 

getFooter

public UIComponent getFooter() 

Return the footer facet of this component (if any). A convenience method for getFacet("footer").

 

getHeader

public UIComponent getHeader() 

Return the header facet of this component (if any). A convenience method for getFacet("header").

 

getRowCount

public int getRowCount() 

Return the number of rows in the underlying data model. If the number of available rows is unknown, return -1.

 

getRowData

public Object getRowData() 

Return the data object representing the data for the currently selected row index, if any.

 

getRowIndex

public int getRowIndex() 

Return the zero-relative index of the currently selected row. If we are not currently positioned on a row, return -1. This property is not enabled for value binding expressions.

 

getRows

public int getRows() 

Return the number of rows to be displayed, or zero for all remaining rows in the table. The default value of this property is zero.

 

getValue

public Object getValue() 

Return the value of the UIData. This value must either be be of type DataModel, or a type that can be adapted into a DataModel. UIData will automatically adapt the following types:

All other types will be adapted using the ScalarDataModel class, which will treat the object as a single row of data.

 

getVar

public String getVar() 

Return the request-scope attribute under which the data object for the current row will be exposed when iterating. This property is not enabled for value binding expressions.

 

isRowAvailable

public boolean isRowAvailable() 

Return a flag indicating whether there is rowData available at the current rowIndex. If no wrappedData is available, return false.

 

processDecodes

public void processDecodes(FacesContext context) 

Override the default processDecodes processing to perform the following steps.

 

processUpdates

public void processUpdates(FacesContext context) 

Override the default processUpdates processing to perform the following steps.

 

processValidators

public void processValidators(FacesContext context) 

Override the default processValidators processing to perform the following steps.

 

queueEvent

public void queueEvent(FacesEvent event) 

Override the default queueEvent processing to wrap any queued events in a wrapper so that we can reset the current row index in broadcast().

 

restoreState

public void restoreState(FacesContext context,
                         Object state) 

 

saveState

public Object saveState(FacesContext context) 

 

setFirst

public void setFirst(int first) 

Set the zero-relative row number of the first row to be displayed.

 

setFooter

public void setFooter(UIComponent footer) 

Set the footer facet of this component. A convenience method for getFacets().put("footer", footer).

 

setHeader

public void setHeader(UIComponent header) 

Set the header facet of this component. A convenience method for getFacets().put("header", header).

 

setRowIndex

public void setRowIndex(int rowIndex) 

Set the zero relative index of the current row, or -1 to indicate that no row is currently selected, by implementing the following algorithm. It is possible to set the row index at a value for which the underlying data collection does not contain any row data. Therefore, callers may use the isRowAvailable() method to detect whether row data will be available for use by the getRowData() method.

To save current state information for all descendant components, UIData must maintain per-row information for each descendant as follows:

To restore current state information for all descendant components, UIData must reference its previously stored information for the current rowIndex and call setters for each descendant as follows:

 

setRows

public void setRows(int rows) 

Set the number of rows to be displayed, or zero for all remaining rows in the table.

 

setValue

public void setValue(Object value) 

Set the value of the UIData. This value must either be be of type DataModel, or a type that can be adapted into a DataModel.

 

setValueBinding

public void setValueBinding(String name,
                            ValueBinding binding) 

Set the ValueBinding used to calculate the value for the specified attribute or property name, if any. In addition, if a ValueBinding is set for the value property, remove any synthesized DataModel for the data previously bound to this component.

 

setVar

public void setVar(String var) 

Set the request-scope attribute under which the data object for the current row wil be exposed when iterating.

Class Hierarchy All Classes All Fields and Methods