|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.qfs.lib.gui.DefaultTableModelSorter
A default implementation of the TableModelSorter interface.
The column class of the sort column determines the comparison for the rows. String columns are compared via a Collator, Comparable's via the Comparable interface and the rest via a Collator on their toString values.
Field Summary | |
protected boolean |
ascending
Whether sort order is ascending or descending. |
protected boolean |
autoAscending
Whether setting of the column determines ascending order. |
protected int |
column
The column to sort on. |
protected java.lang.String |
configurableName
The configuration name. |
protected java.util.List |
listeners
The TableModelSorterListeners. |
Constructor Summary | |
DefaultTableModelSorter()
Create a new DefaultTableModelSorter. |
|
DefaultTableModelSorter(java.lang.String name)
Create a new DefaultTableModelSorter. |
Method Summary | |
void |
addTableModelSorterListener(TableModelSorterListener listener)
Add a TableModelSorterListener to the TableModelSorter. |
int |
compare(javax.swing.table.TableModel model,
int idx1,
int idx2)
Compare two rows of the table. |
protected void |
fireSortOrderChanged(TableModelSorterEvent e)
Notify the listeners of a change in the sort order. |
java.lang.String |
getConfigurableName()
Get the DefaultTableModelSorter's configuration name. |
java.util.Properties |
getConfigurableState()
Get the DefaultTableModelSorter's configurable state. |
int |
getSortColumn()
Get the column being sorted on. |
boolean |
isAutoAscending()
Query whether autoAscending is turned on. |
boolean |
isSortAscending()
Query whether the rows are sorted in ascending order. |
void |
registrationChanged(Configuration config,
java.lang.String name,
boolean registered,
boolean valuesKept)
This callback is used to notify the Configurable whenever it is registered with or unregistered from the Configuration, so it can decide whether to notify the Configuration when its state changes. |
void |
removeTableModelSorterListener(TableModelSorterListener listener)
Remove a TableModelSorterListener from the TableModelSorter. |
void |
setAutoAscending(boolean auto)
If autoAscending is set to true (the default), the sort order is determined by setSortColumn . |
void |
setConfigurableName(java.lang.String name)
Set the DefaultTableModelSorter's configuration name. |
void |
setConfigurableState(java.util.Properties state)
Set the DefaultTableModelSorter's configurable state. |
void |
setSortAscending(boolean ascending)
Define whether the rows should be sorted in ascending or descending order. |
void |
setSortColumn(int column)
Set the column to sort in model coordinates. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.List listeners
protected int column
protected boolean ascending
protected boolean autoAscending
protected java.lang.String configurableName
Constructor Detail |
public DefaultTableModelSorter()
public DefaultTableModelSorter(java.lang.String name)
name
- The Configurable
name of the
DefaultTableModelSorter.Method Detail |
public final void setSortColumn(int column)
autoAscending
is turned on ascending or descending
order will be determined as follows:
setSortColumn
in interface TableModelSorter
column
- The column to sort on. -1 means no order.setAutoAscending(boolean)
public final int getSortColumn()
getSortColumn
in interface TableModelSorter
public final void setSortAscending(boolean ascending)
setSortAscending
in interface TableModelSorter
ascending
- True for ascending order.public final boolean isSortAscending()
isSortAscending
in interface TableModelSorter
public final void setAutoAscending(boolean auto)
setSortColumn
. Otherwise sort
order has to be set explicitly through setSortAscending
.auto
- True for autoAscending.public final boolean isAutoAscending()
public int compare(javax.swing.table.TableModel model, int idx1, int idx2)
compare
in interface TableModelSorter
model
- The original TableModel.idx1
- Index of the first row.idx2
- Index of the second row.public void addTableModelSorterListener(TableModelSorterListener listener)
addTableModelSorterListener
in interface TableModelSorter
listener
- The TableModelSorterListener to add.public void removeTableModelSorterListener(TableModelSorterListener listener)
removeTableModelSorterListener
in interface TableModelSorter
listener
- The TableModelSorterListener to remove.protected void fireSortOrderChanged(TableModelSorterEvent e)
e
- The event containing the details.public final java.lang.String getConfigurableName()
getConfigurableName
in interface Configurable
public final void setConfigurableName(java.lang.String name)
setConfigurableName
in interface Configurable
name
- The name to set.public java.util.Properties getConfigurableState()
getConfigurableState
in interface Configurable
public void setConfigurableState(java.util.Properties state)
setConfigurableState
in interface Configurable
state
- The state to set.public void registrationChanged(Configuration config, java.lang.String name, boolean registered, boolean valuesKept)
registrationChanged
in interface Configurable
config
- The affected Configuration.name
- The registration name of the Configurable which may
be different from the Configurable's name.registered
- True if the Configurable was just registered,
false if it was unregistered.valuesKept
- Whether the Configurable's values were kept, if
it was just unregistered.
|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |