org.richfaces.model
Class ExtendedTableDataModel<T>

java.lang.Object
  extended by javax.faces.model.DataModel
      extended by org.ajax4jsf.model.ExtendedDataModel
          extended by org.richfaces.model.ExtendedTableDataModel<T>
All Implemented Interfaces:
java.io.Serializable

public class ExtendedTableDataModel<T>
extends org.ajax4jsf.model.ExtendedDataModel
implements java.io.Serializable

Data model class for table components.
Usage:

 ExtendedTableDataModel<SomeDataType> dataModel = new ExtendedTableDataModel<SomeDataType>(new DataProvider <SomeDataType>());
 

Author:
pawelgo
See Also:
Serialized Form

Constructor Summary
ExtendedTableDataModel(org.richfaces.model.DataProvider<T> dataProvider)
           
 
Method Summary
 org.richfaces.model.DataProvider<T> getDataProvider()
           
 java.lang.Object getKey(T o)
           
 T getObjectByKey(java.lang.Object key)
           
 int getRowCount()
           
 T getRowData()
          This is main way to obtain data row.
 int getRowIndex()
          Unused rudiment from old JSF staff.
 java.lang.Object getRowKey()
          This method never called from framework.
 java.lang.Object getWrappedData()
          Unused rudiment from old JSF staff.
 boolean isRowAvailable()
          Never called by framework.
protected  java.util.List<T> loadData(int startRow, int endRow)
          Load range of data items from the source.
 void reset()
          Resets internal cached data.
 void setDataProvider(org.richfaces.model.DataProvider<T> dataProvider)
           
 void setRowIndex(int rowIndex)
          Unused rudiment from old JSF staff.
 void setRowKey(java.lang.Object key)
          This method normally called by Visitor before request Data Row.
 void setWrappedData(java.lang.Object data)
          Unused rudiment from old JSF staff.
 void walk(javax.faces.context.FacesContext context, org.ajax4jsf.model.DataVisitor visitor, org.ajax4jsf.model.Range range, java.lang.Object argument)
          This is main part of Visitor pattern.
 
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
 

Constructor Detail

ExtendedTableDataModel

public ExtendedTableDataModel(org.richfaces.model.DataProvider<T> dataProvider)
Method Detail

getRowKey

public java.lang.Object getRowKey()
This method never called from framework. (non-Javadoc)

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

setRowKey

public void setRowKey(java.lang.Object key)
This method normally called by Visitor before request Data Row. (non-Javadoc)

Specified by:
setRowKey in class org.ajax4jsf.model.ExtendedDataModel
See Also:
ExtendedDataModel.setRowKey(java.lang.Object)

walk

public void walk(javax.faces.context.FacesContext context,
                 org.ajax4jsf.model.DataVisitor visitor,
                 org.ajax4jsf.model.Range range,
                 java.lang.Object argument)
          throws java.io.IOException
This is main part of Visitor pattern. Method called by framework many times during request processing. (non-Javadoc)

Specified by:
walk in class org.ajax4jsf.model.ExtendedDataModel
Throws:
java.io.IOException
See Also:
ExtendedDataModel.walk(javax.faces.context.FacesContext, org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range, java.lang.Object)

loadData

protected java.util.List<T> loadData(int startRow,
                                     int endRow)
Load range of data items from the source. Starting from startRow, and up to but excluding endRow

Parameters:
startRow -
endRow -
Returns:
list of ordered data

getRowCount

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

getRowData

public T getRowData()
This is main way to obtain data row. It is intensively used by framework. We strongly recommend use of local cache in that method. (non-Javadoc)

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

getKey

public java.lang.Object getKey(T o)

getObjectByKey

public T getObjectByKey(java.lang.Object key)

getRowIndex

public int getRowIndex()
Unused rudiment from old JSF staff. (non-Javadoc)

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

setRowIndex

public void setRowIndex(int rowIndex)
Unused rudiment from old JSF staff. (non-Javadoc)

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

getWrappedData

public java.lang.Object getWrappedData()
Unused rudiment from old JSF staff. (non-Javadoc)

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

setWrappedData

public void setWrappedData(java.lang.Object data)
Unused rudiment from old JSF staff. (non-Javadoc)

Specified by:
setWrappedData in class javax.faces.model.DataModel
See Also:
DataModel.setWrappedData(java.lang.Object)

isRowAvailable

public boolean isRowAvailable()
Never called by framework. (non-Javadoc)

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

reset

public void reset()
Resets internal cached data. Call this method to reload data from data provider on first access for data.


getDataProvider

public org.richfaces.model.DataProvider<T> getDataProvider()

setDataProvider

public void setDataProvider(org.richfaces.model.DataProvider<T> dataProvider)


Copyright 2009. All Rights Reserved.