Module is.codion.swing.common.model
Interface FilteredTableSortModel<R,C>
- Type Parameters:
R
- the type representing a row in the table modelC
- the type representing the column identifiers in the table model
public interface FilteredTableSortModel<R,C>
Handles the column sorting states for a
FilteredTableModel
.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Specifies a sorting state for a column. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSortOrder
(C columnIdentifier, SortOrder sortOrder) Adds the given column sorting order to the currently sorted columns.void
clear()
Clears the sorting states from this sort model.Returns the current column sort order, in order of priorityboolean
isSortingEnabled
(C columnIdentifier) static SortOrder
nextSortOrder
(SortOrder currentSortOrder) void
setSortingEnabled
(C columnIdentifier, boolean sortingEnabled) Disabling sorting will causesetSortOrder(Object, SortOrder)
andaddSortOrder(Object, SortOrder)
to throw aIllegalStateException
for the given column.void
setSortOrder
(C columnIdentifier, SortOrder sortOrder) Clears the sorting state and adds the given column sorting order.boolean
sorted()
int
sortPriority
(C columnIdentifier)
-
Method Details
-
comparator
Comparator<R> comparator()- Returns:
- a
Comparator
based on this sort model
-
setSortOrder
Clears the sorting state and adds the given column sorting order.- Parameters:
columnIdentifier
- the identifier of the column to sort bysortOrder
- the sorting order- Throws:
IllegalStateException
- in case sorting is disabled for the given column- See Also:
-
addSortOrder
Adds the given column sorting order to the currently sorted columns. If no column sorting is enabled, this call is the equivilent to usingsetSortOrder(Object, SortOrder)
.- Parameters:
columnIdentifier
- the identifier of the column to sort bysortOrder
- the sorting order- Throws:
IllegalStateException
- in case sorting is disabled for the given column- See Also:
-
sortOrder
- Parameters:
columnIdentifier
- the column identifier- Returns:
- the
SortOrder
associated with the given column
-
sortPriority
- Parameters:
columnIdentifier
- the column identifier- Returns:
- the sort priority for the given column, -1 if not sorted
-
sorted
boolean sorted()- Returns:
- true if sorting is enabled for one or more columns
-
columnSortOrder
List<FilteredTableSortModel.ColumnSortOrder<C>> columnSortOrder()Returns the current column sort order, in order of priority- Returns:
- the current column sort order, in order of priority
-
clear
void clear()Clears the sorting states from this sort model. Note that only one sorting change event will happen, with the first sort column. -
setSortingEnabled
Disabling sorting will causesetSortOrder(Object, SortOrder)
andaddSortOrder(Object, SortOrder)
to throw aIllegalStateException
for the given column.- Parameters:
columnIdentifier
- the column identifiersortingEnabled
- true if sorting should be enabled for the given column
-
isSortingEnabled
- Parameters:
columnIdentifier
- the column identifier- Returns:
- true if sorting is enabled for the given column
-
sortingChangedEvent
EventObserver<C> sortingChangedEvent()- Returns:
- an observer notified each time the sorting state changes, with the column identifier as event data
-
nextSortOrder
- Parameters:
currentSortOrder
- the current sort order- Returns:
- the next sort order
-