|
||||||||||
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.commons.gui.table.TableSorter
public class TableSorter
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.xnap.commons.gui.table.SortableModel |
---|
SortableModel.Order |
Field Summary | |
---|---|
protected int |
compares
Counts number of compares. |
protected int[] |
indexes
|
protected int |
lastSortedColumn
|
protected boolean |
maintainSortOrder
|
protected int[] |
revIndexes
|
protected ArrayList<Integer> |
sortingColumns
|
protected SortableModel.Order |
sortOrder
|
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
TableSorter()
|
|
TableSorter(TableModel tableModel)
|
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. |
Class<?> |
getColumnClass(int column)
Returns the class of the data objects in column at index . |
int |
getColumnCount()
|
String |
getColumnName(int column)
|
boolean |
getMaintainSortOrder()
|
int |
getRowCount()
|
int |
getSortedColumn()
Returns the index of the column that was sorted last. |
SortableModel.Order |
getSortOrder()
|
TableModel |
getTableModel()
|
Object |
getValueAt(int row,
int column)
|
boolean |
isCellEditable(int row,
int column)
|
int |
mapToIndex(int i)
Returns the mapped row index. |
protected void |
reallocateIndexes()
|
protected void |
reallocateIndexes(TableModelEvent e)
|
void |
resort()
|
void |
setMaintainSortOrder(boolean newValue)
Sets the maintain sort order flag. |
void |
setSortOrder(SortableModel.Order newValue)
|
void |
setTableModel(TableModel tableModel)
|
void |
setValueAt(Object aValue,
int row,
int column)
|
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. |
SortableModel.Order |
sortByColumn(int column,
SortableModel.Order sortOrder,
boolean revert)
Sorts the table. |
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 |
---|
protected int[] indexes
protected int[] revIndexes
protected ArrayList<Integer> sortingColumns
protected SortableModel.Order sortOrder
protected int compares
protected int lastSortedColumn
protected boolean maintainSortOrder
Constructor Detail |
---|
public TableSorter()
public TableSorter(TableModel tableModel)
Method Detail |
---|
public TableModel getTableModel()
public int getRowCount()
getRowCount
in interface TableModel
public int getColumnCount()
getColumnCount
in interface TableModel
public String getColumnName(int column)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
public Class<?> getColumnClass(int column)
SortableModel
index
.
getColumnClass
in interface TableModel
getColumnClass
in interface SortableModel
getColumnClass
in class AbstractTableModel
public boolean isCellEditable(int row, int column)
isCellEditable
in interface TableModel
isCellEditable
in class AbstractTableModel
public Object getValueAt(int row, int column)
getValueAt
in interface TableModel
public void setValueAt(Object aValue, int row, int column)
setValueAt
in interface TableModel
setValueAt
in class AbstractTableModel
public int getSortedColumn()
SortableModel
getSortedColumn
in interface SortableModel
public SortableModel.Order getSortOrder()
getSortOrder
in interface SortableModel
public int mapToIndex(int i)
public void setMaintainSortOrder(boolean newValue)
SortableModel
setMaintainSortOrder
in interface SortableModel
public void setSortOrder(SortableModel.Order newValue)
setSortOrder
in interface SortableModel
public void setTableModel(TableModel tableModel)
public SortableModel.Order sortByColumn(int column, SortableModel.Order sortOrder, boolean revert)
sortByColumn
in interface SortableModel
column
- the column to sortsortOrder
- the sort order to sory byrevert
- 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(TableModelEvent e)
protected void reallocateIndexes()
protected boolean sort()
public boolean shuttlesort(int[] from, int[] to, int low, int high)
public boolean getMaintainSortOrder()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |