Package uk.ac.starlink.topcat
Class RestrictedColumnComboBoxModel
java.lang.Object
javax.swing.AbstractListModel<TableColumn>
uk.ac.starlink.topcat.ColumnComboBoxModel
uk.ac.starlink.topcat.RestrictedColumnComboBoxModel
- All Implemented Interfaces:
Serializable,EventListener,ComboBoxModel<TableColumn>,TableColumnModelListener,ListModel<TableColumn>
Does a similar job as for ColumnComboBoxModel, but when only a subset
of the available columns should show up in the combobox.
Use it in the same way as ColumnComboBoxModel, but implement the
acceptColumn(uk.ac.starlink.table.ColumnInfo) method appropriately. In the case that
acceptColumn accepts everything, this will behave just the
same as a ColumnComboBoxModel (though perhaps less efficiently).- See Also:
-
Field Summary
Fields inherited from class uk.ac.starlink.topcat.ColumnComboBoxModel
NO_COLUMNFields inherited from class javax.swing.AbstractListModel
listenerList -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanacceptColumn(uk.ac.starlink.table.ColumnInfo cinfo) Determines whether a column with given metadata in the column model should show up in the combobox.voidvoidvoidgetElementAt(int index) intgetSize()makeClassColumnComboBoxModel(TableColumnModel colModel, boolean hasNone, Class<?> clazz) Returns a column combo box model which checks for compatibility with a given class.Methods inherited from class uk.ac.starlink.topcat.ColumnComboBoxModel
columnMarginChanged, columnSelectionChanged, getColumnModel, getSelectedItem, makeComboBox, setHasNone, setSelectedItemMethods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
-
Constructor Details
-
RestrictedColumnComboBoxModel
-
-
Method Details
-
acceptColumn
public abstract boolean acceptColumn(uk.ac.starlink.table.ColumnInfo cinfo) Determines whether a column with given metadata in the column model should show up in the combobox.- Parameters:
cinfo- column metadata to assess- Returns:
trueiff the column is to be used
-
getElementAt
- Specified by:
getElementAtin interfaceListModel<TableColumn>- Overrides:
getElementAtin classColumnComboBoxModel
-
getSize
public int getSize()- Specified by:
getSizein interfaceListModel<TableColumn>- Overrides:
getSizein classColumnComboBoxModel
-
columnAdded
- Specified by:
columnAddedin interfaceTableColumnModelListener- Overrides:
columnAddedin classColumnComboBoxModel
-
columnRemoved
- Specified by:
columnRemovedin interfaceTableColumnModelListener- Overrides:
columnRemovedin classColumnComboBoxModel
-
columnMoved
- Specified by:
columnMovedin interfaceTableColumnModelListener- Overrides:
columnMovedin classColumnComboBoxModel
-
makeClassColumnComboBoxModel
public static RestrictedColumnComboBoxModel makeClassColumnComboBoxModel(TableColumnModel colModel, boolean hasNone, Class<?> clazz) Returns a column combo box model which checks for compatibility with a given class. Class matching is not strict in the following sense: any numeric class (Number) is considered assignable to any other numeric class.- Parameters:
colModel- the column modelhasNone- true if you want a NO_COLUMN entryclazz- the class that available columns have to have data assignable to
-