Class IntegerConfigKey
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.config.ConfigKey<java.lang.Integer>
-
- uk.ac.starlink.ttools.plot2.config.IntegerConfigKey
-
public abstract class IntegerConfigKey extends ConfigKey<java.lang.Integer>
Config key for integer values.- Since:
- 22 Feb 2013
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
IntegerConfigKey(ConfigMeta meta, int dflt)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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.java.lang.Integer
stringToValue(java.lang.String txt)
Decodes a string value to the value type of this key.java.lang.String
valueToString(java.lang.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
-
-
-
-
Constructor Detail
-
IntegerConfigKey
protected IntegerConfigKey(ConfigMeta meta, int dflt)
Constructor.- Parameters:
meta
- metadatadflt
- 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 classConfigKey<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, sostringToValue(valueToString(v)).equals(v)
. A null value, if permitted, should be represented as an empty string.- Specified by:
valueToString
in classConfigKey<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
- metadatadflt
- default valuelo
- minimum value offered by spinnerhi
- 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
- metadatadflt
- default valueposLimit
- maximum value (positive)negLimit
- minimum value (negative)posLabel
- label for positive value spinnernegLabel
- label for negative value spinnerposReportKey
- key to report actual value used as positive; may be nullnegReportKey
- 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
- metadatadflt
- default valuelo
- minimum of slider rangehi
- maximum of slider rangelog
- true for logarithmic scale, false for linear
-
-