Class RestrictedColumnComboBoxModel

  extended by javax.swing.AbstractListModel
      extended by
          extended by
All Implemented Interfaces:
Serializable, EventListener, ComboBoxModel, TableColumnModelListener, ListModel

public abstract class RestrictedColumnComboBoxModel
extends ColumnComboBoxModel

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( method appropriately. In the case that acceptColumn accepts everything, this will behave just the same as a ColumnComboBoxModel (though perhaps less efficiently).

See Also:
Serialized Form

Field Summary
Fields inherited from class
Fields inherited from class javax.swing.AbstractListModel
Constructor Summary
RestrictedColumnComboBoxModel(TableColumnModel colModel, boolean hasNone)
Method Summary
abstract  boolean acceptColumn( cinfo)
          Determines whether a column with given metadata in the column model should show up in the combobox.
 void columnAdded(TableColumnModelEvent evt)
 void columnMoved(TableColumnModelEvent evt)
 void columnRemoved(TableColumnModelEvent evt)
 Object getElementAt(int index)
 int getSize()
static RestrictedColumnComboBoxModel 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
columnMarginChanged, columnSelectionChanged, getColumnModel, getSelectedItem, makeComboBox, setHasNone, setSelectedItem
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener

Constructor Detail


public RestrictedColumnComboBoxModel(TableColumnModel colModel,
                                     boolean hasNone)
Method Detail


public abstract boolean acceptColumn( cinfo)
Determines whether a column with given metadata in the column model should show up in the combobox.

cinfo - column metadata to assess
true iff the column is to be used


public Object getElementAt(int index)
Specified by:
getElementAt in interface ListModel
getElementAt in class ColumnComboBoxModel


public int getSize()
Specified by:
getSize in interface ListModel
getSize in class ColumnComboBoxModel


public void columnAdded(TableColumnModelEvent evt)
Specified by:
columnAdded in interface TableColumnModelListener
columnAdded in class ColumnComboBoxModel


public void columnRemoved(TableColumnModelEvent evt)
Specified by:
columnRemoved in interface TableColumnModelListener
columnRemoved in class ColumnComboBoxModel


public void columnMoved(TableColumnModelEvent evt)
Specified by:
columnMoved in interface TableColumnModelListener
columnMoved in class ColumnComboBoxModel


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.

colModel - the column model
hasNone - true if you want a NO_COLUMN entry
clazz - the class that available columns have to have data assignable to

Copyright © 2003-2019 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.