Package rma.swing
Class RmaJTableSorter
java.lang.Object
javax.swing.table.AbstractTableModel
rma.swing.table.AbstractRmaTableModel
rma.swing.RmaTableMap
rma.swing.RmaJTableSorter
- 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.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
ConstructorsConstructorDescriptionRmaJTableSorter
(RmaTableModelInterface model, int sortType) Constructs a RmaTableSorter around the TableModel with a defined Sorting Type. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add a column to the table with the header colNamevoid
add a column to the table with header columnName and data ColumnDatavoid
void
add a row to the table with data in the Vector newRowboolean
Returns the boolean for ascending.void
void
clearAll()
remove all data from the tableint
compare
(int row1, int row2) int
compareRowsByColumn
(int row1, int row2, int column) int
convertRowToModelRow
(int row) void
deleteRow
(int index) remove the row at index from the modelint
getColumnParameter
(int col) Returns the parameter for a given column.return the table data in a vectorint
Returns the GmtOffset that the data is in.int
getMappedRow
(int tableRow) Returns the mapped row for a specific table row.getRow
(int rowNum) get the row of data at rowNum and return in a Vectorint
getValueAt
(int aRow, int aColumn) Returns the value at a given row/column location.void
insert a row in the table at Row row with data rowDataboolean
isSorted()
void
n2sort()
void
void
clear the editableRows listvoid
setColEnabled
(boolean enabled, int col) the the Column col enabled or disabledvoid
setColumnClass
(int col, Class cls) set the column col's class to be clsvoid
setColumnNames
(String[] colNames) void
setColumnNames
(Vector colNamesVector) void
setColumnParameters
(int[] params) void
setModel
(RmaTableModelInterface model) void
setRowEnabled
(boolean enabled, int row) set the Row row enabled or disabledvoid
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, isCellEditable, setModel
Methods inherited from class rma.swing.table.AbstractRmaTableModel
getDisplayUnitSystem, insertRows, setDisplayUnitsSystem, 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
insertRows, setCellEnabled, setDisplayUnitsSystem
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, isCellEditable, removeTableModelListener
-
Field Details
-
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
-
RmaJTableSorter
public RmaJTableSorter() -
RmaJTableSorter
-
RmaJTableSorter
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. -
getMappedRow
public int getMappedRow(int tableRow) Returns the mapped row for a specific table row.- Parameters:
tableRow
-- Returns:
-
ascending
public boolean ascending()Returns the boolean for ascending. -
setModel
-
convertRowToModelRow
public int convertRowToModelRow(int row) -
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() -
isSorted
public boolean isSorted() -
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) -
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
-
sortByColumn
public void sortByColumn(int column) -
sortByColumn
public void sortByColumn(int column, boolean ascending) -
addMouseListenerToHeaderInTable
-
setColEnabled
public void setColEnabled(boolean enabled, int col) the the Column col enabled or disabled- Specified by:
setColEnabled
in interfaceRmaTableModelInterface
- Overrides:
setColEnabled
in classAbstractRmaTableModel
-
setRowEnabled
public void setRowEnabled(boolean enabled, int row) set the Row row enabled or disabled- Specified by:
setRowEnabled
in interfaceRmaTableModelInterface
- Overrides:
setRowEnabled
in classAbstractRmaTableModel
-
resetRowEnabled
public void resetRowEnabled()clear the editableRows list- Specified by:
resetRowEnabled
in interfaceRmaTableModelInterface
- Overrides:
resetRowEnabled
in classAbstractRmaTableModel
-
addColumn
add a column to the table with the header colName- Specified by:
addColumn
in interfaceRmaTableModelInterface
- Overrides:
addColumn
in classAbstractRmaTableModel
-
addColumn
add a column to the table with header columnName and data ColumnData- Specified by:
addColumn
in interfaceRmaTableModelInterface
- Overrides:
addColumn
in classAbstractRmaTableModel
-
getDataVector
return the table data in a vector- Specified by:
getDataVector
in interfaceRmaTableModelInterface
- Overrides:
getDataVector
in classAbstractRmaTableModel
-
addRow
add a row to the table with data in the Vector newRow- Specified by:
addRow
in interfaceRmaTableModelInterface
- Overrides:
addRow
in classAbstractRmaTableModel
-
insertRow
insert a row in the table at Row row with data rowData- Specified by:
insertRow
in interfaceRmaTableModelInterface
- Overrides:
insertRow
in classAbstractRmaTableModel
-
setColumnClass
set the column col's class to be cls- Specified by:
setColumnClass
in interfaceRmaTableModelInterface
- Overrides:
setColumnClass
in classAbstractRmaTableModel
-
clearAll
public void clearAll()remove all data from the table- Specified by:
clearAll
in interfaceRmaTableModelInterface
- Overrides:
clearAll
in classAbstractRmaTableModel
-
deleteRow
public void deleteRow(int index) remove the row at index from the model- Specified by:
deleteRow
in interfaceRmaTableModelInterface
- Overrides:
deleteRow
in classAbstractRmaTableModel
-
getRow
get the row of data at rowNum and return in a Vector- Specified by:
getRow
in interfaceRmaTableModelInterface
- Overrides:
getRow
in classAbstractRmaTableModel
-
setColumnNames
- Specified by:
setColumnNames
in interfaceRmaTableModelInterface
- Overrides:
setColumnNames
in classAbstractRmaTableModel
-
setColumnNames
- Specified by:
setColumnNames
in interfaceRmaTableModelInterface
- Overrides:
setColumnNames
in classAbstractRmaTableModel
-
getColumnParameter
public int getColumnParameter(int col) Description copied from class:AbstractRmaTableModel
Returns the parameter for a given column. If no parameter is defined -1 is returned. The parameter ID returned can be decoded with the hec.data.Parameter class.- Specified by:
getColumnParameter
in interfaceRmaTableModelInterface
- Overrides:
getColumnParameter
in classAbstractRmaTableModel
-
setColumnParameters
public void setColumnParameters(int[] params) - Specified by:
setColumnParameters
in interfaceRmaTableModelInterface
- Overrides:
setColumnParameters
in classAbstractRmaTableModel
-
getUnitSystem
public int getUnitSystem()- Specified by:
getUnitSystem
in interfaceRmaTableModelInterface
- Overrides:
getUnitSystem
in classAbstractRmaTableModel
-
getGmtOffset
public int getGmtOffset()Description copied from interface:RmaTableModelInterface
Returns the GmtOffset that the data is in. If a value is set it is guaranteed to be in the range of -11 to +14. Otherwise RmaConst.UNDEF_INT is returned.- Specified by:
getGmtOffset
in interfaceRmaTableModelInterface
- Overrides:
getGmtOffset
in classAbstractRmaTableModel
-