|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.table.AbstractTableModel org.xnap.gui.table.AbstractSortableTableModel
public abstract class AbstractSortableTableModel
Field Summary | |
---|---|
protected boolean |
ascending
|
protected int |
compares
Counts number of compares. |
protected int[] |
indexes
|
protected int |
lastSortedColumn
|
protected boolean |
maintainSortOrder
|
protected int[] |
revIndexes
|
protected java.util.Vector |
sortingColumns
All columns to be sorted by. |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
AbstractSortableTableModel()
|
|
AbstractSortableTableModel(boolean maintainSortOrder)
|
Method Summary | |
---|---|
protected int |
compare(int row1,
int row2)
Compares two rows. |
protected int |
compareRowsByColumn(int row1,
int row2,
int column)
Compares two rows by a column. |
void |
fireTableChanged(javax.swing.event.TableModelEvent e)
We need to mangle these events to fire the right indicies. |
abstract java.lang.Object |
get(int aRow,
int aColumn)
|
int |
getSortedColumn()
Returns the index of the column that was sorted last. |
java.lang.Object |
getValueAt(int aRow,
int aColumn)
The mapping only affects the contents of the data rows. |
boolean |
isCellEditable(int row,
int column)
|
boolean |
isSortedAscending()
Returns true, if the table is sorted in ascending order. |
int |
mapToDtmIndex(int i)
Deprecated. |
int |
mapToIndex(int i)
Returns the mapped row index. |
void |
n2sort()
|
protected void |
reallocateIndexes()
|
protected void |
reallocateIndexes(javax.swing.event.TableModelEvent e)
|
void |
resort()
|
void |
set(java.lang.Object aValue,
int aRow,
int aColumn)
|
void |
setMaintainSortOrder(boolean newValue)
Sets the maintain sort order flag. |
void |
setSortedAscending(boolean newValue)
|
void |
setValueAt(java.lang.Object aValue,
int aRow,
int aColumn)
|
boolean |
shuttlesort(int[] from,
int[] to,
int low,
int high)
Returns false if nothing has changed. |
protected boolean |
sort()
Returns false if nothing has changed. |
boolean |
sortByColumn(int column,
boolean ascending,
boolean revert)
Sorts the table. |
protected void |
swap(int i,
int j)
|
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, 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 org.xnap.gui.table.SortableModel |
---|
getColumnClass |
Methods inherited from interface javax.swing.table.TableModel |
---|
getColumnCount, getRowCount |
Field Detail |
---|
protected int[] indexes
protected int[] revIndexes
protected java.util.Vector sortingColumns
protected boolean ascending
protected int compares
protected int lastSortedColumn
protected boolean maintainSortOrder
Constructor Detail |
---|
public AbstractSortableTableModel(boolean maintainSortOrder)
public AbstractSortableTableModel()
Method Detail |
---|
public void fireTableChanged(javax.swing.event.TableModelEvent e)
fireTableChanged
in class javax.swing.table.AbstractTableModel
public abstract java.lang.Object get(int aRow, int aColumn)
public int getSortedColumn()
SortableModel
getSortedColumn
in interface SortableModel
public java.lang.Object getValueAt(int aRow, int aColumn)
getValueAt
in interface javax.swing.table.TableModel
public boolean isSortedAscending()
SortableModel
isSortedAscending
in interface SortableModel
public boolean isCellEditable(int row, int column)
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
in class javax.swing.table.AbstractTableModel
public int mapToDtmIndex(int i)
public int mapToIndex(int i)
public void set(java.lang.Object aValue, int aRow, int aColumn)
public void setMaintainSortOrder(boolean newValue)
SortableModel
setMaintainSortOrder
in interface SortableModel
public void setSortedAscending(boolean newValue)
public void setValueAt(java.lang.Object aValue, int aRow, int aColumn)
setValueAt
in interface javax.swing.table.TableModel
setValueAt
in class javax.swing.table.AbstractTableModel
public boolean sortByColumn(int column, boolean ascending, boolean revert)
sortByColumn
in interface SortableModel
column
- the column to sortascending
- true, if table needs to be sorted in ascending order;
false, if in descending orderrevert
- automatically revert sort order
public void resort()
protected int compare(int row1, int row2)
protected int compareRowsByColumn(int row1, int row2, int column)
protected void reallocateIndexes(javax.swing.event.TableModelEvent e)
protected void reallocateIndexes()
protected boolean sort()
public boolean shuttlesort(int[] from, int[] to, int low, int high)
public void n2sort()
protected void swap(int i, int j)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |