|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.table.AbstractTableModel | +--suncertify.client.models.TableSorter
A sorter for TableModels. The sorter has a model (conforming to TableModel) and itself implements TableModel. TableSorter does not modify the TableModel, instead it maintains an array of integers which it keeps the same size as the number of rows in its model. 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 mapping only affects the contents of the data rows. Pass all requests to these rows through the mapping array: "indexes".
Constructor Summary | |
TableSorter(java.lang.Object[][] data,
java.lang.String[] columnNames)
Constructs table sorter for specified data and column headers. |
Method Summary | |
void |
addMouseListenerToHeaderInTable(javax.swing.JTable table)
Add a mouse listener to the Table to trigger a table sort when a column heading is clicked in the JTable. |
int |
getColumnCount()
Return number of columns. |
java.lang.Object |
getRecordIdForRow(int row)
Returns the recordId of the given row. |
int |
getRowCount()
Return number of rows. |
java.lang.Object |
getValueAt(int aRow,
int aColumn)
Return value of the data at a given row and column. |
void |
setData(java.lang.Object[][] data)
Sets new data set to be displayed. |
void |
tableChanged(javax.swing.event.TableModelEvent e)
Perform action requierd in case the tableModel change. |
Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TableSorter(java.lang.Object[][] data, java.lang.String[] columnNames)
data
- - the date to be placed in the table, the first column will not be displayedcolumnNames
- - column headersMethod Detail |
public void tableChanged(javax.swing.event.TableModelEvent e)
tableChanged
in interface javax.swing.event.TableModelListener
e
- event details, not used by implmentationpublic java.lang.Object getValueAt(int aRow, int aColumn)
getValueAt
in interface javax.swing.table.TableModel
aRow
- index of data's rowaColumn
- index of data's column
TableSorter.IdLessTableModel.getValueAt(int,int)
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
TableSorter.IdLessTableModel.getColumnCount()
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
TableSorter.IdLessTableModel.getRowCount()
public void setData(java.lang.Object[][] data)
data
- - new data settableChanged(TableModelEvent)
,
TableSorter.IdLessTableModel.setData(Object[][])
public java.lang.Object getRecordIdForRow(int row)
row
- the index of the row
public void addMouseListenerToHeaderInTable(javax.swing.JTable table)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |