Class IntegerConfigKey
java.lang.Object
uk.ac.starlink.ttools.plot2.config.ConfigKey<Integer>
uk.ac.starlink.ttools.plot2.config.IntegerConfigKey
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IntegerConfigKeycreateSliderKey(ConfigMeta meta, int dflt, double lo, double hi, boolean log) Returns a config key that uses a SliderSpecifier.static IntegerConfigKeycreateSpinnerKey(ConfigMeta meta, int dflt, int lo, int hi) Returns a config key that uses a JSpinner for the specifier.static IntegerConfigKeycreateSpinnerPairKey(ConfigMeta meta, int dflt, int posLimit, int negLimit, String posLabel, String negLabel, ReportKey<Integer> posReportKey, ReportKey<Integer> negReportKey) Returns a config key that uses two JSpinners to specify either a positive or a negative value.stringToValue(String txt) Decodes a string value to the value type of this key.valueToString(Integer value) Reports a value as a string.Methods inherited from class ConfigKey
cast, createSpecifier, getDefaultValue, getMeta, getValueClass, toString
-
Constructor Details
-
IntegerConfigKey
Constructor.- Parameters:
meta- metadatadflt- default value
-
-
Method Details
-
stringToValue
Description copied from class:ConfigKeyDecodes 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:
stringToValuein classConfigKey<Integer>- Parameters:
txt- string representation of value- Returns:
- value
- Throws:
ConfigException
-
valueToString
Description copied from class:ConfigKeyReports 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:
valueToStringin classConfigKey<Integer>- Parameters:
value- possible value associated with this key- Returns:
- string representation
-
createSpinnerKey
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, String posLabel, String negLabel, ReportKey<Integer> posReportKey, ReportKey<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
-