de.muntjak.tinylookandfeel.table
Interface SortableTableData


public interface SortableTableData

TableModels which want to make use of TinyLaF's table headers for sortable table data must implement this interface.

See the example implementation in de.muntjak.tinylaf.controlpanel.TinyTableModel.


Field Summary
static int SORT_ASCENDING
          value of sortingDirection property: column data sorted in ascending order
static int SORT_DESCENDING
          value of sortingDirection property: column data sorted in descending order
 
Method Summary
 boolean isColumnSortable(int column)
          Return true if the specified column is sortable, false otherwise.
 void sortColumns(int[] columns, int[] sortingDirections, javax.swing.JTable table)
          Sort the data according to the given arguments.
 boolean supportsMultiColumnSort()
          Return true if the table model supports multiple sorted columns, false otherwise.
 

Field Detail

SORT_ASCENDING

static final int SORT_ASCENDING
value of sortingDirection property: column data sorted in ascending order

See Also:
Constant Field Values

SORT_DESCENDING

static final int SORT_DESCENDING
value of sortingDirection property: column data sorted in descending order

See Also:
Constant Field Values
Method Detail

isColumnSortable

boolean isColumnSortable(int column)
Return true if the specified column is sortable, false otherwise. Non-sortable column headers will not react to mouse clicks or rollovers.

Parameters:
column - a column index
Returns:
true if the specified column is sortable, false otherwise

sortColumns

void sortColumns(int[] columns,
                 int[] sortingDirections,
                 javax.swing.JTable table)
Sort the data according to the given arguments. If argument arrays are empty, the original state of the data will be restored, if there is no original state then no action will be performed.

Note for implementors: If your data is dynamically changing you should think about storing copies of the arguments so you can re-sort data after each change. It may also be a good idea to call fireTableDataChanged() after sorting (this makes sure that the table is updated).

Parameters:
columns - array of column indices sorted by priority (highest priority first)
sortingDirections - array containing the sorting direction for each sorted column. Values are either
  • SORT_ASCENDING - sort column data in ascending order, or
  • SORT_DESCENDING - sort column data in descending order
table - the table displaying the data. Might be useful, for example, to restore selected cells after sorting.

supportsMultiColumnSort

boolean supportsMultiColumnSort()
Return true if the table model supports multiple sorted columns, false otherwise. (Supporting multi column sort makes sense only with columns containing some equal values.)

The TinyLaF user gestures concerning multi column sort are:

Returns:
true if the table model supports multiple sorted columns, false otherwise