Class StarTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
uk.ac.starlink.table.gui.StarTableModel
- All Implemented Interfaces:
Serializable, TableModel
Adapts a
StarTable into a TableModel.
The base StarTable must provide random access (its isRandom
method must return true); to make a StarTableModel if your
StarTable is not random you will have to make a random one using
for instance Tables.randomTable(StarTable).
One extra bit of functionality is enabled, namely that an extra column containing row indices may be provided.
As well as providing the data model for a JTable, this
class can be used as a general wrapper for StarTable objects
when the event handling mechanism it supplies is required.
- Author:
- Mark Taylor (Starlink)
- See Also:
-
Field Summary
FieldsFields inherited from class AbstractTableModel
listenerList -
Constructor Summary
ConstructorsConstructorDescriptionStarTableModel(StarTable startable) Constructs aStarTableModelfrom aStarTable, without row index column.StarTableModel(StarTable startable, boolean rowHeader) Constructs aStarTableModelfrom aStarTable, optionally with a row index column. -
Method Summary
Modifier and TypeMethodDescriptionClass<?> getColumnClass(int icol) intgetColumnName(int icol) intGets theStarTableunderlying this model.getValueAt(int irow, int icol) booleanIndicates whether the first column in this table is an artificial one containing just the index of the row.Methods inherited from class AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
-
Field Details
-
startable
-
-
Constructor Details
-
StarTableModel
Constructs aStarTableModelfrom aStarTable, without row index column. The suppliedStarTablemust provide random access.- Parameters:
startable- theStarTableobject- Throws:
IllegalArgumentException- ifstartable.isRandomreturnsfalse- See Also:
-
StarTableModel
Constructs aStarTableModelfrom aStarTable, optionally with a row index column. The suppliedStarTablemust provide random access.- Parameters:
startable- theStarTableobjectrowHeader- whether to add an extra column at the start containing the row index- Throws:
IllegalArgumentException- ifstartable.isRandomreturnsfalse- See Also:
-
-
Method Details
-
hasRowHeader
public boolean hasRowHeader()Indicates whether the first column in this table is an artificial one containing just the index of the row.- Returns:
trueiff column 0 is a row index
-
getStarTable
Gets theStarTableunderlying this model.- Returns:
- the
StarTableobject
-
getRowCount
public int getRowCount() -
getColumnCount
public int getColumnCount() -
getValueAt
-
getColumnName
- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel
-
getColumnClass
- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel
-