org.rhq.core.gui.model
Class PagedDataModel<T>

java.lang.Object
  extended by javax.faces.model.DataModel
      extended by org.ajax4jsf.model.ExtendedDataModel
          extended by org.rhq.core.gui.model.PagedDataModel<T>
Type Parameters:
T - the type of domain object (e.g. org.rhq.core.domain.Resource) that this data model represents
All Implemented Interfaces:
org.richfaces.model.Modifiable

public class PagedDataModel<T>
extends org.ajax4jsf.model.ExtendedDataModel
implements org.richfaces.model.Modifiable

Author:
Ian Springer, Joseph Marques

Field Summary
protected  org.rhq.core.domain.util.PageList<T> currentPage
           
protected  LinkedHashMap<Object,T> currentPageDataByKey
           
protected  Object currentRowKey
           
 
Constructor Summary
PagedDataModel(PagedDataProvider<T> dataProvider)
           
 
Method Summary
protected  Object getPrimaryKey(T object)
          Return the domain object's primary key - typically an Integer.
 int getRowCount()
           
 Object getRowData()
           
 int getRowIndex()
           
 Object getRowKey()
           
 Object getWrappedData()
           
 boolean isRowAvailable()
           
 void modify(List<org.richfaces.model.FilterField> filterFields, List<org.richfaces.model.SortField2> sortFields)
           
 void setRowIndex(int rowIndex)
           
 void setRowKey(Object key)
           
 void setWrappedData(Object data)
           
 void walk(javax.faces.context.FacesContext facesContext, org.ajax4jsf.model.DataVisitor dataVisitor, org.ajax4jsf.model.Range range, Object argument)
           
 
Methods inherited from class org.ajax4jsf.model.ExtendedDataModel
getSerializableModel
 
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
 

Field Detail

currentRowKey

protected Object currentRowKey

currentPage

protected org.rhq.core.domain.util.PageList<T> currentPage

currentPageDataByKey

protected LinkedHashMap<Object,T> currentPageDataByKey
Constructor Detail

PagedDataModel

public PagedDataModel(PagedDataProvider<T> dataProvider)
Method Detail

getRowKey

public Object getRowKey()
Specified by:
getRowKey in class org.ajax4jsf.model.ExtendedDataModel
See Also:
ExtendedDataModel.getRowKey()

setRowKey

public void setRowKey(Object key)
Specified by:
setRowKey in class org.ajax4jsf.model.ExtendedDataModel
See Also:
ExtendedDataModel.setRowKey(Object)

walk

public void walk(javax.faces.context.FacesContext facesContext,
                 org.ajax4jsf.model.DataVisitor dataVisitor,
                 org.ajax4jsf.model.Range range,
                 Object argument)
          throws IOException
Specified by:
walk in class org.ajax4jsf.model.ExtendedDataModel
Throws:
IOException
See Also:
ExtendedDataModel.walk(javax.faces.context.FacesContext, org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range, Object)

modify

public void modify(List<org.richfaces.model.FilterField> filterFields,
                   List<org.richfaces.model.SortField2> sortFields)
Specified by:
modify in interface org.richfaces.model.Modifiable
See Also:
Modifiable.modify(java.util.List, java.util.List)

isRowAvailable

public boolean isRowAvailable()
Specified by:
isRowAvailable in class javax.faces.model.DataModel
See Also:
DataModel.isRowAvailable()

getRowData

public Object getRowData()
Specified by:
getRowData in class javax.faces.model.DataModel
See Also:
DataModel.getRowData()

getRowCount

public int getRowCount()
Specified by:
getRowCount in class javax.faces.model.DataModel
See Also:
DataModel.getRowCount()

setRowIndex

public void setRowIndex(int rowIndex)
Specified by:
setRowIndex in class javax.faces.model.DataModel
See Also:
DataModel.setRowIndex(int)

setWrappedData

public void setWrappedData(Object data)
Specified by:
setWrappedData in class javax.faces.model.DataModel
See Also:
DataModel.setWrappedData(Object)

getRowIndex

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

getWrappedData

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

getPrimaryKey

protected Object getPrimaryKey(T object)
Return the domain object's primary key - typically an Integer. Pretty much all RHQ domain objects use 'id' as the field name for the primary key, so provide a default implementation that grabs the 'id' field to make things as easy as possible for subclasses.

Parameters:
object - a domain object
Returns:
U the domain object's primary key - typically an Integer


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