|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--javax.swing.table.AbstractTableModel
|
+--org.fopps.ui.EnhancedTableModel
EnhancedTableModel enables table sorting and supplies proper selection of table rows. To enable sorting you have to do the following steps
compareRowsByColumn(int, int, int) and fetch the unsorted values
compareRowsByColumn(Object, Object, int) and return the result
getValue method to privateGetValue or similar
getValue method, where you translate the row
(use translateRow to do this)
privateGetValue
addMouseListenerToHeaderInTable
| Field Summary |
| Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
| Constructor Summary | |
EnhancedTableModel()
|
|
| Method Summary | |
protected void |
checkModel()
Checks consistency of model. |
int |
compare(int row1,
int row2)
|
abstract int |
compareRowsByColumn(int row1,
int row2,
int column)
All subclasses have to overwrite this method in order to fetch the values from the unsorted array. |
int |
compareRowsByColumn(java.lang.Object o1,
java.lang.Object o2,
int column)
|
void |
fireTableDataChanged()
Notifies all listeners that all cell values in the table's rows may have changed. |
java.lang.Class |
getCellClass(int row,
int col)
Returns the class of the current cell. |
int |
getObjectColumn()
Returns the column index, which contains the representing row object. |
abstract java.lang.Object |
getRowObject(int pRow)
Returns the objects that represents the data of the whole row. |
abstract java.lang.Object |
getValueAt(int aRow,
int aColumn)
|
void |
n2sort()
|
protected void |
reallocateIndexes()
|
abstract void |
setValueAt(java.lang.Object aValue,
int aRow,
int aColumn)
|
void |
shuttlesort(int[] from,
int[] to,
int low,
int high)
|
void |
sort(java.lang.Object sender)
|
void |
sortByColumn(int column)
|
void |
sortByColumn(int column,
boolean ascending)
|
void |
swap(int i,
int j)
|
int |
translateRow(int pOriginalRow)
Translates a given row into a corresponding row which complies to the current sorting mode |
| Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.swing.table.TableModel |
getColumnCount, getRowCount |
| Constructor Detail |
public EnhancedTableModel()
| Method Detail |
public abstract int compareRowsByColumn(int row1,
int row2,
int column)
row1 - Row of the first item for comparisonrow2 - Row of the second item for comparisoncolumn - to sort by
compareRowsByColumn(int, int, int)
public int compareRowsByColumn(java.lang.Object o1,
java.lang.Object o2,
int column)
public int compare(int row1,
int row2)
public int translateRow(int pOriginalRow)
protected void reallocateIndexes()
public void fireTableDataChanged()
JTable should redraw the
table from scratch. The structure of the table (as in the order of the
columns) is assumed to be the same.
fireTableDataChanged in class javax.swing.table.AbstractTableModelTableModelEvent,
EventListenerListprotected void checkModel()
public void sort(java.lang.Object sender)
public void n2sort()
public void shuttlesort(int[] from,
int[] to,
int low,
int high)
public void swap(int i,
int j)
public void sortByColumn(int column)
public void sortByColumn(int column,
boolean ascending)
public abstract java.lang.Object getValueAt(int aRow,
int aColumn)
public abstract void setValueAt(java.lang.Object aValue,
int aRow,
int aColumn)
setValueAt in interface javax.swing.table.TableModelsetValueAt in class javax.swing.table.AbstractTableModelpublic abstract java.lang.Object getRowObject(int pRow)
public java.lang.Class getCellClass(int row,
int col)
AbstractTableModel.getColumnClass(int)public int getObjectColumn()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||