Interface ISortModel
- All Known Implementing Classes:
GlazedListsSortModel,HierarchicalWrapperSortModel,SortModelFixture
public interface ISortModel
Interface providing sorting functionality.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Remove all sortingComparator<?>getColumnComparator(int columnIndex) getComparatorsForColumnIndex(int columnIndex) getSortDirection(int columnIndex) intgetSortOrder(int columnIndex) booleanisColumnIndexSorted(int columnIndex) voidsort(int columnIndex, SortDirectionEnum sortDirection, boolean accumulate) This method is called by theSortCommandHandlerin response to a sort command.
-
Method Details
-
getSortedColumnIndexes
- Returns:
- List of column indexes that are sorted.
-
isColumnIndexSorted
boolean isColumnIndexSorted(int columnIndex) - Parameters:
columnIndex- The column index to check.- Returns:
trueif the column with the given index is sorted at the moment.
-
getSortDirection
- Parameters:
columnIndex- The column index for which the sort direction is requested.- Returns:
- the direction in which the column with the given index is currently sorted
-
getSortOrder
int getSortOrder(int columnIndex) - Parameters:
columnIndex- The column index for which the sort order is requested.- Returns:
- when multiple columns are sorted, this returns the order of the
column index in the sort
Example: If column indexes 3, 6, 9 are sorted (in that order) the sort order for index 6 is 1.
-
getComparatorsForColumnIndex
- Parameters:
columnIndex- The index of the column for which the row objects should be sorted.- Returns:
- The collection of Comparators used to sort row objects by column values.
-
getColumnComparator
- Parameters:
columnIndex- The index of the column for which theComparatoris requested.- Returns:
- The
Comparatorthat is used for sorting the values of a specified column. Needed in case of data model wrapping, e.g. GroupBy
-
sort
This method is called by theSortCommandHandlerin response to a sort command. It is responsible for sorting the requested column.- Parameters:
columnIndex- The column index to sort.sortDirection- The sort direction to apply.accumulate- flag indicating if the column should added to a previous sort.
-
clear
void clear()Remove all sorting
-