|
||||||||||
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>
public abstract class DefaultSortController<M>
A SortController to use for a JXTable.
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 | |
---|---|
static java.util.Comparator |
COMPARABLE_COMPARATOR
Comparator that uses compareTo on the contents. |
Constructor Summary | |
---|---|
DefaultSortController()
|
Method Summary | |
---|---|
static javax.swing.SortOrder[] |
getDefaultSortOrderCycle()
Returns the default cycle. |
javax.swing.SortOrder |
getSortOrder(int column)
Returns the sort order of the specified column. |
javax.swing.SortOrder[] |
getSortOrderCycle()
Returns the cycle of sort orders to cycle through. |
StringValueProvider |
getStringValueProvider()
Returns the registry of string values. |
boolean |
isSortable()
Returns true if this controller is sortable; otherwise, false. |
boolean |
isSortable(int column)
Returns true if the specified column is sortable. |
void |
resetSortOrders()
Resets all interactive sorting. |
void |
setSortable(boolean sortable)
Sets whether or not this controller is sortable. |
void |
setSortable(int column,
boolean sortable)
Sets whether or not the specified column is sortable. |
void |
setSortOrder(int column,
javax.swing.SortOrder sortOrder)
Sets the sort order of the specified column. |
void |
setSortOrderCycle(javax.swing.SortOrder... cycle)
Sets the cycle of sort ordes to toggle through. |
void |
setStringValueProvider(StringValueProvider registry)
Sets the registry of string values. |
void |
toggleSortOrder(int column)
Reverses the sort order of the specified column. |
Methods inherited from class javax.swing.DefaultRowSorter |
---|
allRowsChanged, convertRowIndexToModel, convertRowIndexToView, getComparator, getMaxSortKeys, getModel, getModelRowCount, getModelWrapper, getRowFilter, getSortKeys, getSortsOnUpdates, getViewRowCount, modelStructureChanged, rowsDeleted, rowsInserted, rowsUpdated, rowsUpdated, setComparator, setMaxSortKeys, setModelWrapper, setRowFilter, setSortKeys, setSortsOnUpdates, sort, useToString |
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 |
---|
getComparator, getRowFilter, getSortsOnUpdates, setComparator, setRowFilter, setSortsOnUpdates |
Field Detail |
---|
public static final java.util.Comparator COMPARABLE_COMPARATOR
Constructor Detail |
---|
public DefaultSortController()
Method Detail |
---|
public void setSortable(boolean sortable)
The default is true.
PENDING JW: define behaviour if sortable is disabled while has sortOrders. In this case JXTable resets all sorts.
setSortable
in interface SortController<M>
sortable
- whether or not this controller is sortableSortController.isSortable()
public boolean isSortable()
isSortable
in interface SortController<M>
SortController.isSortable()
public void setSortable(int column, boolean sortable)
The default is true.
PENDING JW: define behaviour if sortable is disabled while has sortOrders. In this case JXTable removes the sort of the column.
PENDING JW: decide whether or not this method should trigger a resort DefaultRowSorter explicitly doesn't, JXTable does.
setSortable
in interface SortController<M>
setSortable
in class javax.swing.DefaultRowSorter<M,java.lang.Integer>
column
- the column to enable or disable sorting on, in terms
of the underlying modelsortable
- whether or not the specified column is sortableSortController.isSortable(int)
,
SortController.toggleSortOrder(int)
,
SortController.setSortOrder(int, SortOrder)
public boolean isSortable(int column)
This returns true if both the controller's sortable property and the column's sortable property is true. Returns false if any of them is false.
isSortable
in interface SortController<M>
isSortable
in class javax.swing.DefaultRowSorter<M,java.lang.Integer>
column
- the column to check sorting for, in terms of the
underlying model
SortController.isSortable(int)
public void toggleSortOrder(int column)
Implementations must respect the per-controller and per-column-sortable property.
Overridden - that is completely new implementation - to get first/next SortOrder from sort order cycle. Does nothing if the cycle is empty.
toggleSortOrder
in interface SortController<M>
toggleSortOrder
in class javax.swing.DefaultRowSorter<M,java.lang.Integer>
column
- the model index of the column to toggleSortController.isSortable(int)
,
SortController.isSortable()
public void setSortOrder(int column, javax.swing.SortOrder sortOrder)
Implementations must respect the per-controller and per-column-sortable property.
PENDING JW: toggle has two effects: makes the column the primary sort column, and cycle through. So here we something similar. Should we?
setSortOrder
in interface SortController<M>
column
- the model index of the column to setsortOrder
- the SortOrder to set for the columnSortController.isSortable(int)
,
SortController.isSortable()
public javax.swing.SortOrder getSortOrder(int column)
getSortOrder
in interface SortController<M>
SortOrder.ASCENDING
,
SortOrder.DESCENDING
or SortOrder.UNSORTED
.public void resetSortOrders()
Implementations must respect the per-controller and per-column-sortable property.
resetSortOrders
in interface SortController<M>
public javax.swing.SortOrder[] getSortOrderCycle()
getSortOrderCycle
in interface SortController<M>
public void setSortOrderCycle(javax.swing.SortOrder... cycle)
setSortOrderCycle
in interface SortController<M>
cycle
- the SortOrders to cycle through, may be emptypublic void setStringValueProvider(StringValueProvider registry)
setStringValueProvider
in interface SortController<M>
registry
- the registry to get StringValues for conversion.public StringValueProvider getStringValueProvider()
getStringValueProvider
in interface SortController<M>
public static javax.swing.SortOrder[] getDefaultSortOrderCycle()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |