org.omnifaces.model
Class IterableDataModel<E>

java.lang.Object
  extended by javax.faces.model.DataModel<E>
      extended by org.omnifaces.model.IterableDataModel<E>
All Implemented Interfaces:
java.lang.Iterable<E>

public class IterableDataModel<E>
extends javax.faces.model.DataModel<E>

IterableDataModel is an implementation of DataModel that wraps an Iterable.

This can be used to encapsulate nearly every collection type, including Collection derived types such as List and Set. As such this specific DataModel can be used instead of more specific DataModels like ListDataModel and JSF 2.2's CollectionDataModel.

Since:
1.5
Author:
Arjan.Tijms

Constructor Summary
IterableDataModel(java.lang.Iterable<E> iterable)
           
 
Method Summary
 int getRowCount()
           
 E getRowData()
           
 int getRowIndex()
           
 java.lang.Object getWrappedData()
           
 boolean isRowAvailable()
           
 void setRowIndex(int rowIndex)
           
 void setWrappedData(java.lang.Object data)
           
 
Methods inherited from class javax.faces.model.DataModel
addDataModelListener, getDataModelListeners, iterator, removeDataModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IterableDataModel

public IterableDataModel(java.lang.Iterable<E> iterable)
Method Detail

isRowAvailable

public boolean isRowAvailable()
Specified by:
isRowAvailable in class javax.faces.model.DataModel<E>

getRowCount

public int getRowCount()
Specified by:
getRowCount in class javax.faces.model.DataModel<E>

getRowData

public E getRowData()
Specified by:
getRowData in class javax.faces.model.DataModel<E>

getRowIndex

public int getRowIndex()
Specified by:
getRowIndex in class javax.faces.model.DataModel<E>

setRowIndex

public void setRowIndex(int rowIndex)
Specified by:
setRowIndex in class javax.faces.model.DataModel<E>

getWrappedData

public java.lang.Object getWrappedData()
Specified by:
getWrappedData in class javax.faces.model.DataModel<E>

setWrappedData

public void setWrappedData(java.lang.Object data)
Specified by:
setWrappedData in class javax.faces.model.DataModel<E>