Package rma.swing.table
Class RmaTableSorter
java.lang.Object
javax.swing.table.AbstractTableModel
rma.swing.table.AbstractRmaTableModel
rma.swing.RmaTableMap
rma.swing.table.RmaTableSorter
- All Implemented Interfaces:
Serializable
,EventListener
,TableModelListener
,TableModel
,RmaTableModelInterface
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The constant for an ascending sort.static final int
The constant for a descending sort.static final int
The constant for a sort that flip-flops between ascending and descending.protected int[]
Fields inherited from class rma.swing.RmaTableMap
model
Fields inherited from class rma.swing.table.AbstractRmaTableModel
m_columnNames, m_displayUnitSystem, m_gmtOffset, m_unitSystem
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
Fields inherited from interface rma.swing.table.RmaTableModelInterface
UNDEF_COLUMN_PARAM_ID
-
Constructor Summary
ConstructorsConstructorDescriptionRmaTableSorter
(TableModel model) RmaTableSorter
(TableModel model, int sortType) Constructs a RmaTableSorter around the TableModel with a defined Sorting Type. -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
Returns the boolean for ascending.void
int
compare
(int row1, int row2) int
compareRowsByColumn
(int row1, int row2, int column) int
getMappedRow
(int tableRow) Returns the mapped row for a specific table row.getValueAt
(int aRow, int aColumn) Returns the value at a given row/column location.boolean
isCellEditable
(int aRow, int column) void
n2sort()
void
void
setModel
(TableModel model) void
setSortingType
(int sortingType) Sets the Sorting Type to the arg int.void
setValueAt
(Object aValue, int aRow, int aColumn) void
shuttlesort
(int[] from, int[] to, int low, int high) void
void
sortByColumn
(int column) void
sortByColumn
(int column, boolean ascending) void
swap
(int i, int j) void
Methods inherited from class rma.swing.RmaTableMap
getColumnClass, getColumnCount, getColumnName, getModel, getRowCount
Methods inherited from class rma.swing.table.AbstractRmaTableModel
addColumn, addColumn, addRow, clearAll, deleteRow, getColumnParameter, getDataVector, getDisplayUnitSystem, getGmtOffset, getRow, getUnitSystem, insertRow, insertRows, resetRowEnabled, setColEnabled, setColumnClass, setColumnNames, setColumnNames, setColumnParameters, setDisplayUnitsSystem, setRowEnabled, setUnitSystem
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
Methods inherited from interface rma.swing.table.RmaTableModelInterface
setCellEnabled
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, removeTableModelListener
-
Field Details
-
indexes
protected int[] indexes -
ASCENDING
public static final int ASCENDINGThe constant for an ascending sort.- See Also:
-
DESCENDING
public static final int DESCENDINGThe constant for a descending sort.- See Also:
-
FLIPFLOP
public static final int FLIPFLOPThe constant for a sort that flip-flops between ascending and descending.- See Also:
-
-
Constructor Details
-
RmaTableSorter
public RmaTableSorter() -
RmaTableSorter
-
RmaTableSorter
Constructs a RmaTableSorter around the TableModel with a defined Sorting Type.
-
-
Method Details
-
setSortingType
public void setSortingType(int sortingType) Sets the Sorting Type to the arg int. Use the class defined constants. -
ascending
public boolean ascending()Returns the boolean for ascending. -
setModel
- Overrides:
setModel
in classRmaTableMap
-
compareRowsByColumn
public int compareRowsByColumn(int row1, int row2, int column) -
compare
public int compare(int row1, int row2) -
reallocateIndexes
public void reallocateIndexes() -
tableChanged
- Specified by:
tableChanged
in interfaceTableModelListener
- Overrides:
tableChanged
in classRmaTableMap
-
checkModel
public void checkModel() -
sort
-
n2sort
public void n2sort() -
shuttlesort
public void shuttlesort(int[] from, int[] to, int low, int high) -
swap
public void swap(int i, int j) -
getMappedRow
public int getMappedRow(int tableRow) Returns the mapped row for a specific table row.- Parameters:
tableRow
-- Returns:
-
getValueAt
Description copied from class:AbstractRmaTableModel
Returns the value at a given row/column location. The default method returns null. Needs to be overrridden- Specified by:
getValueAt
in interfaceTableModel
- Overrides:
getValueAt
in classRmaTableMap
- Parameters:
aRow
- the row to look for the value in.aColumn
- the column to look for the value in.
-
setValueAt
- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classRmaTableMap
-
isCellEditable
public boolean isCellEditable(int aRow, int column) - Specified by:
isCellEditable
in interfaceTableModel
- Overrides:
isCellEditable
in classRmaTableMap
-
sortByColumn
public void sortByColumn(int column) -
sortByColumn
public void sortByColumn(int column, boolean ascending) -
getSortingColumns
-
addMouseListenerToHeaderInTable
-