public class ColumnComboBoxModel extends AbstractListModel<TableColumn> implements TableColumnModelListener, ComboBoxModel<TableColumn>
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 and Description |
---|---|
static uk.ac.starlink.table.gui.StarTableColumn |
NO_COLUMN |
listenerList
Constructor and Description |
---|
ColumnComboBoxModel(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 and Description |
---|---|
void |
columnAdded(TableColumnModelEvent evt) |
void |
columnMarginChanged(ChangeEvent evt) |
void |
columnMoved(TableColumnModelEvent evt) |
void |
columnRemoved(TableColumnModelEvent evt) |
void |
columnSelectionChanged(ListSelectionEvent evt) |
TableColumnModel |
getColumnModel() |
TableColumn |
getElementAt(int index) |
Object |
getSelectedItem() |
int |
getSize() |
JComboBox<TableColumn> |
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(Object item)
The selected
item must be a
TableColumn object. |
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addListDataListener, removeListDataListener
public ColumnComboBoxModel(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 TableColumnModel getColumnModel()
public TableColumn getElementAt(int index)
getElementAt
in interface ListModel<TableColumn>
public int getSize()
getSize
in interface ListModel<TableColumn>
public Object getSelectedItem()
getSelectedItem
in interface ComboBoxModel<TableColumn>
public void setSelectedItem(Object item)
item
must be a
TableColumn
object.setSelectedItem
in interface ComboBoxModel<TableColumn>
item
- a table column to selectpublic JComboBox<TableColumn> makeComboBox()
ColumnCellRenderer
public 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
Copyright © 2003-2025 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.