java.io.Serializable
, java.util.EventListener
, javax.swing.ComboBoxModel
, javax.swing.event.TableColumnModelListener
, javax.swing.ListModel
RestrictedColumnComboBoxModel
public class ColumnComboBoxModel
extends javax.swing.AbstractListModel
implements javax.swing.event.TableColumnModelListener, javax.swing.ComboBoxModel
TableColumnModel
into a ComboBoxModel
. This model is designed
to reflect the contents of a column model rather than the other
way around, so in general you wouldn't want to add a ListDataListener
to this model, you'd add it to the underlying column model.
Selections in the column model are not reflected by selections in this model, but columns added/moved/removed are.
Modifier and Type | Field | Description |
---|---|---|
static uk.ac.starlink.table.gui.StarTableColumn |
NO_COLUMN |
Constructor | Description |
---|---|
ColumnComboBoxModel(javax.swing.table.TableColumnModel colModel,
boolean hasNone) |
Constructs a new ComboBoxModel based on a given column model,
optionally with a null entry at the head of the list.
|
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) |
|
javax.swing.table.TableColumnModel |
getColumnModel() |
|
java.lang.Object |
getElementAt(int index) |
|
java.lang.Object |
getSelectedItem() |
The returned object is guaranteed to be a
TableColumn or null. |
int |
getSize() |
|
javax.swing.JComboBox |
makeComboBox() |
Returns a new JComboBox based on this model.
|
void |
setHasNone(boolean hasNone) |
Sets whether there should be a null entry at the head of the list.
|
void |
setSelectedItem(java.lang.Object item) |
The selected item must be a
TableColumn object. |
public ColumnComboBoxModel(javax.swing.table.TableColumnModel colModel, boolean hasNone)
colModel
- the column modelhasNone
- true iff an additional null entry at the head of
the list is requiredpublic void setHasNone(boolean hasNone)
hasNone
- true iff an additional null entry at the head of
the list is requiredpublic javax.swing.table.TableColumnModel getColumnModel()
public java.lang.Object getElementAt(int index)
getElementAt
in interface javax.swing.ListModel
public int getSize()
getSize
in interface javax.swing.ListModel
public java.lang.Object getSelectedItem()
TableColumn
or null.getSelectedItem
in interface javax.swing.ComboBoxModel
public void setSelectedItem(java.lang.Object item)
TableColumn
object.setSelectedItem
in interface javax.swing.ComboBoxModel
item
- a table column to selectjava.lang.ClassCastException
- if item is not null or a
TableColumnpublic javax.swing.JComboBox makeComboBox()
ColumnCellRenderer
public void columnAdded(javax.swing.event.TableColumnModelEvent evt)
columnAdded
in interface javax.swing.event.TableColumnModelListener
public void columnRemoved(javax.swing.event.TableColumnModelEvent evt)
columnRemoved
in interface javax.swing.event.TableColumnModelListener
public void columnMoved(javax.swing.event.TableColumnModelEvent evt)
columnMoved
in interface javax.swing.event.TableColumnModelListener
public void columnMarginChanged(javax.swing.event.ChangeEvent evt)
columnMarginChanged
in interface javax.swing.event.TableColumnModelListener
public void columnSelectionChanged(javax.swing.event.ListSelectionEvent evt)
columnSelectionChanged
in interface javax.swing.event.TableColumnModelListener
Copyright © 2003-2018 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.