Package uk.ac.starlink.topcat

## Class ColumnSelectorModel

- java.lang.Object
- - uk.ac.starlink.topcat.ColumnSelectorModel

-     public class ColumnSelectorModel
      extends java.lang.Object

  Model for a `ColumnSelector`. Contains information about how you get a value of a given type (such as Right Ascension) from a table.
  Since:
    6 Oct 2004
  Author:
    Mark Taylor (Starlink)

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ColumnSelectorModel​(TopcatModel tcModel, uk.ac.starlink.table.ValueInfo info)` | Constructs a new model for a given table and value type.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `uk.ac.starlink.table.ColumnData` | `getColumnData()` | Returns the (effective) column currently selected by the user.
    `javax.swing.ComboBoxModel` | `getColumnModel()` | Returns the model used for choosing columns.
    `javax.swing.ComboBoxModel` | `getConverterModel()` | Returns the model used for choosing converters.
    `uk.ac.starlink.table.ValueInfo` | `getValueInfo()` | Returns this model's value description.
    `void` | `setTable​(TopcatModel tcModel)` | Sets the table that this selector model is configured for.
    `boolean` | `setTextValue​(java.lang.String colTxt, java.lang.String convTxt)` | Sets the content of this model given textual values for the column specification and for the converter.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ColumnSelectorModel

          public ColumnSelectorModel​(TopcatModel tcModel,
                                     uk.ac.starlink.table.ValueInfo info)

      Constructs a new model for a given table and value type.
      Parameters:
        `tcModel` - table model
        `info` - description of the kind of column which is required

  - ### Method Detail

    - #### setTable

          public void setTable​(TopcatModel tcModel)

      Sets the table that this selector model is configured for.
      Parameters:
        `tcModel` - new table

    - #### getValueInfo

          public uk.ac.starlink.table.ValueInfo getValueInfo()

      Returns this model's value description.
      Returns:
        value info

    - #### getColumnModel

          public javax.swing.ComboBoxModel getColumnModel()

      Returns the model used for choosing columns. Elements of the model which contain usable data will be instances of `ColumnData` and will not take account of any selected converter. The selected item may be of some other type (currently String), and this should be ignored (treated as null) for the purposes of data access.
      Returns:
        columns combo box model

    - #### getConverterModel

          public javax.swing.ComboBoxModel getConverterModel()

      Returns the model used for choosing converters. May be null if there is no choice.
      Returns:
        converter combo box model, or null

    - #### getColumnData

          public uk.ac.starlink.table.ColumnData getColumnData()

      Returns the (effective) column currently selected by the user. It takes into account the column and (if any) conversion selected by the user.

      The returned ColumnData object has an intelligent implementation of `equals` (and `hashCode`), in that two invocations of this method without any intervening change of of state of this model will evaluate equal.

      Returns:
        ColumnData representing the currently-selected column, or null if none is selected

    - #### setTextValue

          public boolean setTextValue​(java.lang.String colTxt,
                                      java.lang.String convTxt)

      Sets the content of this model given textual values for the column specification and for the converter. This is done on a best-efforts basis; the return status indicates whether it worked.
      Parameters:
        `colTxt` - text content for column specification
        `convTxt` - name of converter required; may be null
      Returns:
        true iff configuration was successful