org.apache.myfaces.trinidad.model
Class RowKeyPropertyModel

java.lang.Object
  extended by javax.faces.model.DataModel
      extended by org.apache.myfaces.trinidad.model.CollectionModel
          extended by org.apache.myfaces.trinidad.model.SortableModel
              extended by org.apache.myfaces.trinidad.model.RowKeyPropertyModel
All Implemented Interfaces:
Iterable, LocalRowKeyIndex, RowKeyIndex

public class RowKeyPropertyModel
extends SortableModel

Creates a CollectionModel whose row keys are defined by a unique data property in the model.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.myfaces.trinidad.model.SortableModel
SortableModel.Decomposition, SortableModel.Strength
 
Nested classes/interfaces inherited from interface org.apache.myfaces.trinidad.model.LocalRowKeyIndex
LocalRowKeyIndex.Confidence, LocalRowKeyIndex.LocalCachingStrategy
 
Constructor Summary
RowKeyPropertyModel()
          No arg constructor for use as a managed-bean.
RowKeyPropertyModel(Object model, String rowKeyProperty)
          Creates a RowKeyPropertyModel.
 
Method Summary
 Object getRowKey()
          Gets the row key for the current row
protected  Object getRowKey(Object row)
          gets the row key for the given row by resolving the _rowKeyProperty
 String getRowKeyProperty()
          Gets the row key property name for this model
 void setRowKey(Object key)
          Moves the model to the row identified by the key.
 void setRowKeyProperty(String rowKeyProperty)
          Sets the row key property for this model
 
Methods inherited from class org.apache.myfaces.trinidad.model.SortableModel
addDataModelListener, getComparator, getDataModelListeners, getRowCount, getRowData, getRowIndex, getSortCriteria, getWrappedData, isRowAvailable, isSortable, removeDataModelListener, setCollator, setComparator, setRowIndex, setSortCriteria, setWrappedData, toString
 
Methods inherited from class org.apache.myfaces.trinidad.model.CollectionModel
addRowKeyChangeListener, areRowsAvailable, areRowsAvailable, areRowsAvailable, areRowsLocallyAvailable, areRowsLocallyAvailable, areRowsLocallyAvailable, clearCachedRow, clearCachedRow, clearCachedRows, clearCachedRows, clearLocalCache, fireRowKeyChange, getCachingStrategy, getEstimatedRowCount, getEstimatedRowCountConfidence, getRowData, getRowData, isRowAvailable, isRowAvailable, isRowLocallyAvailable, isRowLocallyAvailable, removeRowKeyChangeListener
 
Methods inherited from class javax.faces.model.DataModel
iterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RowKeyPropertyModel

public RowKeyPropertyModel(Object model,
                           String rowKeyProperty)
Creates a RowKeyPropertyModel.

Parameters:
model - The underlying model. If necessary, this will be converted into a DataModel
rowKeyProperty - The property by which the row key can be accessed. Row key value must be unique

RowKeyPropertyModel

public RowKeyPropertyModel()
No arg constructor for use as a managed-bean. Must call SortableModel.setWrappedData(java.lang.Object) and setRowKeyProperty(java.lang.String) before using this instance.

Method Detail

getRowKey

public Object getRowKey()
Gets the row key for the current row

Specified by:
getRowKey in interface RowKeyIndex
Overrides:
getRowKey in class SortableModel
Returns:
row key or null if model is not on any row
See Also:
CollectionModel.setRowKey(java.lang.Object)

setRowKey

public void setRowKey(Object key)
Moves the model to the row identified by the key.

Specified by:
setRowKey in interface RowKeyIndex
Overrides:
setRowKey in class SortableModel
Parameters:
key - target row key

getRowKeyProperty

public String getRowKeyProperty()
Gets the row key property name for this model

Returns:
row key property name

setRowKeyProperty

public void setRowKeyProperty(String rowKeyProperty)
Sets the row key property for this model

Parameters:
rowKeyProperty - row key property to set

getRowKey

protected Object getRowKey(Object row)
gets the row key for the given row by resolving the _rowKeyProperty

Parameters:
row - row to retrieve the row key for
Returns:
row key value


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.