|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.RowSorter<M>
javax.swing.DefaultRowSorter<M,java.lang.Integer>
org.jdesktop.swingx.sort.DefaultSortController<M>
org.jdesktop.swingx.sort.TableSortController<M>
public class TableSortController<M extends javax.swing.table.TableModel>
A SortController to use for a JXTable.
PENDING JW: should move up to DefaultRowSorter for re-use in ListRowSorter, but as long as we don't have the latter ...
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.DefaultRowSorter |
---|
javax.swing.DefaultRowSorter.ModelWrapper<M,I> |
Nested classes/interfaces inherited from class javax.swing.RowSorter |
---|
javax.swing.RowSorter.SortKey |
Field Summary |
---|
Fields inherited from class org.jdesktop.swingx.sort.DefaultSortController |
---|
COMPARABLE_COMPARATOR |
Constructor Summary | |
---|---|
TableSortController()
|
|
TableSortController(M model)
|
Method Summary | |
---|---|
java.util.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)
|
Methods inherited from class org.jdesktop.swingx.sort.DefaultSortController |
---|
getDefaultSortOrderCycle, getSortOrder, getSortOrderCycle, getStringValueProvider, isSortable, isSortable, resetSortOrders, setSortable, setSortable, setSortOrder, setSortOrderCycle, setStringValueProvider, toggleSortOrder |
Methods inherited from class javax.swing.DefaultRowSorter |
---|
allRowsChanged, convertRowIndexToModel, convertRowIndexToView, getMaxSortKeys, getModel, getModelRowCount, getModelWrapper, getRowFilter, getSortKeys, getSortsOnUpdates, getViewRowCount, modelStructureChanged, rowsDeleted, rowsInserted, rowsUpdated, rowsUpdated, setComparator, setMaxSortKeys, setModelWrapper, setRowFilter, setSortKeys, setSortsOnUpdates, sort |
Methods inherited from class javax.swing.RowSorter |
---|
addRowSorterListener, fireRowSorterChanged, fireSortOrderChanged, removeRowSorterListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jdesktop.swingx.sort.SortController |
---|
getRowFilter, getSortsOnUpdates, setComparator, setRowFilter, setSortsOnUpdates |
Constructor Detail |
---|
public TableSortController()
public TableSortController(M model)
model
- Method Detail |
---|
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 java.util.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 javax.swing.table.TableModel>
getComparator
in class javax.swing.DefaultRowSorter<M extends javax.swing.table.TableModel,java.lang.Integer>
column
- the column to fetch the Comparator
for, in
terms of the underlying model
Comparator
for the specified column
java.lang.IndexOutOfBoundsException
- 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 javax.swing.DefaultRowSorter<M extends javax.swing.table.TableModel,java.lang.Integer>
java.lang.IndexOutOfBoundsException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |