public class ColumnDataComboBoxModel extends AbstractListModel<uk.ac.starlink.table.ColumnData> implements TableColumnModelListener, ComboBoxModel<uk.ac.starlink.table.ColumnData>
ColumnData
.
The selected item may be of some other type (currently String),
and this should be ignored (treated as null) for the purposes
of data access.
The ColumnDataComboBox
class should generally be used as a
suitable host for instances of this class.
Modifier and Type | Class and Description |
---|---|
static interface |
ColumnDataComboBoxModel.Filter
Determines what columns are acceptable for this model.
|
listenerList
Constructor and Description |
---|
ColumnDataComboBoxModel(TopcatModel tcModel,
Class<?> dataClazz,
boolean hasNone)
Constructs a model for a given content class,
optionally with a blank entry.
|
ColumnDataComboBoxModel(TopcatModel tcModel,
Class<?> dataClazz,
boolean hasNone,
boolean hasIndex)
Constructs a model for a given content class, optionally with
a blank entry and an entry for the magic 'index' column.
|
ColumnDataComboBoxModel(TopcatModel tcModel,
ColumnDataComboBoxModel.Filter filter,
boolean hasNone,
boolean hasIndex)
Constructs a model with a specified column metadata filter.
|
Modifier and Type | Method and Description |
---|---|
void |
columnAdded(TableColumnModelEvent evt) |
void |
columnMarginChanged(ChangeEvent evt) |
void |
columnMoved(TableColumnModelEvent evt) |
void |
columnRemoved(TableColumnModelEvent evt) |
void |
columnSelectionChanged(ListSelectionEvent evt) |
static uk.ac.starlink.table.ColumnData |
createSimpleColumnData(TopcatModel tcModel,
uk.ac.starlink.table.gui.StarTableColumn tcol)
Creates a ColumnData object simply representing a single column
of a table.
|
uk.ac.starlink.table.ColumnData |
getBestMatchColumnData(uk.ac.starlink.table.ValueInfo info)
Attempts to locate and return a member of this model which matches
the given
info . |
uk.ac.starlink.table.ColumnData |
getColumnDataAt(int index)
Returns the element at a given index as a typed object.
|
uk.ac.starlink.table.ColumnData |
getElementAt(int index) |
Object |
getSelectedItem() |
int |
getSize() |
uk.ac.starlink.table.ColumnData |
getUniqueMatchColumnData(uk.ac.starlink.table.ValueInfo info)
Attempts to locate and return a member of this model which
is the only match for a given
info . |
void |
setSelectedItem(Object item) |
uk.ac.starlink.table.ColumnData |
stringToColumnData(String txt)
Converts a string value to a ColumnData value suitable for selection
by this model.
|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addListDataListener, removeListDataListener
public ColumnDataComboBoxModel(TopcatModel tcModel, ColumnDataComboBoxModel.Filter filter, boolean hasNone, boolean hasIndex)
tcModel
- table model containing columnsfilter
- determines which columns are permittedhasNone
- true iff you want a null entry in the selector modelhasIndex
- true iff you want an index column entry in the
selector modelpublic ColumnDataComboBoxModel(TopcatModel tcModel, Class<?> dataClazz, boolean hasNone, boolean hasIndex)
tcModel
- table model containing columnsdataClazz
- content class of permitted columnshasNone
- true iff you want a null entry in the selector modelhasIndex
- true iff you want an index column entry in the
selector modelpublic ColumnDataComboBoxModel(TopcatModel tcModel, Class<?> dataClazz, boolean hasNone)
tcModel
- table model containing columnshasNone
- true iff you want a null entry in the selector modelpublic uk.ac.starlink.table.ColumnData getElementAt(int index)
getElementAt
in interface ListModel<uk.ac.starlink.table.ColumnData>
public uk.ac.starlink.table.ColumnData getColumnDataAt(int index)
index
- requested indexpublic int getSize()
public Object getSelectedItem()
getSelectedItem
in interface ComboBoxModel<uk.ac.starlink.table.ColumnData>
public uk.ac.starlink.table.ColumnData stringToColumnData(String txt) throws gnu.jel.CompilationException
txt
- string expression (or column name) for datagnu.jel.CompilationException
- if txt
is not validpublic void setSelectedItem(Object item)
setSelectedItem
in interface ComboBoxModel<uk.ac.starlink.table.ColumnData>
public uk.ac.starlink.table.ColumnData getBestMatchColumnData(uk.ac.starlink.table.ValueInfo info)
info
. Exactly how the matching is done is
not defined - presumably grubbing about with UCDs or column names etc.info
- metadata item to matchinfo
, or null if nothing suitable can be foundpublic uk.ac.starlink.table.ColumnData getUniqueMatchColumnData(uk.ac.starlink.table.ValueInfo info)
info
.
If no good match can be found, or if multiple equally good matches
are found, null is returned.
Exactly how the matching is done is
not defined - presumably grubbing about with UCDs or column names etc.info
- metadata item to matchinfo
, or null if nothing suitable can be foundpublic void columnAdded(TableColumnModelEvent evt)
columnAdded
in interface TableColumnModelListener
public void columnRemoved(TableColumnModelEvent evt)
columnRemoved
in interface TableColumnModelListener
public void columnMoved(TableColumnModelEvent evt)
columnMoved
in interface TableColumnModelListener
public void columnMarginChanged(ChangeEvent evt)
columnMarginChanged
in interface TableColumnModelListener
public void columnSelectionChanged(ListSelectionEvent evt)
columnSelectionChanged
in interface TableColumnModelListener
public static uk.ac.starlink.table.ColumnData createSimpleColumnData(TopcatModel tcModel, uk.ac.starlink.table.gui.StarTableColumn tcol)
tcModel
- topcat modeltcol
- column in modelCopyright © 2003-2025 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.