|
|||||||||
| Home >> All >> org >> progeeks >> util >> [ swing overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.progeeks.util.swing
Class SortedTableModel

java.lang.Objectjavax.swing.table.AbstractTableModel
org.progeeks.util.swing.SortedTableModel
- All Implemented Interfaces:
- java.io.Serializable, javax.swing.table.TableModel
- public class SortedTableModel
- extends javax.swing.table.AbstractTableModel
Wraps a standard table model and provides a sorted view.
- Version:
- $Revision: 1.2 $
| Nested Class Summary | |
private class |
SortedTableModel.ModelChangeListener
Listens for changes in the internal model and translates them up the chain. |
(package private) class |
SortedTableModel.TableComparator
Comparator the uses the comparison objects as indices into the unsorted view. |
| Field Summary | |
protected int[] |
indexMap
Maps incoming index values to the internal table model index values based on the current sort. |
protected javax.swing.table.TableModel |
model
The internal table model to which this model is a sorted view. |
protected int |
primarySort
The primary sort column. |
protected boolean |
reversed
Set to true if the sort ordering is reversed. |
protected int[] |
reverseMap
A reverse of the indexMap; |
protected int |
secondarySort
The secondary sort column. |
| Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
| Constructor Summary | |
SortedTableModel(javax.swing.table.TableModel model)
|
|
| Method Summary | |
java.lang.Class |
getColumnClass(int column)
Returns the Class for all Object instances
in the specified column. |
int |
getColumnCount()
Returns the number of columns in the model. |
java.lang.String |
getColumnName(int column)
Returns the name of the specified column. |
int |
getPrimarySortColumn()
|
int |
getRowCount()
Returns the number of rows in the model. |
int |
getSecondarySortColumn()
|
java.lang.Object |
getValueAt(int row,
int column)
Returns the value ( Object) at a particular cell in the
table. |
boolean |
isCellEditable(int row,
int column)
Returns true if the specified cell is editable, and
false if it is not. |
boolean |
isReversed()
|
boolean |
isSortable(int column)
|
void |
pushSortColumn(int column)
|
protected void |
resetIndexMap()
Creates a new identity mapping. |
protected boolean |
resortTable()
Recalculates the sorted view and returns true if the view has changed. |
void |
setPrimarySortColumn(int column)
|
void |
setReversed(boolean flag)
|
void |
setSecondarySortColumn(int column)
|
void |
setSortColumns(int primary,
int secondary)
|
void |
setValueAt(java.lang.Object aValue,
int row,
int column)
Sets the value of the given cell. |
int |
toRealIndex(int sorted)
Maps an index in the sorted view to an index in the real table. |
int |
toSortedIndex(int real)
Maps an index in the real table to an index in the sorted view. |
| 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 |
indexMap
protected int[] indexMap
- Maps incoming index values to the internal table
model index values based on the current sort.
reverseMap
protected int[] reverseMap
- A reverse of the indexMap;
model
protected javax.swing.table.TableModel model
- The internal table model to which this model is
a sorted view.
primarySort
protected int primarySort
- The primary sort column.
secondarySort
protected int secondarySort
- The secondary sort column.
reversed
protected boolean reversed
- Set to true if the sort ordering is reversed.
| Constructor Detail |
SortedTableModel
public SortedTableModel(javax.swing.table.TableModel model)
| Method Detail |
isSortable
public boolean isSortable(int column)
setSortColumns
public void setSortColumns(int primary,
int secondary)
pushSortColumn
public void pushSortColumn(int column)
setPrimarySortColumn
public void setPrimarySortColumn(int column)
getPrimarySortColumn
public int getPrimarySortColumn()
setSecondarySortColumn
public void setSecondarySortColumn(int column)
getSecondarySortColumn
public int getSecondarySortColumn()
setReversed
public void setReversed(boolean flag)
isReversed
public boolean isReversed()
getRowCount
public int getRowCount()
- Description copied from interface:
javax.swing.table.TableModel - Returns the number of rows in the model.
getColumnCount
public int getColumnCount()
- Description copied from interface:
javax.swing.table.TableModel - Returns the number of columns in the model.
getColumnName
public java.lang.String getColumnName(int column)
- Description copied from class:
javax.swing.table.AbstractTableModel - Returns the name of the specified column. This method generates default
names in a sequence (starting with column 0): A, B, C, ..., Z, AA, AB,
AC, ..., AZ, BA, BB, BC, and so on. Subclasses may override this method
to allow column names to be specified on some other basis.
getColumnClass
public java.lang.Class getColumnClass(int column)
- Description copied from class:
javax.swing.table.AbstractTableModel - Returns the
Classfor allObjectinstances in the specified column.
isCellEditable
public boolean isCellEditable(int row,
int column)
- Description copied from class:
javax.swing.table.AbstractTableModel - Returns
trueif the specified cell is editable, andfalseif it is not. This implementation returnsfalsefor all arguments, subclasses should override the method if necessary.
getValueAt
public java.lang.Object getValueAt(int row, int column)
- Description copied from interface:
javax.swing.table.TableModel - Returns the value (
Object) at a particular cell in the table.
setValueAt
public void setValueAt(java.lang.Object aValue, int row, int column)
- Description copied from class:
javax.swing.table.AbstractTableModel - Sets the value of the given cell. This implementation ignores all
arguments and does nothing, subclasses should override the
method if necessary.
toRealIndex
public int toRealIndex(int sorted)
- Maps an index in the sorted view to an index in the
real table.
toSortedIndex
public int toSortedIndex(int real)
- Maps an index in the real table to an index in the sorted
view.
resetIndexMap
protected void resetIndexMap()
- Creates a new identity mapping.
resortTable
protected boolean resortTable()
- Recalculates the sorted view and returns true if the view
has changed.
|
|||||||||
| Home >> All >> org >> progeeks >> util >> [ swing overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC