|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nextapp.echo.table.AbstractTableModel echopoint.table.TableModelAdapter echopoint.table.SortableTableModel
A sorter of TableModels.
The sorter has a model (conforming to TableModel) and itself implements TableModel. TableSorter does not store or copy the data in the TableModel, instead it maintains an array of integers which it keeps the same size as the number of rows in its model.
This class uses a Comparator to sort the data. The DefaultSortableTableModel comparator is used by default, which can sort Java basisc types as well as some Echo Components.
When the model changes, it notifies the sorter that something has changed eg. "rowsAdded" so that its internal array of integers can be reallocated. As requests are made of the sorter (like getValueAt(row, col) it redirects them to its model via the mapping array. That way the TableSorter appears to hold another copy of the table with the rows in a different order.
The sorting algorthm used is stable which means that it does not move rows around when the Comparator returns 0 to denote that they are equivalent.
Field Summary | |
static int |
DOWN
|
static int |
NONE
allowable states for a column |
static int |
UP
|
Fields inherited from class echopoint.table.TableModelAdapter |
model |
Fields inherited from class nextapp.echo.table.AbstractTableModel |
listenerList |
Constructor Summary | |
SortableTableModel()
SortableTableModel constructor |
|
SortableTableModel(nextapp.echo.table.TableModel model)
SortableTableModel constructor that wraps the given TableModel. |
Method Summary | |
int |
getColumnSortingState(int col)
This method returns the state of a given column and whether it is being sorted UP, DOWN or NONE. |
java.util.Comparator |
getComparator()
Returns the Comparator that will be used to sort the TableModel |
int |
getModelRowIndex(int row)
This returns the "sorted" table model row index for a given "visual" table row index. |
java.lang.Object |
getValueAt(int col,
int row)
Returns the "sorted" value at the given column and row. |
void |
setComparator(java.util.Comparator newComparator)
Sets the Comparator that will be used to sort the TableModel |
void |
setModel(nextapp.echo.table.TableModel model)
Sets the model wrapped by this SortableTableModel. |
void |
sortByColumn(int column)
Sorts the model by the given column, in ascending order. |
void |
sortByColumn(int column,
boolean ascending)
Sorts the model by the given column, with the given ordering |
void |
tableChanged(nextapp.echo.event.TableModelEvent e)
Implementation of TableModelListener |
Methods inherited from class echopoint.table.TableModelAdapter |
deleteRow, getColumnClass, getColumnCount, getColumnName, getModel, getRowCount, insertRow |
Methods inherited from class nextapp.echo.table.AbstractTableModel |
addTableModelListener, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, removeTableModelListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DOWN
public static final int NONE
public static final int UP
Constructor Detail |
public SortableTableModel()
public SortableTableModel(nextapp.echo.table.TableModel model)
Method Detail |
public int getColumnSortingState(int col)
public java.util.Comparator getComparator()
public int getModelRowIndex(int row)
public java.lang.Object getValueAt(int col, int row)
getValueAt
in interface nextapp.echo.table.TableModel
getValueAt
in class TableModelAdapter
TableModel
public void setComparator(java.util.Comparator newComparator)
newComparator
- java.util.Comparatorpublic void setModel(nextapp.echo.table.TableModel model)
setModel
in class TableModelAdapter
TableModel
public void sortByColumn(int column)
public void sortByColumn(int column, boolean ascending)
public void tableChanged(nextapp.echo.event.TableModelEvent e)
tableChanged
in interface nextapp.echo.event.TableModelListener
tableChanged
in class TableModelAdapter
TableModel
|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |