com.levigo.util.swing.table
Interface SortableTableModel

All Superinterfaces:
TableModel

public interface SortableTableModel
extends TableModel

Author:
Lumir Boureanu

Method Summary
 void addCriterium(int columnIndex, boolean isAscent, boolean clearExisting)
          Add a sort criterium (i.e.
 Comparable getComparableAt(int row, int col)
           
 int getSortDirection(int column)
          Return the sort direction for the given column: 0: the column is not considered for sorting 1: the column is sorted in ascending order -1: the column is sorted in descending order.
 int getSortPriority(int column)
          Get the sort priority for a given column.
 boolean isColumnSortable(TableColumn column)
          Is this column sortable?
 void resort()
          Resort the model by the criteria.
 void swapRows(int row1, int row2)
           
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt
 

Method Detail

getComparableAt

Comparable getComparableAt(int row,
                           int col)

swapRows

void swapRows(int row1,
              int row2)

addCriterium

void addCriterium(int columnIndex,
                  boolean isAscent,
                  boolean clearExisting)
Add a sort criterium (i.e. a column to sort by). The added criterium becomes the one with the highest priority.

Parameters:
columnIndex - the column index to sort after
isAscent - true: ascenden; false: descendent
clearExisting - if true: remove previous criteria; false: add to existing criteria

getSortPriority

int getSortPriority(int column)
Get the sort priority for a given column. Returns the 0-based priority or -1 if the column is not considered for sorting.

Parameters:
column -

getSortDirection

int getSortDirection(int column)
Return the sort direction for the given column:

Parameters:
column -

isColumnSortable

boolean isColumnSortable(TableColumn column)
Is this column sortable?

Parameters:
column -
Returns:
boolean

resort

void resort()
Resort the model by the criteria.



Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.