public class CollectionDataModel<E>
extends javax.faces.model.DataModel<E>
CollectionDataModel is a convenience
implementation of DataModel
that wraps an Collection
of
Java objects.
Constructor and Description |
---|
CollectionDataModel()
Construct a new
CollectionDataModel with no specified
wrapped data. |
CollectionDataModel(Collection<E> collection)
Construct a new
CollectionDataModel wrapping the specified
list. |
Modifier and Type | Method and Description |
---|---|
int |
getRowCount()
If there is
wrappedData available, return the
length of the list. |
E |
getRowData()
If row data is available, return the array element at the index
specified by
rowIndex . |
int |
getRowIndex() |
Object |
getWrappedData() |
boolean |
isRowAvailable()
Return
true if there is wrappedData
available, and the current value of rowIndex is greater
than or equal to zero, and less than the size of the list. |
void |
setRowIndex(int rowIndex) |
void |
setWrappedData(Object data)
Set the wrapped data.
|
public CollectionDataModel()
Construct a new CollectionDataModel
with no specified
wrapped data.
public CollectionDataModel(Collection<E> collection)
Construct a new CollectionDataModel
wrapping the specified
list.
collection
- Collection to be wrapped.public boolean isRowAvailable()
Return true
if there is wrappedData
available, and the current value of rowIndex
is greater
than or equal to zero, and less than the size of the list. Otherwise,
return false
.
isRowAvailable
in class javax.faces.model.DataModel<E>
javax.faces.FacesException
- if an error occurs getting the row availabilitypublic int getRowCount()
If there is wrappedData
available, return the
length of the list. If no wrappedData
is available,
return -1.
getRowCount
in class javax.faces.model.DataModel<E>
javax.faces.FacesException
- if an error occurs getting the row countpublic E getRowData()
If row data is available, return the array element at the index
specified by rowIndex
. If no wrapped data is available,
return null
.
getRowData
in class javax.faces.model.DataModel<E>
javax.faces.FacesException
- if an error occurs getting the row dataIllegalArgumentException
- if now row data is available
at the currently specified row indexpublic int getRowIndex()
getRowIndex
in class javax.faces.model.DataModel<E>
javax.faces.FacesException
public void setRowIndex(int rowIndex)
setRowIndex
in class javax.faces.model.DataModel<E>
javax.faces.FacesException
IllegalArgumentException
public Object getWrappedData()
getWrappedData
in class javax.faces.model.DataModel<E>
public void setWrappedData(Object data)
setWrappedData
in class javax.faces.model.DataModel<E>
data
- the wrapped data.ClassCastException
- if data
is
non-null
and is not a Collection
Copyright © 2015 JBoss by Red Hat. All Rights Reserved.