|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.faces.model.DataModel
org.rhq.enterprise.gui.common.paging.PagedListDataModel<T>
T - the data type to be stored in the datasetpublic abstract class PagedListDataModel<T>
A special type of JSF DataModel to allow a table and datascroller to page through a large set of data without having to hold the entire set of data in memory at once.
Any time a managed bean wants to avoid holding an entire dataset, the managed bean should declare an inner class which extends this class and implements the fetchData method. This method is called as needed when the table requires data that isn't available in the current data page held by this object.
This does require the managed bean (and in general the business method that the managed bean uses) to provide the data wrapped in a PageList object that provides info on the full size of the dataset.
Adapted from - http://wiki.apache.org/myfaces/WorkingWithLargeTables
| Constructor Summary | |
|---|---|
PagedListDataModel(PageControlView view,
String beanName)
Create a datamodel that pages through the data 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 pc)
Method which must be implemented in cooperation with the managed bean class to fetch data on demand. |
org.rhq.core.domain.util.PageList<T> |
getDataPage(org.rhq.core.domain.util.PageControl pc)
|
org.rhq.core.domain.util.PageControl |
getDefaultPageControl()
|
org.rhq.core.domain.util.PageControl |
getPageControl()
|
PageControlView |
getPageControlView()
|
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 |
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(PageControl) 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 |
|---|
public PagedListDataModel(PageControlView view,
String beanName)
pageSize - the total number of pages in the full dataset| Method Detail |
|---|
public void setWrappedData(Object o)
getDataPage(PageControl) method rather
than by explicitly assigning a list.
setWrappedData in class javax.faces.model.DataModelo - unused
UnsupportedOperationException - thrown when this method is calledpublic int getRowIndex()
getRowIndex in class javax.faces.model.DataModelpublic void setRowIndex(int index)
setRowIndex in class javax.faces.model.DataModelindex - current row index, indexes start at 0public int getRowCount()
getRowCount in class javax.faces.model.DataModelpublic Object getRowData()
getRowIndex(). If the PageList object currently cached
doesn't include that index then getDataPage(PageControl) is called to retrieve the appropriate page.
getRowData in class javax.faces.model.DataModelgetRowIndex()
IllegalArgumentException - if the getRowIndex() is outside the range of the dataset sizepublic Object getWrappedData()
getWrappedData in class javax.faces.model.DataModelpublic boolean isRowAvailable()
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(PageControl).
isRowAvailable in class javax.faces.model.DataModeltrue if the row is availablepublic org.rhq.core.domain.util.PageControl getPageControl()
public org.rhq.core.domain.util.PageControl getDefaultPageControl()
public void setPageControl(org.rhq.core.domain.util.PageControl pageControl)
public org.rhq.core.domain.util.PageList<T> getDataPage(org.rhq.core.domain.util.PageControl pc)
public abstract org.rhq.core.domain.util.PageList<T> fetchPage(org.rhq.core.domain.util.PageControl pc)
pc - information such as the first row of data to be fetched, the number of rows of data to be fetched and
sorting data
public PageControlView getPageControlView()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||