Package uk.ac.starlink.topcat

## Class RestrictedColumnComboBoxModel

- java.lang.Object
- - javax.swing.AbstractListModel<javax.swing.table.TableColumn>
  - - uk.ac.starlink.topcat.ColumnComboBoxModel
    - - uk.ac.starlink.topcat.RestrictedColumnComboBoxModel

- All Implemented Interfaces:
    `java.io.Serializable`, `java.util.EventListener`, `javax.swing.ComboBoxModel<javax.swing.table.TableColumn>`, `javax.swing.event.TableColumnModelListener`, `javax.swing.ListModel<javax.swing.table.TableColumn>`

      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(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:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class uk.ac.starlink.topcat.ColumnComboBoxModel

      `NO_COLUMN`

    - ### Fields inherited from class javax.swing.AbstractListModel

      `listenerList`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RestrictedColumnComboBoxModel​(javax.swing.table.TableColumnModel colModel, boolean hasNone)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `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.
    `void` | `columnAdded​(javax.swing.event.TableColumnModelEvent evt)` |
    `void` | `columnMoved​(javax.swing.event.TableColumnModelEvent evt)` |
    `void` | `columnRemoved​(javax.swing.event.TableColumnModelEvent evt)` |
    `javax.swing.table.TableColumn` | `getElementAt​(int index)` |
    `int` | `getSize()` |
    `static RestrictedColumnComboBoxModel` | `makeClassColumnComboBoxModel​(javax.swing.table.TableColumnModel colModel, boolean hasNone, java.lang.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, 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

    - #### RestrictedColumnComboBoxModel

          public RestrictedColumnComboBoxModel​(javax.swing.table.TableColumnModel colModel,
                                               boolean hasNone)

  - ### Method Detail

    - #### 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:
        `true` iff the column is to be used

    - #### getElementAt

          public javax.swing.table.TableColumn getElementAt​(int index)

      Specified by:
        `getElementAt` in interface `javax.swing.ListModel<javax.swing.table.TableColumn>`
      Overrides:
        `getElementAt` in class `ColumnComboBoxModel`

    - #### getSize

          public int getSize()

      Specified by:
        `getSize` in interface `javax.swing.ListModel<javax.swing.table.TableColumn>`
      Overrides:
        `getSize` in class `ColumnComboBoxModel`

    - #### columnAdded

          public void columnAdded​(javax.swing.event.TableColumnModelEvent evt)

      Specified by:
        `columnAdded` in interface `javax.swing.event.TableColumnModelListener`
      Overrides:
        `columnAdded` in class `ColumnComboBoxModel`

    - #### columnRemoved

          public void columnRemoved​(javax.swing.event.TableColumnModelEvent evt)

      Specified by:
        `columnRemoved` in interface `javax.swing.event.TableColumnModelListener`
      Overrides:
        `columnRemoved` in class `ColumnComboBoxModel`

    - #### columnMoved

          public void columnMoved​(javax.swing.event.TableColumnModelEvent evt)

      Specified by:
        `columnMoved` in interface `javax.swing.event.TableColumnModelListener`
      Overrides:
        `columnMoved` in class `ColumnComboBoxModel`

    - #### makeClassColumnComboBoxModel

          public static RestrictedColumnComboBoxModel makeClassColumnComboBoxModel​(javax.swing.table.TableColumnModel colModel,
                                                                                   boolean hasNone,
                                                                                   java.lang.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 model
        `hasNone` - true if you want a NO_COLUMN entry
        `clazz` - the class that available columns have to have data assignable to