uk.ac.starlink.ttools.plot2.config
Class IntegerConfigKey

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.config.ConfigKey<Integer>
      extended by uk.ac.starlink.ttools.plot2.config.IntegerConfigKey

public abstract class IntegerConfigKey
extends ConfigKey<Integer>

Config key for integer values.

Since:
22 Feb 2013
Author:
Mark Taylor

Constructor Summary
protected IntegerConfigKey(ConfigMeta meta, int dflt)
          Constructor.
 
Method Summary
static IntegerConfigKey createSliderKey(ConfigMeta meta, int dflt, double lo, double hi, boolean log)
          Returns a config key that uses a SliderSpecifier.
static IntegerConfigKey createSpinnerKey(ConfigMeta meta, int dflt, int lo, int hi)
          Returns a config key that uses a JSpinner for the specifier.
 Integer stringToValue(String txt)
          Decodes a string value to the value type of this key.
 String valueToString(Integer value)
          Reports a value as a string.
 
Methods inherited from class uk.ac.starlink.ttools.plot2.config.ConfigKey
cast, createSpecifier, getDefaultValue, getMeta, getValueClass, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerConfigKey

protected IntegerConfigKey(ConfigMeta meta,
                           int dflt)
Constructor.

Parameters:
meta - metadata
dflt - default value
Method Detail

stringToValue

public Integer stringToValue(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<Integer>
Parameters:
txt - string representation of value
Returns:
value
Throws:
ConfigException

valueToString

public String valueToString(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<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

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


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.