public abstract class CollectionModelDecorator extends CollectionModel
Used by anybody who wants to wrap the CollectionModel
class.
This class simply delegates all the CollectionModel functionalities to the wrapped class.
The wrapped CollectionModel is returned by thegetCollectionModel
method. And that
method needs to be overriden by the subclasses.getCollectionModel()
LocalRowKeyIndex.Confidence, LocalRowKeyIndex.LocalCachingStrategy
Constructor and Description |
---|
CollectionModelDecorator() |
Modifier and Type | Method and Description |
---|---|
void |
addDataModelListener(javax.faces.model.DataModelListener listener) |
boolean |
areRowsAvailable(int rowCount)
Check if a range of rows is available starting from the
current row.
|
boolean |
areRowsAvailable(int startIndex,
int rowCount)
Check if a range of rows is available from a starting index.
|
boolean |
areRowsAvailable(Object startRowKey,
int rowCount)
Check if a range of rows is available from a starting row key
This method makes the row with the given row key current and calls
#areRowsAvailable(rowsToCheck) . |
boolean |
areRowsLocallyAvailable(int rowCount)
Check if a range of rows is locally available starting from current position.
|
boolean |
areRowsLocallyAvailable(int startIndex,
int rowCount)
Check if a range of rows is locally available starting from a row index.
|
boolean |
areRowsLocallyAvailable(Object startRowKey,
int rowCount)
Check if a range of rows is locally available starting from a row key.
|
void |
clearCachedRow(int index)
Clear a row from the local cache by row index
|
void |
clearCachedRow(Object rowKey)
Clear a row from the local cache by row key
|
void |
clearCachedRows(int startingIndex,
int rowsToClear)
Clear the requested range of rows from the local cache
|
void |
clearCachedRows(Object startingRowKey,
int rowsToClear)
Clear the requested range of rows from the local cache
|
void |
clearLocalCache()
clear all rows from the local cache
|
LocalRowKeyIndex.LocalCachingStrategy |
getCachingStrategy()
Indicates the caching strategy supported by the model
|
protected abstract CollectionModel |
getCollectionModel()
This method returns the wrapped
CollectionModel . |
javax.faces.model.DataModelListener[] |
getDataModelListeners() |
int |
getEstimatedRowCount()
Convenient API to return a row count estimate.
|
LocalRowKeyIndex.Confidence |
getEstimatedRowCountConfidence()
Helper API to determine if the row count returned from
CollectionModel.getEstimatedRowCount()
is EXACT, or an ESTIMATE. |
int |
getRowCount()
Gets the number of values in this collection
|
Object |
getRowData()
Gets the current value identified by the current index or rowKey.
|
Object |
getRowData(int rowIndex)
Gets the rowData at the given index.
|
Object |
getRowData(Object rowKey)
Returns the rowData for the given rowKey without changing model currency.
|
int |
getRowIndex()
Gets the index of the current value.
|
Object |
getRowKey()
Gets the rowKey of the current row.
|
List<SortCriterion> |
getSortCriteria()
Gets the criteria that this collection is sorted by.
|
Object |
getWrappedData() |
boolean |
isRowAvailable()
Checks to make sure a value exists for the current index or rowKey.
|
boolean |
isRowAvailable(int rowIndex)
Checks to see if the row at the given index is available.
|
boolean |
isRowAvailable(Object rowKey)
Check for an available row by row key.
|
boolean |
isRowLocallyAvailable(int rowIndex)
Given a row index, check if the row is locally available.
|
boolean |
isRowLocallyAvailable(Object rowKey)
Given a row key, check if the row is locally available.
|
boolean |
isSortable(String property)
Return true if this collection is sortable by the given property.
|
void |
removeDataModelListener(javax.faces.model.DataModelListener listener) |
void |
setRowIndex(int i)
Sets up a value at a particular index to be the current value.
|
void |
setRowKey(Object key)
Finds the row with the matching key and makes it current
|
void |
setSortCriteria(List<SortCriterion> criteria)
Sorts this collection by the given criteria.
|
void |
setWrappedData(Object object) |
addRowKeyChangeListener, fireRowKeyChange, removeRowKeyChangeListener
public Object getRowKey()
CollectionModel
Object.equals(java.lang.Object)
and Object.hashCode()
as they will be used
as keys in hashtables. rowKeys should also be Serializable, so that the
application can run under all JSF state-saving schemes.getRowKey
in interface RowKeyIndex
getRowKey
in class CollectionModel
CollectionModel.setRowKey(java.lang.Object)
public void setRowKey(Object key)
CollectionModel
setRowKey
in interface RowKeyIndex
setRowKey
in class CollectionModel
key
- the rowKey, previously obtained from CollectionModel.getRowKey()
.public boolean isRowAvailable(int rowIndex)
CollectionModel
DataModel.isRowAvailable()
.
Finally, the row that was current before this method was called
is made current again.isRowAvailable
in interface RowKeyIndex
isRowAvailable
in class CollectionModel
rowIndex
- the index of the row to check.DataModel.isRowAvailable()
public boolean isRowAvailable(Object rowKey)
CollectionModel
DataModel.isRowAvailable()
.
Finally, the row that was current before this method was called
is made current again.isRowAvailable
in interface RowKeyIndex
isRowAvailable
in class CollectionModel
rowKey
- the row key for the row to check.DataModel.isRowAvailable()
public Object getRowData(int rowIndex)
CollectionModel
DataModel.getRowData()
.
Finally, the row that was current before this method was called
is made current again.getRowData
in interface RowKeyIndex
getRowData
in class CollectionModel
rowIndex
- the index of the row to get data from.DataModel.getRowData()
public Object getRowData(Object rowKey)
CollectionModel
getRowData
in interface RowKeyIndex
getRowData
in class CollectionModel
rowKey
- the row key of the row to get data from.DataModel.getRowData()
public boolean isSortable(String property)
CollectionModel
isSortable
in class CollectionModel
public List<SortCriterion> getSortCriteria()
CollectionModel
getSortCriteria
in class CollectionModel
SortCriterion
public void setSortCriteria(List<SortCriterion> criteria)
CollectionModel
setSortCriteria
in class CollectionModel
criteria
- Each element in this List must be of type SortCriterion.
The empty list may be used to cancel any sort order. null should be treated
the same as an empty list.SortCriterion
public boolean areRowsAvailable(int startIndex, int rowCount)
CollectionModel
areRowsAvailable
in interface RowKeyIndex
areRowsAvailable
in class CollectionModel
startIndex
- the starting index for the rangerowCount
- number of rows to check. If rowsToCheck < 0 set
startIndex = startIndex - abs(rowsToCheck) + 1. This
allows for checking for row availability from the end position. For example
to check for availability of n rows from the end, call
isRangeAvailable(getRowCount()-1, -n)false
public boolean areRowsAvailable(Object startRowKey, int rowCount)
CollectionModel
#areRowsAvailable(rowsToCheck)
.
The current row does not change after this callareRowsAvailable
in interface RowKeyIndex
areRowsAvailable
in class CollectionModel
startRowKey
- the starting row key for the rangerowCount
- number of rows to checkCollectionModel.areRowsAvailable(int).
public boolean areRowsAvailable(int rowCount)
CollectionModel
areRowsAvailable
in interface RowKeyIndex
areRowsAvailable
in class CollectionModel
rowCount
- number of rows to checkpublic boolean areRowsLocallyAvailable(int startIndex, int rowCount)
CollectionModel
areRowsLocallyAvailable
in interface LocalRowKeyIndex
areRowsLocallyAvailable
in class CollectionModel
startIndex
- starting row index to checkrowCount
- number of rows to checkfalse
CollectionModel.areRowsAvailable(int, int)
public boolean areRowsLocallyAvailable(Object startRowKey, int rowCount)
CollectionModel
areRowsLocallyAvailable
in interface LocalRowKeyIndex
areRowsLocallyAvailable
in class CollectionModel
startRowKey
- starting row key to checkrowCount
- number of rows to checkfalse
CollectionModel.areRowsAvailable(Object, int)
public boolean areRowsLocallyAvailable(int rowCount)
CollectionModel
areRowsLocallyAvailable(startIndex, rowsToCheck)
areRowsLocallyAvailable
in interface LocalRowKeyIndex
areRowsLocallyAvailable
in class CollectionModel
rowCount
- number of rows to checkfalse
areRowsLocallyAvailable(startIndex, rowsToCheck)
public boolean isRowLocallyAvailable(int rowIndex)
CollectionModel
isRowLocallyAvailable
in interface LocalRowKeyIndex
isRowLocallyAvailable
in class CollectionModel
rowIndex
- row index to checkfalse
public boolean isRowLocallyAvailable(Object rowKey)
CollectionModel
isRowLocallyAvailable
in interface LocalRowKeyIndex
isRowLocallyAvailable
in class CollectionModel
rowKey
- row key to checkfalse
public int getEstimatedRowCount()
CollectionModel
getEstimatedRowCount
in interface LocalRowKeyIndex
getEstimatedRowCount
in class CollectionModel
DataModel.getRowCount()
public LocalRowKeyIndex.Confidence getEstimatedRowCountConfidence()
CollectionModel
CollectionModel.getEstimatedRowCount()
is EXACT, or an ESTIMATE.getEstimatedRowCountConfidence
in interface LocalRowKeyIndex
getEstimatedRowCountConfidence
in class CollectionModel
DataModel.getRowCount()
public void clearLocalCache()
clearLocalCache
in interface LocalRowKeyIndex
clearLocalCache
in class CollectionModel
public void clearCachedRows(int startingIndex, int rowsToClear)
clearCachedRows
in interface LocalRowKeyIndex
clearCachedRows
in class CollectionModel
startingIndex
- starting row index for the range to clearrowsToClear
- number of rows to clear from the cacheCollectionModel.clearLocalCache()
public void clearCachedRows(Object startingRowKey, int rowsToClear)
clearCachedRows
in interface LocalRowKeyIndex
clearCachedRows
in class CollectionModel
startingRowKey
- starting row key for the range to clearrowsToClear
- number of rows to clear from the cacheCollectionModel.clearLocalCache()
public void clearCachedRow(int index)
clearCachedRow
in interface LocalRowKeyIndex
clearCachedRow
in class CollectionModel
index
- row index for the row to clear from the cacheCollectionModel.clearCachedRows(int, int)
public void clearCachedRow(Object rowKey)
clearCachedRow
in interface LocalRowKeyIndex
clearCachedRow
in class CollectionModel
rowKey
- row key for the row to clear from the cacheCollectionModel.clearCachedRows(Object, int)
public LocalRowKeyIndex.LocalCachingStrategy getCachingStrategy()
getCachingStrategy
in interface LocalRowKeyIndex
getCachingStrategy
in class CollectionModel
LocalCachingStrategy
public boolean isRowAvailable()
RowKeyIndex
RowKeyIndex.getRowCount()
).isRowAvailable
in interface RowKeyIndex
isRowAvailable
in class javax.faces.model.DataModel
RowKeyIndex.getRowKey()
,
RowKeyIndex.getRowIndex()
public int getRowCount()
RowKeyIndex
getRowCount
in interface RowKeyIndex
getRowCount
in class javax.faces.model.DataModel
public Object getRowData()
RowKeyIndex
getRowData
in interface RowKeyIndex
getRowData
in class javax.faces.model.DataModel
RowKeyIndex.getRowKey()
,
RowKeyIndex.getRowIndex()
public int getRowIndex()
RowKeyIndex
getRowIndex
in interface RowKeyIndex
getRowIndex
in class javax.faces.model.DataModel
public void setRowIndex(int i)
RowKeyIndex
setRowIndex
in interface RowKeyIndex
setRowIndex
in class javax.faces.model.DataModel
i
- the zero-based index of the value to make current.
Use -1 to clear the current valuepublic Object getWrappedData()
getWrappedData
in class javax.faces.model.DataModel
public void setWrappedData(Object object)
setWrappedData
in class javax.faces.model.DataModel
public void addDataModelListener(javax.faces.model.DataModelListener listener)
addDataModelListener
in class javax.faces.model.DataModel
public javax.faces.model.DataModelListener[] getDataModelListeners()
getDataModelListeners
in class javax.faces.model.DataModel
public void removeDataModelListener(javax.faces.model.DataModelListener listener)
removeDataModelListener
in class javax.faces.model.DataModel
protected abstract CollectionModel getCollectionModel()
CollectionModel
.Copyright © 2001-2016 The Apache Software Foundation. All Rights Reserved.