java.io.Serializable, java.util.EventListener, javax.swing.ComboBoxModel, javax.swing.event.TableColumnModelListener, javax.swing.ListModelpublic class ColumnDataComboBoxModel
extends javax.swing.AbstractListModel
implements javax.swing.event.TableColumnModelListener, javax.swing.ComboBoxModel
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 createComboBox() method provides a JComboBox which is a
suitable host for instances of this class.
| Modifier and Type | Class | Description |
|---|---|---|
static interface |
ColumnDataComboBoxModel.Filter |
Determines what columns are acceptable for this model.
|
| Constructor | Description |
|---|---|
ColumnDataComboBoxModel(TopcatModel tcModel,
java.lang.Class dataClazz,
boolean hasNone) |
Constructs a model for a given content class,
optionally with a blank entry.
|
ColumnDataComboBoxModel(TopcatModel tcModel,
java.lang.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 | Description |
|---|---|---|
void |
columnAdded(javax.swing.event.TableColumnModelEvent evt) |
|
void |
columnMarginChanged(javax.swing.event.ChangeEvent evt) |
|
void |
columnMoved(javax.swing.event.TableColumnModelEvent evt) |
|
void |
columnRemoved(javax.swing.event.TableColumnModelEvent evt) |
|
void |
columnSelectionChanged(javax.swing.event.ListSelectionEvent evt) |
|
static javax.swing.JComboBox |
createComboBox() |
Constructs and returns a JComboBox suitable for use with
a
ColumnDataComboBoxModel. |
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.
|
java.lang.Object |
getElementAt(int index) |
|
java.lang.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(java.lang.Object item) |
|
uk.ac.starlink.table.ColumnData |
stringToColumnData(java.lang.String txt) |
Converts a string value to a ColumnData value suitable for selection
by this model.
|
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, java.lang.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, java.lang.Class dataClazz, boolean hasNone)
tcModel - table model containing columnshasNone - true iff you want a null entry in the selector modelpublic java.lang.Object getElementAt(int index)
getElementAt in interface javax.swing.ListModelpublic uk.ac.starlink.table.ColumnData getColumnDataAt(int index)
index - requested indexpublic int getSize()
getSize in interface javax.swing.ListModelpublic java.lang.Object getSelectedItem()
getSelectedItem in interface javax.swing.ComboBoxModelpublic uk.ac.starlink.table.ColumnData stringToColumnData(java.lang.String txt)
throws gnu.jel.CompilationException
txt - string expression (or column name) for datagnu.jel.CompilationException - if txt is not validpublic void setSelectedItem(java.lang.Object item)
setSelectedItem in interface javax.swing.ComboBoxModelpublic 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(javax.swing.event.TableColumnModelEvent evt)
columnAdded in interface javax.swing.event.TableColumnModelListenerpublic void columnRemoved(javax.swing.event.TableColumnModelEvent evt)
columnRemoved in interface javax.swing.event.TableColumnModelListenerpublic void columnMoved(javax.swing.event.TableColumnModelEvent evt)
columnMoved in interface javax.swing.event.TableColumnModelListenerpublic void columnMarginChanged(javax.swing.event.ChangeEvent evt)
columnMarginChanged in interface javax.swing.event.TableColumnModelListenerpublic void columnSelectionChanged(javax.swing.event.ListSelectionEvent evt)
columnSelectionChanged in interface javax.swing.event.TableColumnModelListenerpublic static javax.swing.JComboBox createComboBox()
ColumnDataComboBoxModel. It installs
(and deinstalls as appropriate)
ComboBoxEditors which allow for
textual expressions to be interpreted as JEL expressions based
on the TopcatModel on which this model is based.
This facility is only available/useful in the case that the
combo box is editable; so the returned combo box is editable.
Currently no default renderer is required or installed.public static uk.ac.starlink.table.ColumnData createSimpleColumnData(TopcatModel tcModel, uk.ac.starlink.table.gui.StarTableColumn tcol)
tcModel - topcat modeltcol - column in modelCopyright © 2003-2018 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.