org.portletfaces.liferay.faces.model
Class LazyDataModel<E>

java.lang.Object
  extended by javax.faces.model.DataModel<E>
      extended by org.portletfaces.liferay.faces.model.RowMarkerDataModel<E>
          extended by org.portletfaces.liferay.faces.model.LazyDataModel<E>
All Implemented Interfaces:
java.lang.Iterable<E>, Paginated, RowMarker, Sortable

public abstract class LazyDataModel<E>
extends RowMarkerDataModel<E>
implements Paginated, Sortable

This abstract class provides the ability to supply JSF UI components with a DataModel that loads data in a lazy (on-demand) manner. It also provides for the ability to mark underlying rows for deletion.

Author:
Neil Griffin

Nested Class Summary
 
Nested classes/interfaces inherited from class org.portletfaces.liferay.faces.model.RowMarkerDataModel
RowMarkerDataModel.RowMarksObserver
 
Field Summary
 
Fields inherited from class org.portletfaces.liferay.faces.model.RowMarkerDataModel
allRowsMarked
 
Constructor Summary
LazyDataModel()
           
 
Method Summary
abstract  int countRows()
          Returns the total number of rows.
abstract  java.util.List<E> findRows(int startRow, int finishRow)
          Returns a list of rows that is a subset of the entire list of rows.
 int getRowCount()
           
 E getRowData()
           
 int getRowIndex()
           
 int getRowsPerPage()
          Returns the number of rows-per-page associated with the pagination.
 java.lang.String getSortColumn()
           
 java.util.List<E> getWrappedData()
           
 int getWrappedDataFinishRowIndex()
          Returns the index of the finishing row associated with the underlying wrapped data.
 int getWrappedDataStartRowIndex()
          Returns the index of the starting row associated with the underlying wrapped data.
 E getWrappedRow(java.lang.Object primaryKey)
          Searches through the cached/wrapped data for the row that corresponds to the specified primaryKey and returns the row.
 boolean isReset()
          Indicates whether or not the underlying cache of rows has been reset/cleared.
 boolean isRowAvailable()
           
 boolean isSortAscending()
           
 void reset()
          Resets (clears) the underlying cache of rows.
 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 setSortAscending(boolean sortAscending)
           
 void setSortColumn(java.lang.String sortColumn)
           
 void setWrappedData(java.lang.Object wrappedData)
           
 void setWrappedDataFinishRowIndex(int wrappedDataFinishRowIndex)
          Sets the finishing row associated with the underlying wrapped data.
 void setWrappedDataStartRowIndex(int wrappedDataStartRowIndex)
          Sets the starting row associated with the underlying wrapped data.
 
Methods inherited from class org.portletfaces.liferay.faces.model.RowMarkerDataModel
deleteMarkedRows, deleteRow, getPrimaryKey, getRowMarks, isAllRowsMarked, setAllRowsMarked, setRowMarks
 
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

LazyDataModel

public LazyDataModel()
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 java.util.List<E> findRows(int startRow,
                                           int finishRow)
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.

reset

public void reset()
Description copied from class: RowMarkerDataModel
Resets (clears) the underlying cache of rows.

Specified by:
reset in class RowMarkerDataModel<E>
See Also:
RowMarkerDataModel#reset()}

isRowAvailable

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

isSortAscending

public boolean isSortAscending()
Specified by:
isSortAscending in interface Sortable
See Also:
Sortable#isSortAscending()}

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)}

setSortAscending

public void setSortAscending(boolean sortAscending)
Specified by:
setSortAscending in interface Sortable
See Also:
Sortable#setSortAscending(boolean)}

getSortColumn

public java.lang.String getSortColumn()
Specified by:
getSortColumn in interface Sortable
See Also:
Sortable#getSortColumn()}

setSortColumn

public void setSortColumn(java.lang.String sortColumn)
Specified by:
setSortColumn in interface Sortable
See Also:
Sortable#setSortColumn(String)}

isReset

public boolean isReset()
Description copied from class: RowMarkerDataModel
Indicates whether or not the underlying cache of rows has been reset/cleared.

Specified by:
isReset in class RowMarkerDataModel<E>

getWrappedData

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

setWrappedData

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

getWrappedDataFinishRowIndex

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


setWrappedDataFinishRowIndex

public void setWrappedDataFinishRowIndex(int wrappedDataFinishRowIndex)
Sets the finishing row associated with the underlying wrapped data.


getWrappedDataStartRowIndex

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


setWrappedDataStartRowIndex

public void setWrappedDataStartRowIndex(int wrappedDataStartRowIndex)
Sets the starting row associated with the underlying wrapped data.


getWrappedRow

public E getWrappedRow(java.lang.Object primaryKey)
Searches through the cached/wrapped data for the row that corresponds to the specified primaryKey and returns the row.



Copyright © 2011 portletfaces.org. All Rights Reserved.