R
- the type representing a row in the table modelC
- the type representing the column identifier in the table modelpublic abstract class AbstractTableSortModel<R,C> extends java.lang.Object implements TableSortModel<R,C,javax.swing.table.TableColumn>
TableSortModel.SortingState
Constructor and Description |
---|
AbstractTableSortModel(java.util.List<javax.swing.table.TableColumn> columns)
Instantiates a new AbstractTableSortModel
|
Modifier and Type | Method and Description |
---|---|
void |
addSortingStateChangedListener(EventListener listener) |
java.util.List<javax.swing.table.TableColumn> |
getColumns() |
protected abstract java.lang.Comparable |
getComparable(R rowObject,
C columnIdentifier)
Returns a Comparable instance for the given rowObject and columnIdentifier, used when sorting
|
TableSortModel.SortingState |
getSortingState(C columnIdentifier) |
protected java.util.Comparator |
initializeColumnComparator(C columnIdentifier)
Initializes a comparator used when sorting by the give column,
the comparator receives the column values, but never null.
|
boolean |
isSortingEnabled() |
void |
setSortingDirective(C columnIdentifier,
SortingDirective directive,
boolean addColumnToSort) |
void |
sort(java.util.List<R> items)
Sorts the given list according to the sort configuration
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getColumnClass
public AbstractTableSortModel(java.util.List<javax.swing.table.TableColumn> columns)
columns
- the table columnspublic final void sort(java.util.List<R> items)
sort
in interface TableSortModel<R,C,javax.swing.table.TableColumn>
items
- the items to sortpublic final java.util.List<javax.swing.table.TableColumn> getColumns()
getColumns
in interface TableSortModel<R,C,javax.swing.table.TableColumn>
public final TableSortModel.SortingState getSortingState(C columnIdentifier)
getSortingState
in interface TableSortModel<R,C,javax.swing.table.TableColumn>
columnIdentifier
- the column identifierTableSortModel.SortingState
associated with the given columnpublic final void setSortingDirective(C columnIdentifier, SortingDirective directive, boolean addColumnToSort)
setSortingDirective
in interface TableSortModel<R,C,javax.swing.table.TableColumn>
columnIdentifier
- the identifier of the column to sort bydirective
- the sorting directiveaddColumnToSort
- if false then the sorting state is cleared, otherwise
this column is added to the sorted column set according to sorting priorityTableSortModel.getSortingState(Object)
public final boolean isSortingEnabled()
isSortingEnabled
in interface TableSortModel<R,C,javax.swing.table.TableColumn>
public final void addSortingStateChangedListener(EventListener listener)
addSortingStateChangedListener
in interface TableSortModel<R,C,javax.swing.table.TableColumn>
listener
- a listener notified each time the sorting state changesprotected abstract java.lang.Comparable getComparable(R rowObject, C columnIdentifier)
rowObject
- the object representing a given rowcolumnIdentifier
- the column identifiersort(java.util.List)
protected java.util.Comparator initializeColumnComparator(C columnIdentifier)
columnIdentifier
- the column identifier