public class TableSortController<M extends TableModel> extends DefaultSortController<M>
Modifier and Type | Class and Description |
---|---|
private class |
TableSortController.TableRowSorterModelWrapper
Implementation of DefaultRowSorter.ModelWrapper that delegates to a
TableModel.
|
DefaultRowSorter.ModelWrapper<M,I>
RowSorter.SortKey
Modifier and Type | Field and Description |
---|---|
private M |
tableModel
Underlying model.
|
cachedModelRowCount, COMPARABLE_COMPARATOR
Constructor and Description |
---|
TableSortController() |
TableSortController(M model) |
Modifier and Type | Method and Description |
---|---|
Comparator<?> |
getComparator(int column)
Returns the
Comparator for the specified
column. |
void |
setModel(M model)
Sets the
TableModel to use as the underlying model
for this TableRowSorter . |
protected boolean |
useToString(int column)
Note: must implement same logic as the overridden comparator
lookup, otherwise will throw ClassCastException because
here the comparator is never null.
|
allRowsChanged, convertRowIndexToModel, convertRowIndexToView, getDefaultSortOrderCycle, getModelRowCount, getSortOrder, getSortOrderCycle, getStringValueProvider, getViewRowCount, isSortable, isSortable, modelStructureChanged, resetSortOrders, rowsDeleted, rowsInserted, setSortable, setSortable, setSortOrder, setSortOrderCycle, setStringValueProvider, toggleSortOrder
getMaxSortKeys, getModel, getModelWrapper, getRowFilter, getSortKeys, getSortsOnUpdates, rowsUpdated, rowsUpdated, setComparator, setMaxSortKeys, setModelWrapper, setRowFilter, setSortKeys, setSortsOnUpdates, sort
addRowSorterListener, fireRowSorterChanged, fireSortOrderChanged, removeRowSorterListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRowFilter, getSortsOnUpdates, setComparator, setRowFilter, setSortsOnUpdates
private M extends TableModel tableModel
public TableSortController()
public TableSortController(M model)
model
- public void setModel(M model)
TableModel
to use as the underlying model
for this TableRowSorter
. A value of null
can be used to set an empty model.model
- the underlying model to use, or null
public Comparator<?> getComparator(int column)
Comparator
for the specified
column. If a Comparator
has not been specified using
the setComparator
method a Comparator
will be returned based on the column class
(TableModel.getColumnClass
) of the specified column.
If the column class is String
,
Collator.getInstance
is returned. If the
column class implements Comparable
a private
Comparator
is returned that invokes the
compareTo
method. Otherwise
Collator.getInstance
is returned.PENDING JW: think about implications to string value lookup!
getComparator
in interface SortController<M extends TableModel>
getComparator
in class DefaultRowSorter<M extends TableModel,Integer>
column
- the column to fetch the Comparator
for, in
terms of the underlying modelComparator
for the specified columnIndexOutOfBoundsException
- if column is outside
the range of the underlying modelprotected boolean useToString(int column)
Note: must implement same logic as the overridden comparator lookup, otherwise will throw ClassCastException because here the comparator is never null.
PENDING JW: think about implications to string value lookup!
useToString
in class DefaultRowSorter<M extends TableModel,Integer>
IndexOutOfBoundsException
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses