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 intThe constant for an ascending sort.static final intThe constant for a descending sort.static final intThe constant for a sort that flip-flops between ascending and descending.Fields inherited from class rma.swing.RmaTableMap
modelFields inherited from class rma.swing.table.AbstractRmaTableModel
m_columnNames, m_displayUnitSystem, m_gmtOffset, m_unitSystemFields inherited from class javax.swing.table.AbstractTableModel
listenerListFields 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 TypeMethodDescriptionvoidadd a column to the table with the header colNamevoidadd a column to the table with header columnName and data ColumnDatavoidvoidadd a row to the table with data in the Vector newRowbooleanReturns the boolean for ascending.voidvoidclearAll()remove all data from the tableintcompare(int row1, int row2) intcompareRowsByColumn(int row1, int row2, int column) intconvertRowToModelRow(int row) voiddeleteRow(int index) remove the row at index from the modelintgetColumnParameter(int col) Returns the parameter for a given column.return the table data in a vectorintReturns the GmtOffset that the data is in.intgetMappedRow(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 VectorintgetValueAt(int aRow, int aColumn) Returns the value at a given row/column location.voidinsert a row in the table at Row row with data rowDatabooleanisSorted()voidn2sort()voidvoidclear the editableRows listvoidsetColEnabled(boolean enabled, int col) the the Column col enabled or disabledvoidsetColumnClass(int col, Class cls) set the column col's class to be clsvoidsetColumnNames(String[] colNames) voidsetColumnNames(Vector colNamesVector) voidsetColumnParameters(int[] params) voidsetModel(RmaTableModelInterface model) voidsetRowEnabled(boolean enabled, int row) set the Row row enabled or disabledvoidsetSortingType(int sortingType) Sets the Sorting Type to the arg int.voidsetValueAt(Object aValue, int aRow, int aColumn) voidshuttlesort(int[] from, int[] to, int low, int high) voidvoidsortByColumn(int column) voidsortByColumn(int column, boolean ascending) voidswap(int i, int j) voidMethods inherited from class rma.swing.RmaTableMap
getColumnClass, getColumnCount, getColumnName, getModel, getRowCount, isCellEditable, setModelMethods inherited from class rma.swing.table.AbstractRmaTableModel
getDisplayUnitSystem, insertRows, setDisplayUnitsSystem, setUnitSystemMethods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface rma.swing.table.RmaTableModelInterface
insertRows, setCellEnabled, setDisplayUnitsSystemMethods 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:
tableChangedin interfaceTableModelListener- Overrides:
tableChangedin 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:AbstractRmaTableModelReturns the value at a given row/column location. The default method returns null. Needs to be overrridden- Specified by:
getValueAtin interfaceTableModel- Overrides:
getValueAtin classRmaTableMap- Parameters:
aRow- the row to look for the value in.aColumn- the column to look for the value in.
-
setValueAt
- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin 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:
setColEnabledin interfaceRmaTableModelInterface- Overrides:
setColEnabledin classAbstractRmaTableModel
-
setRowEnabled
public void setRowEnabled(boolean enabled, int row) set the Row row enabled or disabled- Specified by:
setRowEnabledin interfaceRmaTableModelInterface- Overrides:
setRowEnabledin classAbstractRmaTableModel
-
resetRowEnabled
public void resetRowEnabled()clear the editableRows list- Specified by:
resetRowEnabledin interfaceRmaTableModelInterface- Overrides:
resetRowEnabledin classAbstractRmaTableModel
-
addColumn
add a column to the table with the header colName- Specified by:
addColumnin interfaceRmaTableModelInterface- Overrides:
addColumnin classAbstractRmaTableModel
-
addColumn
add a column to the table with header columnName and data ColumnData- Specified by:
addColumnin interfaceRmaTableModelInterface- Overrides:
addColumnin classAbstractRmaTableModel
-
getDataVector
return the table data in a vector- Specified by:
getDataVectorin interfaceRmaTableModelInterface- Overrides:
getDataVectorin classAbstractRmaTableModel
-
addRow
add a row to the table with data in the Vector newRow- Specified by:
addRowin interfaceRmaTableModelInterface- Overrides:
addRowin classAbstractRmaTableModel
-
insertRow
insert a row in the table at Row row with data rowData- Specified by:
insertRowin interfaceRmaTableModelInterface- Overrides:
insertRowin classAbstractRmaTableModel
-
setColumnClass
set the column col's class to be cls- Specified by:
setColumnClassin interfaceRmaTableModelInterface- Overrides:
setColumnClassin classAbstractRmaTableModel
-
clearAll
public void clearAll()remove all data from the table- Specified by:
clearAllin interfaceRmaTableModelInterface- Overrides:
clearAllin classAbstractRmaTableModel
-
deleteRow
public void deleteRow(int index) remove the row at index from the model- Specified by:
deleteRowin interfaceRmaTableModelInterface- Overrides:
deleteRowin classAbstractRmaTableModel
-
getRow
get the row of data at rowNum and return in a Vector- Specified by:
getRowin interfaceRmaTableModelInterface- Overrides:
getRowin classAbstractRmaTableModel
-
setColumnNames
- Specified by:
setColumnNamesin interfaceRmaTableModelInterface- Overrides:
setColumnNamesin classAbstractRmaTableModel
-
setColumnNames
- Specified by:
setColumnNamesin interfaceRmaTableModelInterface- Overrides:
setColumnNamesin classAbstractRmaTableModel
-
getColumnParameter
public int getColumnParameter(int col) Description copied from class:AbstractRmaTableModelReturns 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:
getColumnParameterin interfaceRmaTableModelInterface- Overrides:
getColumnParameterin classAbstractRmaTableModel
-
setColumnParameters
public void setColumnParameters(int[] params) - Specified by:
setColumnParametersin interfaceRmaTableModelInterface- Overrides:
setColumnParametersin classAbstractRmaTableModel
-
getUnitSystem
public int getUnitSystem()- Specified by:
getUnitSystemin interfaceRmaTableModelInterface- Overrides:
getUnitSystemin classAbstractRmaTableModel
-
getGmtOffset
public int getGmtOffset()Description copied from interface:RmaTableModelInterfaceReturns 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:
getGmtOffsetin interfaceRmaTableModelInterface- Overrides:
getGmtOffsetin classAbstractRmaTableModel
-