org.rhq.core.gui.table.model
Class PagedListDataModel<T>

java.lang.Object
  extended by javax.faces.model.DataModel
      extended by org.rhq.core.gui.table.model.PagedListDataModel<T>
Type Parameters:
T - the data object type

public abstract class PagedListDataModel<T>
extends javax.faces.model.DataModel

Author:
Ian Springer, Joseph Marques

Constructor Summary
PagedListDataModel(AbstractPagedDataUIBean pagedDataBean)
          Create a data model that pages through the data set, showing the specified number of rows on each page.
 
Method Summary
abstract  org.rhq.core.domain.util.PageList<T> fetchPage(org.rhq.core.domain.util.PageControl pageControl)
          Method which must be implemented in cooperation with the managed bean class to fetch data on demand.
 org.rhq.core.domain.util.PageControl getPageControl()
           
 int getRowCount()
          Return the total number of rows of data available (not just the number of rows in the current page!).
 Object getRowData()
          Return the object corresponding to the current getRowIndex().
 int getRowIndex()
           
 Object getWrappedData()
           
 boolean isRowAvailable()
          Return true if the getRowIndex() value is currently set to a value that matches some element in the dataset.
 void reset()
          TODO
 void setPageControl(org.rhq.core.domain.util.PageControl pageControl)
           
 void setRowIndex(int index)
          Specify what the "current row" within the dataset is.
 void setWrappedData(Object o)
          Not used in this class; data is fetched via a callback to the getDataPage() method rather than by explicitly assigning a list.
 
Methods inherited from class javax.faces.model.DataModel
addDataModelListener, getDataModelListeners, removeDataModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PagedListDataModel

public PagedListDataModel(AbstractPagedDataUIBean pagedDataBean)
Create a data model that pages through the data set, showing the specified number of rows on each page.

Method Detail

setWrappedData

public void setWrappedData(Object o)
Not used in this class; data is fetched via a callback to the getDataPage() method rather than by explicitly assigning a list.

Specified by:
setWrappedData in class javax.faces.model.DataModel
Parameters:
o - unused
Throws:
UnsupportedOperationException - thrown when this method is called

getRowIndex

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

setRowIndex

public void setRowIndex(int index)
Specify what the "current row" within the dataset is. Note that the UIData component will repeatedly call this method followed by getRowData to obtain the objects to render in the table.

Specified by:
setRowIndex in class javax.faces.model.DataModel
Parameters:
index - current row index, indexes start at 0

getRowCount

public int getRowCount()
Return the total number of rows of data available (not just the number of rows in the current page!).

Specified by:
getRowCount in class javax.faces.model.DataModel
Returns:
number of rows in the full dataset

getRowData

public Object getRowData()
Return the object corresponding to the current getRowIndex(). If the PageList object currently cached doesn't include that index then getDataPage() is called to retrieve the appropriate page.

Specified by:
getRowData in class javax.faces.model.DataModel
Returns:
the row data that corresponds to getRowIndex()
Throws:
IllegalArgumentException - if the getRowIndex() is outside the range of the dataset size

getWrappedData

public Object getWrappedData()
Specified by:
getWrappedData in class javax.faces.model.DataModel

isRowAvailable

public boolean isRowAvailable()
Return true if the getRowIndex() value is currently set to a value that matches some element in the dataset. Note that it may match a row that is not in the currently cached PageList; if so then when getRowData() is called the required PageList will be fetched by calling getDataPage().

Specified by:
isRowAvailable in class javax.faces.model.DataModel
Returns:
true if the row is available

getPageControl

@NotNull
public org.rhq.core.domain.util.PageControl getPageControl()

setPageControl

public void setPageControl(org.rhq.core.domain.util.PageControl pageControl)

fetchPage

public abstract org.rhq.core.domain.util.PageList<T> fetchPage(org.rhq.core.domain.util.PageControl pageControl)
Method which must be implemented in cooperation with the managed bean class to fetch data on demand.

Parameters:
pageControl - information such as the first row of data to be fetched, the number of rows of data to be fetched and sorting data
Returns:
the data page with the rows in memory

reset

public void reset()
TODO



Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.