Class IntegerConfigKey


  • public abstract class IntegerConfigKey
    extends ConfigKey<java.lang.Integer>
    Config key for integer values.
    Since:
    22 Feb 2013
    Author:
    Mark Taylor
    • Constructor Detail

      • IntegerConfigKey

        protected IntegerConfigKey​(ConfigMeta meta,
                                   int dflt)
        Constructor.
        Parameters:
        meta - metadata
        dflt - default value
    • Method Detail

      • stringToValue

        public java.lang.Integer stringToValue​(java.lang.String txt)
                                        throws ConfigException
        Description copied from class: ConfigKey
        Decodes a string value to the value type of this key. An empty string should be interpreted as a null value, but this may cause an exception if null is not a permissible value for this key.
        Specified by:
        stringToValue in class ConfigKey<java.lang.Integer>
        Parameters:
        txt - string representation of value
        Returns:
        value
        Throws:
        ConfigException
      • valueToString

        public java.lang.String valueToString​(java.lang.Integer value)
        Description copied from class: ConfigKey
        Reports a value as a string. If at all possible the roundtripping should be possible, so stringToValue(valueToString(v)).equals(v). A null value, if permitted, should be represented as an empty string.
        Specified by:
        valueToString in class ConfigKey<java.lang.Integer>
        Parameters:
        value - possible value associated with this key
        Returns:
        string representation
      • createSpinnerKey

        public static IntegerConfigKey createSpinnerKey​(ConfigMeta meta,
                                                        int dflt,
                                                        int lo,
                                                        int hi)
        Returns a config key that uses a JSpinner for the specifier.
        Parameters:
        meta - metadata
        dflt - default value
        lo - minimum value offered by spinner
        hi - maximum value offered by spinner
      • createSpinnerPairKey

        public static IntegerConfigKey createSpinnerPairKey​(ConfigMeta meta,
                                                            int dflt,
                                                            int posLimit,
                                                            int negLimit,
                                                            java.lang.String posLabel,
                                                            java.lang.String negLabel,
                                                            ReportKey<java.lang.Integer> posReportKey,
                                                            ReportKey<java.lang.Integer> negReportKey)
        Returns a config key that uses two JSpinners to specify either a positive or a negative value. This is a bit specialised (currently used for SkyDensityPlotter), but might possibly be useful in other contexts.
        Parameters:
        meta - metadata
        dflt - default value
        posLimit - maximum value (positive)
        negLimit - minimum value (negative)
        posLabel - label for positive value spinner
        negLabel - label for negative value spinner
        posReportKey - key to report actual value used as positive; may be null
        negReportKey - key to report actual value used as negative; may be null
      • createSliderKey

        public static IntegerConfigKey createSliderKey​(ConfigMeta meta,
                                                       int dflt,
                                                       double lo,
                                                       double hi,
                                                       boolean log)
        Returns a config key that uses a SliderSpecifier. Note that in case of log=true, you must not supply 0 for the lower value.
        Parameters:
        meta - metadata
        dflt - default value
        lo - minimum of slider range
        hi - maximum of slider range
        log - true for logarithmic scale, false for linear