|
|||||||||
| Home >> All >> javatools >> swing >> [ table overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
javatools.swing.table
Class IndexedTableSorter

java.lang.Objectjavax.swing.table.AbstractTableModel
javatools.swing.table.IndexedTableMap
javatools.swing.table.IndexedTableSorter
- All Implemented Interfaces:
- java.util.EventListener, java.io.Serializable, javax.swing.table.TableModel, javax.swing.event.TableModelListener
- public class IndexedTableSorter
- extends IndexedTableMap
It seems a table, it is a table sorter for indexed tables. Based upon the sorter in the Java tutorial.
- Version:
- 0.1.7
| Field Summary | |
protected boolean |
ascending
true: ascending order;
false: descending order. |
protected int |
compares
Contains the number of made comparisons. |
protected int[] |
indexes
The indexes to use for correct order. |
protected int |
lastSortedColumn
Contains the last sorted column to alternate ascending and descending order. |
protected boolean |
lastSortingDirection
Contains the last sorting direction, to alternate ascending and descending order. |
protected java.util.Vector |
sortingColumns
Contains the columns to use to sort. |
| Fields inherited from class javatools.swing.table.IndexedTableMap |
model |
| Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
| Constructor Summary | |
IndexedTableSorter()
Creates new IndexedTableSorter |
|
IndexedTableSorter(IndexedTableModel model)
Creates a new IndexedTableSorter. |
|
| Method Summary | |
void |
addMouseListenerToHeaderInTable(javax.swing.JTable table)
Method used to add a mouse listener to catch click on table headers. |
void |
checkModel()
Checks if the model is OK. |
int |
compare(int row1,
int row2)
Compares two columns. |
int |
compareRowsByColumn(int row1,
int row2,
int column)
Compares two rows by a column. |
java.lang.Object |
getIndex(int row)
Returns the index. |
java.lang.Object |
getValueAt(int aRow,
int aColumn)
Returns the value in a certain position. |
void |
n2sort()
Sorts 2 items. |
void |
reallocateIndexes()
Initializes indexes. |
void |
removeRow(int row)
Removes a row. |
void |
setIndex(int row,
java.lang.Object index)
Sets an index. |
void |
setModel(IndexedTableModel model)
Sets the table model to sort. |
void |
setValueAt(java.lang.Object aValue,
int aRow,
int aColumn)
Sets a value in the table. |
void |
shuttlesort(int[] from,
int[] to,
int low,
int high)
Sorts using shuttlesort. |
void |
sort(java.lang.Object sender)
Sorts the table. |
void |
sortByColumn(int column)
Sorts the table by a column. |
void |
sortByColumn(int column,
boolean ascending)
Sorts the table by column. |
void |
swap(int i,
int j)
Swaps (logically) two rows. |
void |
tableChanged(javax.swing.event.TableModelEvent e)
Method that is called whenever the table changes. |
| Methods inherited from class javatools.swing.table.IndexedTableMap |
getColumnClass, getColumnCount, getColumnName, getModel, getRowCount, isCellEditable |
| Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
indexes
protected int[] indexes
- The indexes to use for correct order.
sortingColumns
protected java.util.Vector sortingColumns
- Contains the columns to use to sort.
ascending
protected boolean ascending
true: ascending order;false: descending order.
compares
protected int compares
- Contains the number of made comparisons.
lastSortedColumn
protected int lastSortedColumn
- Contains the last sorted column to alternate ascending and descending order.
lastSortingDirection
protected boolean lastSortingDirection
- Contains the last sorting direction, to alternate ascending and descending
order.
| Constructor Detail |
IndexedTableSorter
public IndexedTableSorter()
- Creates new IndexedTableSorter
IndexedTableSorter
public IndexedTableSorter(IndexedTableModel model)
- Creates a new IndexedTableSorter.
| Method Detail |
setModel
public void setModel(IndexedTableModel model)
- Sets the table model to sort.
- Overrides:
setModelin classIndexedTableMap
compareRowsByColumn
public int compareRowsByColumn(int row1,
int row2,
int column)
- Compares two rows by a column.
compare
public int compare(int row1,
int row2)
- Compares two columns.
reallocateIndexes
public void reallocateIndexes()
- Initializes indexes.
tableChanged
public void tableChanged(javax.swing.event.TableModelEvent e)
- Method that is called whenever the table changes.
- Specified by:
tableChangedin interfacejavax.swing.event.TableModelListener- Overrides:
tableChangedin classIndexedTableMap
checkModel
public void checkModel()
- Checks if the model is OK.
sort
public void sort(java.lang.Object sender)
- Sorts the table.
n2sort
public void n2sort()
- Sorts 2 items.
shuttlesort
public void shuttlesort(int[] from,
int[] to,
int low,
int high)
- Sorts using shuttlesort.
swap
public void swap(int i,
int j)
- Swaps (logically) two rows.
getValueAt
public java.lang.Object getValueAt(int aRow, int aColumn)
- Returns the value in a certain position.
- Specified by:
getValueAtin interfacejavax.swing.table.TableModel- Overrides:
getValueAtin classIndexedTableMap
getIndex
public java.lang.Object getIndex(int row) throws java.lang.ArrayIndexOutOfBoundsException
- Returns the index.
- Overrides:
getIndexin classIndexedTableMap
setValueAt
public void setValueAt(java.lang.Object aValue, int aRow, int aColumn)
- Sets a value in the table.
- Specified by:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin classIndexedTableMap
setIndex
public void setIndex(int row,
java.lang.Object index)
throws java.lang.ArrayIndexOutOfBoundsException
- Sets an index.
- Overrides:
setIndexin classIndexedTableMap
removeRow
public void removeRow(int row)
- Removes a row.
sortByColumn
public void sortByColumn(int column)
- Sorts the table by a column.
sortByColumn
public void sortByColumn(int column,
boolean ascending)
- Sorts the table by column.
addMouseListenerToHeaderInTable
public void addMouseListenerToHeaderInTable(javax.swing.JTable table)
- Method used to add a mouse listener to catch click on table headers.
|
|||||||||
| Home >> All >> javatools >> swing >> [ table overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC