|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
org.jcreme.swing.table.AbstractSortableTableModel
This class is an abstract implementation of the SortableTableModel interface. Some of the features are inspired from the Java Tutorial TableSorter.java sample. The concrete sub classes of this class can implement either of two schemes: the data manipulator scheme described in the tutorial, the usual scheme to create a direct subclass of this one. This class does not specify how the resort is handled. It could be through the TableChangeEvents or through any other scheme.
| Field Summary |
| Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
| Constructor Summary | |
AbstractSortableTableModel()
|
|
| Method Summary | |
protected int |
compare(int row1,
int row2)
Compares two rows using the sortingColumns to determine which columns (and in which order) are to be used in the sort. |
int |
compareRowsByColumn(int row1,
int row2,
int column)
This method enables to compare the values of a column for two different rows. |
int |
getOriginalRow(int row)
Enables to find a row number in the original model. |
protected abstract java.lang.Object |
getOriginalValueAt(int row,
int column)
This method returns the value at the original (non sorted) row. |
protected SortableTableColumn[] |
getSortingColumns()
Provides access to the columns used for sorting. |
java.lang.Object |
getValueAt(int row,
int column)
|
protected void |
initConverterArray()
This method enables to ensure that the conversion array is big enough. |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
|
protected abstract boolean |
isOriginalCellEditable(int row,
int column)
This method enables to determine if the value at the original (non sorted) row can be modified. |
protected int[][] |
originalIntervalToSortedIntervals(int originalStart,
int originalEnd)
This method enables to transform an interval of rows in the original data into a set of intervals in the sorted data. |
protected abstract void |
setOriginalValueAt(java.lang.Object value,
int row,
int column)
This method enables to change the value at the original (non sorted) row. |
void |
setValueAt(java.lang.Object value,
int row,
int column)
|
protected void |
shuttleSort(int[] from,
int[] to,
int low,
int high)
|
void |
sort(SortableTableColumn[] columns)
Sorts the TableModel using the columns given in the columns parameter in the order given in columns. |
| Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, 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 |
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, removeTableModelListener |
| Constructor Detail |
public AbstractSortableTableModel()
| Method Detail |
public java.lang.Object getValueAt(int row,
int column)
getValueAt in interface javax.swing.table.TableModelTableModel.getValueAt(int, int)
public void setValueAt(java.lang.Object value,
int row,
int column)
setValueAt in interface javax.swing.table.TableModelTableModel.setValueAt(java.lang.Object, int, int)public int getOriginalRow(int row)
row - the row as presented after sorting.
protected abstract java.lang.Object getOriginalValueAt(int row,
int column)
row - the row number in the original model.column - the column in the model.
protected abstract void setOriginalValueAt(java.lang.Object value,
int row,
int column)
value - the value to set these coordinates in the original model.row - the row number in the original model.column - the column in the model.public void sort(SortableTableColumn[] columns)
sort in interface SortableTableModelcolumns - the columns used to sort the table in the order they will be
used.
protected void shuttleSort(int[] from,
int[] to,
int low,
int high)
protected int compare(int row1,
int row2)
row1 - the index of the first row.row2 - the index of the second row.
public int compareRowsByColumn(int row1,
int row2,
int column)
row1 - the reference row.row2 - the compared row.column - the column of comparison.
protected void initConverterArray()
protected int[][] originalIntervalToSortedIntervals(int originalStart,
int originalEnd)
originalStart - the row number of the start of the interval.originalEnd - the row number of the end of the interval.
public boolean isCellEditable(int rowIndex,
int columnIndex)
isCellEditable in interface javax.swing.table.TableModelTableModel.isCellEditable(int, int)
protected abstract boolean isOriginalCellEditable(int row,
int column)
row - the row number in the original model.column - the column in the model.
protected SortableTableColumn[] getSortingColumns()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||