public class ViewerTableModel extends AbstractTableModel
TableModel
which is based on a StarTable
but
also provides methods for ordering rows and selecting which rows will
be visible. This class is used as the TableModel
for the
TableViewer
widget.listenerList
Constructor and Description |
---|
ViewerTableModel(PlasticStarTable startable)
Constructs a
ViewerTableModel from a StarTable . |
Modifier and Type | Method and Description |
---|---|
long |
getBaseRow(int irow)
Returns the index of the data model row corresponding
to a given row in this view model.
|
int |
getColumnCount() |
int |
getRowCount() |
Iterator<Long> |
getRowIndexIterator()
Returns an iterator over the base table row indices represented
by this view.
|
int[] |
getRowMap()
Returns the mapping from row index visible in this model to
row index in the base table.
|
uk.ac.starlink.table.StarTable |
getRowPermutedView(uk.ac.starlink.table.StarTable table)
Returns a view of a given table whose rows are permuted in the same way
as the current view is permuted with respect to the basic table.
|
uk.ac.starlink.table.StarTable |
getSnapshot()
Returns a new StarTable whose data corresponds to the current state of
this ViewerTableModel.
|
RowSubset |
getSubset()
Returns the RowSubset currently used by the viewer model.
|
Object |
getValueAt(int irow,
int icol) |
int |
getViewRow(long lrow)
Returns the index at which a given table row appears in this view model.
|
boolean |
isCellEditable(int irow,
int icol) |
void |
setOrder(int[] order)
Configures this view to view the rows of the base model in a
given order.
|
void |
setRowMap(int[] rowMap)
Sets the mapping from row index visible in this model to
row index in the base table.
|
void |
setSubset(RowSubset rset)
Configures this view to view only a subset of the rows of the base
model.
|
void |
setValueAt(Object val,
int irow,
int icol) |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, removeTableModelListener
public ViewerTableModel(PlasticStarTable startable)
ViewerTableModel
from a StarTable
.
The supplied StarTable
must provide random access.startable
- the StarTable
objectIllegalArgumentException
- if startable.isRandom
returns false
public void setOrder(int[] order)
TableModelEvent
to listeners.order
- mapping of rows in the table view, or null
to indicate natural orderingpublic void setSubset(RowSubset rset)
TableModelEvent
to listeners.rset
- RowSubset object indicating inclusion in subset of
rows to be viewedpublic RowSubset getSubset()
public int[] getRowMap()
null
to indicate a unit mappublic Iterator<Long> getRowIndexIterator()
rowMap
if it is non-null, or an iterator
over all the rows if it is null.
The number of elements iterated over is given by
getRowCount()
.public void setRowMap(int[] rowMap)
rowMap
- row mapping;
may be null
to indicate a unit mappublic int getColumnCount()
public int getRowCount()
public long getBaseRow(int irow)
irow
- index of the row in this view modelpublic int getViewRow(long lrow)
lrow
- index of the row in the base tablepublic Object getValueAt(int irow, int icol)
public boolean isCellEditable(int irow, int icol)
isCellEditable
in interface TableModel
isCellEditable
in class AbstractTableModel
public void setValueAt(Object val, int irow, int icol)
setValueAt
in interface TableModel
setValueAt
in class AbstractTableModel
public uk.ac.starlink.table.StarTable getSnapshot()
public uk.ac.starlink.table.StarTable getRowPermutedView(uk.ac.starlink.table.StarTable table)
table
- table to be permutedtable
Copyright © 2003-2025 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.