Package uk.ac.starlink.vo

## Class DoubleValueField

- java.lang.Object
- - uk.ac.starlink.vo.DoubleValueField

-     public class DoubleValueField
      extends java.lang.Object

  Generalised data entry field which can hold a double precision number. As well as a text entry field, this also contains an option for choosing the format in which the data will be entered. The format options are defined by an array of `ValueConverter` objects supplied at construction time.
  Since:
    21 Dec 2004
  Author:
    Mark Taylor (Starlink)

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DoubleValueField​(java.lang.String name, ValueConverter[] convs)` | Constructs a value field given its name.
    `DoubleValueField​(uk.ac.starlink.table.ValueInfo info, ValueConverter[] convs)` | Constructs a value field given a ValueInfo object.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `javax.swing.JComboBox<ValueConverter>` | `getConverterSelector()` | Returns the combo box used to select the entry format used by this field.
    `uk.ac.starlink.table.DescribedValue` | `getDescribedValue()` | Returns a described value object (metadata+data) which describes the value currently held by this field.
    `javax.swing.JTextField` | `getEntryField()` | Returns this field's text entry component.
    `javax.swing.JLabel` | `getLabel()` | Returns this field's label componnent.
    `double` | `getValue()` | Returns the numeric value which the user has entered.
    `uk.ac.starlink.table.DefaultValueInfo` | `getValueInfo()` | Returns the ValueInfo object which describes the data in this field.
    `static DoubleValueField` | `makeDecDegreesField()` | Returns an instance suitable for entering Declination for which `getValue()` returns degrees.
    `static DoubleValueField` | `makeRADegreesField()` | Returns an instance suitable for entering Right Ascension, for which `getValue()` returns degrees.
    `static DoubleValueField` | `makeSizeDegreesField​(uk.ac.starlink.table.ValueInfo info)` | Returns an instance suitable for entering an angular size, for which `getValue()` returns degrees.
    `void` | `setDescription​(java.lang.String description)` | Sets the description of this field.
    `void` | `setEnabled​(boolean enabled)` | Sets the enabled status of the user-interacting components of this field.
    `void` | `setValue​(double value)` | Sets the state of the GUI component controlled by this field.

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

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

- - ### Constructor Detail

    - #### DoubleValueField

          public DoubleValueField​(java.lang.String name,
                                  ValueConverter[] convs)

      Constructs a value field given its name.
      Parameters:
        `name` - field name
        `convs` - list of converter objects

    - #### DoubleValueField

          public DoubleValueField​(uk.ac.starlink.table.ValueInfo info,
                                  ValueConverter[] convs)

      Constructs a value field given a ValueInfo object.
      Parameters:
        `info` - field metadata
        `convs` - list of converter objects

  - ### Method Detail

    - #### getValueInfo

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

      Returns the ValueInfo object which describes the data in this field.
      Returns:
        metadata object for this field

    - #### setDescription

          public void setDescription​(java.lang.String description)

      Sets the description of this field. This may be presented as a tool tip and stored in the metadata associated with this field.
      Parameters:
        `description` - description of field

    - #### getDescribedValue

          public uk.ac.starlink.table.DescribedValue getDescribedValue()

      Returns a described value object (metadata+data) which describes the value currently held by this field.
      Returns:
        content of this field

    - #### getLabel

          public javax.swing.JLabel getLabel()

      Returns this field's label componnent.
      Returns:
        label

    - #### getEntryField

          public javax.swing.JTextField getEntryField()

      Returns this field's text entry component.
      Returns:
        entry field

    - #### getConverterSelector

          public javax.swing.JComboBox<ValueConverter> getConverterSelector()

      Returns the combo box used to select the entry format used by this field.
      Returns:
        format selector

    - #### getValue

          public double getValue()

      Returns the numeric value which the user has entered. This may be modified according to which format convertor is currently selected.
      Returns:
        field value
      Throws:
        `java.lang.IllegalArgumentException` - if the current contents of the entry field don't make sense to the current format selector

    - #### setValue

          public void setValue​(double value)

      Sets the state of the GUI component controlled by this field.
      Parameters:
        `value` - value to display

    - #### setEnabled

          public void setEnabled​(boolean enabled)

      Sets the enabled status of the user-interacting components of this field.
      Parameters:
        `enabled` - whether this component is to be enabled or not

    - #### makeRADegreesField

          public static DoubleValueField makeRADegreesField()

      Returns an instance suitable for entering Right Ascension, for which `getValue()` returns degrees.
      Returns:
        ra field

    - #### makeDecDegreesField

          public static DoubleValueField makeDecDegreesField()

      Returns an instance suitable for entering Declination for which `getValue()` returns degrees.
      Returns:
        dec field

    - #### makeSizeDegreesField

          public static DoubleValueField makeSizeDegreesField​(uk.ac.starlink.table.ValueInfo info)

      Returns an instance suitable for entering an angular size, for which `getValue()` returns degrees.
      Parameters:
        `info` - description of field content
      Returns:
        angular size field