|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
com.jaxfront.swing.ui.tools.TableMap
com.jaxfront.swing.ui.tools.TableSorter
public class TableSorter
A sorter for TableModels. The sorter has a model (conforming to TableModel) and itself implements TableModel. TableSorter does not store or copy the data in 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 sorting algorthm used is stable which means that it does not move around rows when its comparison function returns 0 to denote that they are equivalent.
Constructor Summary | |
---|---|
TableSorter(FlipOrientationTableModel model,
javax.swing.JTable table)
Default constructor. |
Method Summary | |
---|---|
void |
addMouseListenerToHeaderInTable(javax.swing.JTable table)
Adds a mouse listener to the given JTable. |
void |
checkModel()
Checks if the sorter has been informed of model changes. |
void |
domChanged(DOMChangeEvent event)
Respond method for a DOM state changed (DOMChangeEvent). |
ListType |
getListType()
Returns the list type that holds the data for the table. |
int |
getOriginalRowIndex(int index)
Returns the original row index for a sort index. |
int |
getOriginalRowIndexPos(int index)
Returns the original row index position for a sort index. |
int[] |
getSortIndexes()
Returns the sort indexes. |
java.lang.Object |
getValueAt(int aRow,
int aColumn)
|
void |
initializeIndexes()
Initializes the table indexes. |
boolean |
isFlipped()
Returns true if the table is flipped or not. |
void |
release()
Release cache and initialize variables. |
void |
setModel(FlipOrientationTableModel model)
Sets a table model. |
void |
setValueAt(java.lang.Object aValue,
int aRow,
int aColumn)
|
Methods inherited from class com.jaxfront.swing.ui.tools.TableMap |
---|
getColumnClass, getColumnCount, getColumnName, getModel, getRowCount, isCellEditable, tableChanged |
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 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TableSorter(FlipOrientationTableModel model, javax.swing.JTable table)
model
- a table model (FlipOrientationTableModel)Method Detail |
---|
public void setModel(FlipOrientationTableModel model)
TableMap
setModel
in class TableMap
model
- a table model (FlipOrientationTableModel)TableMap.setModel(com.jaxfront.core.ui.FlipOrientationTableModel)
public void initializeIndexes()
public void checkModel()
public java.lang.Object getValueAt(int aRow, int aColumn)
getValueAt
in interface javax.swing.table.TableModel
getValueAt
in class TableMap
TableModel.getValueAt(int, int)
public void setValueAt(java.lang.Object aValue, int aRow, int aColumn)
setValueAt
in interface javax.swing.table.TableModel
setValueAt
in class TableMap
TableModel.setValueAt(java.lang.Object, int, int)
public void addMouseListenerToHeaderInTable(javax.swing.JTable table)
table
- a JTablepublic int getOriginalRowIndex(int index)
index
- a sort index
public int getOriginalRowIndexPos(int index)
index
- a sort index
public void domChanged(DOMChangeEvent event)
DOMChangeListener
domChanged
in interface DOMChangeListener
event
- occured DOMChangeEventDOMChangeListener.domChanged(com.jaxfront.core.dom.DOMChangeEvent)
public int[] getSortIndexes()
public void release()
TableMap
release
in class TableMap
TableMap.release()
public ListType getListType()
public boolean isFlipped()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |