Package uk.ac.starlink.topcat
Class MetaColumnTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
uk.ac.starlink.topcat.MetaColumnTableModel
- All Implemented Interfaces:
Serializable
,TableModel
Makes a TableModel out of a list of MetaColumn objects.
- See Also:
-
Field Summary
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
Constructor Summary
ConstructorsConstructorDescriptionMetaColumnTableModel
(List<MetaColumn> metaList) Constructs a new MetaColumnTableModel. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canSort
(MetaColumn sortCol) Indicates whether the supplied column has a defined sort order.Class<?>
getColumnClass
(int icol) int
Returns the list of columns which provide the data for this model.getColumnName
(int icol) int
getListIndex
(int irow) Returns the index in the natural row sequence for a row index in the table model.abstract int
getValueAt
(int irow, int icol) boolean
isCellEditable
(int irow, int icol) void
setValueAt
(Object value, int irow, int icol) boolean
sortRows
(MetaColumn sortCol, boolean isDescending) Reorders the rows of this table model based on the contents of one of its columns.Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Constructor Details
-
MetaColumnTableModel
Constructs a new MetaColumnTableModel.- Parameters:
metaList
- a list ofMetaColumn
objects
-
-
Method Details
-
getColumnCount
public int getColumnCount() -
getRowCount
public abstract int getRowCount() -
getValueAt
-
setValueAt
- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classAbstractTableModel
-
getColumnClass
- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
-
getColumnName
- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
-
isCellEditable
public boolean isCellEditable(int irow, int icol) - Specified by:
isCellEditable
in interfaceTableModel
- Overrides:
isCellEditable
in classAbstractTableModel
-
getColumnList
Returns the list of columns which provide the data for this model. The list may be altered (but fire appropriate events if you do it on a live instance).- Returns:
- column list
-
canSort
Indicates whether the supplied column has a defined sort order.- Parameters:
sortCol
- column, not null- Returns:
- true iff sortCol can be sorted on
-
sortRows
Reorders the rows of this table model based on the contents of one of its columns. This method does not inform listeners that the table data may have changed, so calling code should do that where appropriate. It only needs to do so if the return value of this method is true.- Parameters:
sortCol
- column to sort on, or null for natural orderingisDescending
- false to sort up, true to sort down- Returns:
- true if changes may have been made to the rows, false if no changes were made
-
getListIndex
public int getListIndex(int irow) Returns the index in the natural row sequence for a row index in the table model.- Parameters:
irow
- table row index- Returns:
- list row index
-