|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface SortableTableModel
A row-sortable TableModel where sorting is managed by translating between two sets of indices, an index set identifying the table entries (entries) and another index set representing the current position of an entry in the table (rows).
All TableModel methods accept and return
rows because this is what the associated JTables need. If one wants
to access the same entry in two SortableTableModels the row numbers
have to be transformed accordingly. E. g.
this.setValueAt(anotherSTM.getValueAt(anotherSTM.getRows(getEntries(row)),col), row, col)
| Field Summary | |
|---|---|
static int |
ASCENDING
Constant for ascending sort order |
static int |
DESCENDING
Constant for descending sort order |
| Method Summary | |
|---|---|
int |
getEntries(int row)
Gets the entry represented by the specified row in the current sorting. |
int[] |
getEntries(int[] rows)
Gets the entries represented by the specified rows in the current sorting. |
int |
getRows(int entry)
Gets the current row number of an entry. |
int[] |
getRows(int[] entries)
Gets the current row numbers for a list of entries. |
int |
getSortingColumn()
Gets the column with top sorting precedence. |
int[][] |
getSortOrder()
Gets the columns by which this table is sorted. |
boolean |
isSorted()
Returns whether the model is currently sorted or not. |
void |
randomize()
Shuffles the entries in this TableModel. |
void |
setSortBy(int col)
Sets the column with top sorting precedence. |
void |
setSortBy(int col,
boolean asc)
Sets the column with top sorting precedence and the way it is to be sorted. |
void |
sort()
Sorts the entries in this TableModel according to the criteria set by setSortBy(int, boolean). |
| Methods inherited from interface javax.swing.table.TableModel |
|---|
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt |
| Field Detail |
|---|
static final int ASCENDING
static final int DESCENDING
| Method Detail |
|---|
void sort()
setSortBy(int, boolean).
void randomize()
void setSortBy(int col,
boolean asc)
col - the table columnasc - true for ascending ordervoid setSortBy(int col)
col is
already the column with top sorting precedence the sort order will
be reversed, otherwise the entries in this model will be sorted in
ascending order.Implementations can but do not need to remember previous calls to this method to determine what to do when two entries have equal fields in this column.
col - the table columnsetSortBy(int, boolean)int getSortingColumn()
boolean isSorted()
int[][] getSortOrder()
ASCENDING or DESCENDING.
int getRows(int entry)
int[] getRows(int[] entries)
int getEntries(int row)
int[] getEntries(int[] rows)
|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||