com.liferay.faces.util.model
Class OnDemandDataModel<E>

java.lang.Object
  extended by javax.faces.model.DataModel<E>
      extended by com.liferay.faces.util.model.OnDemandDataModel<E>
All Implemented Interfaces:
Paginated, Sortable, Iterable<E>

public abstract class OnDemandDataModel<E>
extends javax.faces.model.DataModel<E>
implements Paginated, Sortable

Author:
Neil Griffin

Constructor Summary
OnDemandDataModel()
           
 
Method Summary
abstract  int countRows()
          Returns the total number of rows.
abstract  Collection<E> findRows(int startRow, int finishRow, List<SortCriterion> sortCritieria)
          Returns a list of rows that is a subset of the entire list of rows.
 int getFinishRowIndex()
          Returns the index of the finishing row associated with the underlying wrapped data.
 int getRowCount()
           
 E getRowData()
           
 int getRowIndex()
           
 int getRowsPerPage()
          Returns the number of rows-per-page associated with the pagination.
 List<SortCriterion> getSortCriteria()
           
 int getStartRowIndex()
          Returns the index of the starting row associated with the underlying wrapped data.
 List<E> getWrappedData()
           
 boolean isRowAvailable()
           
 void reset()
          Resets (clears) the underlying wrapped data.
 void setFinishRowIndex(int finishRowIndex)
          Sets the finishing row associated with the underlying wrapped data.
 void setRowCount(int rowCount)
          Sets the rowCount to the specified value.
 void setRowIndex(int rowIndex)
           
 void setRowsPerPage(int rowsPerPage)
          Sets the number of rows-per-page associated with the pagination.
 void setSortCriteria(List<SortCriterion> sortCriteria)
           
 void setStartRowIndex(int startRowIndex)
          Sets the starting row associated with the underlying wrapped data.
 void setWrappedData(Object wrappedData)
           
 
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

OnDemandDataModel

public OnDemandDataModel()
Method Detail

countRows

public abstract int countRows()
Returns the total number of rows. Note that this method is called only when necessary, and so the return value should not be cached in anyway.


findRows

public abstract Collection<E> findRows(int startRow,
                                       int finishRow,
                                       List<SortCriterion> sortCritieria)
Returns a list of rows that is a subset of the entire list of rows.

Parameters:
startRow - The starting row index.
finishRow - The finishing row index.
sortCritieria - The sort criteria that is to be applied to the order of the results.

reset

public void reset()
Resets (clears) the underlying wrapped data.


isRowAvailable

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

getFinishRowIndex

public int getFinishRowIndex()
Returns the index of the finishing row associated with the underlying wrapped data.


setFinishRowIndex

public void setFinishRowIndex(int finishRowIndex)
Sets the finishing row associated with the underlying wrapped data.


getRowCount

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

setRowCount

public void setRowCount(int rowCount)
Sets the rowCount to the specified value.


getRowData

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

getRowIndex

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

setRowIndex

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

getRowsPerPage

public int getRowsPerPage()
Description copied from interface: Paginated
Returns the number of rows-per-page associated with the pagination.

Specified by:
getRowsPerPage in interface Paginated
See Also:
Paginated#getRowsPerPage()}

setRowsPerPage

public void setRowsPerPage(int rowsPerPage)
Description copied from interface: Paginated
Sets the number of rows-per-page associated with the pagination.

Specified by:
setRowsPerPage in interface Paginated
See Also:
Paginated#setRowsPerPage(int)}

getSortCriteria

public List<SortCriterion> getSortCriteria()
Specified by:
getSortCriteria in interface Sortable
See Also:
Sortable#getSortCriteria()}

setSortCriteria

public void setSortCriteria(List<SortCriterion> sortCriteria)
Specified by:
setSortCriteria in interface Sortable
See Also:
Sortable#setSortCriteria(java.util.List)}

getStartRowIndex

public int getStartRowIndex()
Returns the index of the starting row associated with the underlying wrapped data.


setStartRowIndex

public void setStartRowIndex(int startRowIndex)
Sets the starting row associated with the underlying wrapped data.


getWrappedData

public List<E> getWrappedData()
Specified by:
getWrappedData in class javax.faces.model.DataModel<E>
See Also:
javax.faces.model.DataModel#getWrappedData()}

setWrappedData

public void setWrappedData(Object wrappedData)
Specified by:
setWrappedData in class javax.faces.model.DataModel<E>
See Also:
javax.faces.model.DataModel#setWrappedData(Object)}


Copyright © 2015 Liferay, Inc.. All rights reserved.