DataModel is an abstraction around arbitrary data binding technologies that can be used to adapt a variety of data sources for use by JavaServer Faces components that support per-row processing for their child components (such as {@link UIData}.
The data collection underlying a {@link DataModel} instance ismodeled as a collection of row objects that can be accessed by a zero-relative cursor (row index). The APIs provide mechanisms to position to a specified zero-relative row index, and to retrieve an object that represents the data that corresponds to the current row index.
A concrete {@link DataModel} instance is attached to a particularcollection of underlying data by calling the setWrappedData()
method. It can be detached from that underlying data collection by passing a null
parameter to this method.
Concrete {@link DataModel} implementations must provide a publiczero-arguments constructor that calls setWrappedData(null)
. A convenience constructor that takes a wrapped object of the appropriate type (and passes it on via a call to setWrappedData()
, should also be provided.
Event listeners may be registered to receive notifications of when a new row index is selected.