public class StarTableModel extends AbstractTableModel
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(uk.ac.starlink.table.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.
JTable
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected StarTable |
startable |
listenerList
Constructor and Description |
---|
StarTableModel(StarTable startable)
Constructs a
StarTableModel from a StarTable ,
without row index column. |
StarTableModel(StarTable startable,
boolean rowHeader)
Constructs a
StarTableModel from a StarTable ,
optionally with a row index column. |
Modifier and Type | Method and Description |
---|---|
Class<?> |
getColumnClass(int icol) |
int |
getColumnCount() |
String |
getColumnName(int icol) |
int |
getRowCount() |
StarTable |
getStarTable()
Gets the
StarTable underlying this model. |
Object |
getValueAt(int irow,
int icol) |
boolean |
hasRowHeader()
Indicates whether the first column in this table is an artificial
one containing just the index of the row.
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
protected StarTable startable
public StarTableModel(StarTable startable)
StarTableModel
from a StarTable
,
without row index column.
The supplied StarTable
must provide random access.startable
- the StarTable
objectIllegalArgumentException
- if startable.isRandom
returns false
Tables.randomTable(uk.ac.starlink.table.StarTable)
public StarTableModel(StarTable startable, boolean rowHeader)
StarTableModel
from a StarTable
,
optionally with a row index column.
The supplied StarTable
must provide random access.startable
- the StarTable
objectrowHeader
- whether to add an extra column at the start
containing the row indexIllegalArgumentException
- if startable.isRandom
returns false
Tables.randomTable(uk.ac.starlink.table.StarTable)
public boolean hasRowHeader()
true
iff column 0 is a row indexpublic StarTable getStarTable()
StarTable
underlying this model.StarTable
objectpublic int getRowCount()
public int getColumnCount()
public Object getValueAt(int irow, int icol)
public String getColumnName(int icol)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
public Class<?> getColumnClass(int icol)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.