public class SortableModel extends CollectionModel
| Modifier and Type | Class and Description |
|---|---|
static class |
SortableModel.Decomposition
This class provides an enumeration to work with the integer values of the
Collator decomposition values. |
static class |
SortableModel.Strength
This class provides an enumeration to work with the integer values of the
Collator strength values. |
LocalRowKeyIndex.Confidence, LocalRowKeyIndex.LocalCachingStrategyUNKNOWN_ROW_LIMIT, UNLIMITED_ROW| Constructor and Description |
|---|
SortableModel()
No arg constructor for use as a managed-bean.
|
SortableModel(Object model)
Create a new SortableModel from the given instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDataModelListener(javax.faces.model.DataModelListener listener) |
Comparator |
getComparator(String propertyName)
Get the comparator associated with the given property.
|
javax.faces.model.DataModelListener[] |
getDataModelListeners() |
int |
getRowCount()
Gets the number of values in this collection
|
Object |
getRowData()
Gets the current value identified by the current index or rowKey.
|
int |
getRowIndex()
Gets the index of the current value.
|
Object |
getRowKey()
Gets the row key 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 |
isSortable(String property)
Checks to see if the underlying collection is sortable by the given property.
|
void |
removeDataModelListener(javax.faces.model.DataModelListener listener) |
void |
setCollator(String propertyName,
SortableModel.Strength collatorStrength,
SortableModel.Decomposition collatorDecomposition)
Convenience method to set a compatator for a property using a
Collator setup with
the given strength and decomposition values. |
void |
setComparator(String propertyName,
Comparator comparator)
Set a custom comparator to use to sort the given property name.
|
void |
setRowIndex(int rowIndex)
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 data)
Sets the underlying data being managed by this instance.
|
String |
toString() |
addRowKeyChangeListener, areRowsAvailable, areRowsAvailable, areRowsAvailable, areRowsLocallyAvailable, areRowsLocallyAvailable, areRowsLocallyAvailable, clearCachedRow, clearCachedRow, clearCachedRows, clearCachedRows, clearLocalCache, ensureRowsAvailable, fireRowKeyChange, getCachingStrategy, getEstimatedRowCount, getEstimatedRowCountConfidence, getRowData, getRowData, getRowLimit, isRowAvailable, isRowAvailable, isRowLocallyAvailable, isRowLocallyAvailable, removeRowKeyChangeListenerpublic SortableModel(Object model)
model - This will be converted into a DataModelsetWrappedData(java.lang.Object)public SortableModel()
public Object getRowData()
RowKeyIndexgetRowData in interface RowKeyIndexgetRowData in class javax.faces.model.DataModelRowKeyIndex.getRowKey(),
RowKeyIndex.getRowIndex()public Object getWrappedData()
getWrappedData in class javax.faces.model.DataModelpublic boolean isRowAvailable()
RowKeyIndexRowKeyIndex.getRowCount()).isRowAvailable in interface RowKeyIndexisRowAvailable in class javax.faces.model.DataModelRowKeyIndex.getRowKey(),
RowKeyIndex.getRowIndex()public void setWrappedData(Object data)
setWrappedData in class javax.faces.model.DataModeldata - This Object will be converted into a
DataModel.ModelUtils.toDataModel(java.lang.Object)public int getRowCount()
RowKeyIndexgetRowCount in interface RowKeyIndexgetRowCount in class javax.faces.model.DataModelpublic void setRowIndex(int rowIndex)
RowKeyIndexsetRowIndex in interface RowKeyIndexsetRowIndex in class javax.faces.model.DataModelrowIndex - the zero-based index of the value to make current.
Use -1 to clear the current valuepublic int getRowIndex()
RowKeyIndexgetRowIndex in interface RowKeyIndexgetRowIndex in class javax.faces.model.DataModelpublic Object getRowKey()
getRowKey in interface RowKeyIndexgetRowKey in class CollectionModelCollectionModel.setRowKey(java.lang.Object)public void setRowKey(Object key)
setRowKey in interface RowKeyIndexsetRowKey in class CollectionModelkey - the rowKey, previously obtained from CollectionModel.getRowKey().public void addDataModelListener(javax.faces.model.DataModelListener listener)
addDataModelListener in class javax.faces.model.DataModelpublic javax.faces.model.DataModelListener[] getDataModelListeners()
getDataModelListeners in class javax.faces.model.DataModelpublic void removeDataModelListener(javax.faces.model.DataModelListener listener)
removeDataModelListener in class javax.faces.model.DataModelpublic boolean isSortable(String property)
isSortable in class CollectionModelproperty - The name of the property to sort the underlying collection by.public List<SortCriterion> getSortCriteria()
CollectionModelgetSortCriteria in class CollectionModelSortCriterionpublic void setSortCriteria(List<SortCriterion> criteria)
CollectionModelsetSortCriteria in class CollectionModelcriteria - 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.SortCriterionpublic Comparator getComparator(String propertyName)
propertyName - the propertypublic void setComparator(String propertyName, Comparator comparator)
propertyName - the property with which to associate the comparatorcomparator - the comparator to use, or null to remove onepublic void setCollator(String propertyName, SortableModel.Strength collatorStrength, SortableModel.Decomposition collatorDecomposition)
Collator setup with
the given strength and decomposition values.propertyName - the propertycollatorStrength - the stregth to use or null to leave as the default for the
default localecollatorDecomposition - the decomposition to use or null to leave as the default for the
default localesetComparator(String, Comparator)Copyright © 2001-2017 The Apache Software Foundation. All Rights Reserved.