Class HierarchicalWrapperSortModel
java.lang.Object
org.eclipse.nebula.widgets.nattable.extension.glazedlists.hierarchical.HierarchicalWrapperSortModel
- All Implemented Interfaces:
ISortModel
ISortModel that is used to support sorting of
HierarchicalWrapper in a SortedList. Internally uses the
HierarchicalWrapperComparator to keep the tree structure while
supporting dynamic column based sorting.- Since:
- 1.6
-
Constructor Summary
ConstructorsConstructorDescriptionHierarchicalWrapperSortModel(ca.odell.glazedlists.SortedList<HierarchicalWrapper> sortedList, IColumnAccessor<HierarchicalWrapper> columnAccessor, Map<Integer, List<Integer>> levelIndexMapping, DataLayer columnHeaderDataLayer, ConfigRegistry configRegistry) -
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.
-
Constructor Details
-
HierarchicalWrapperSortModel
public HierarchicalWrapperSortModel(ca.odell.glazedlists.SortedList<HierarchicalWrapper> sortedList, IColumnAccessor<HierarchicalWrapper> columnAccessor, Map<Integer, List<Integer>> levelIndexMapping, DataLayer columnHeaderDataLayer, ConfigRegistry configRegistry) - Parameters:
sortedList- TheSortedListthat should be sorted.columnAccessor- TheIColumnAccessorto access the data value for a specific column.levelIndexMapping- The mapping from hierarchical level to column indexes for that level.columnHeaderDataLayer- TheDataLayerof the column header, needed to retrieve the configuredComparator.configRegistry- TheConfigRegistryneeded to evaluate the configuredComparator.
-
-
Method Details
-
getSortedColumnIndexes
- Specified by:
getSortedColumnIndexesin interfaceISortModel- Returns:
- List of column indexes that are sorted.
-
isColumnIndexSorted
public boolean isColumnIndexSorted(int columnIndex) - Specified by:
isColumnIndexSortedin interfaceISortModel- Parameters:
columnIndex- The column index to check.- Returns:
trueif the column with the given index is sorted at the moment.
-
getSortDirection
- Specified by:
getSortDirectionin interfaceISortModel- 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
public int getSortOrder(int columnIndex) - Specified by:
getSortOrderin interfaceISortModel- 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
- Specified by:
getComparatorsForColumnIndexin interfaceISortModel- 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
- Specified by:
getColumnComparatorin interfaceISortModel- 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
Description copied from interface:ISortModelThis method is called by theSortCommandHandlerin response to a sort command. It is responsible for sorting the requested column.- Specified by:
sortin interfaceISortModel- 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
public void clear()Description copied from interface:ISortModelRemove all sorting- Specified by:
clearin interfaceISortModel
-