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

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.config.ConfigKey<Subrange>
      extended by uk.ac.starlink.ttools.plot2.config.SubrangeConfigKey

public class SubrangeConfigKey
extends ConfigKey<Subrange>

Config key that specifies a Subrange.

Since:
23 Feb 2013
Author:
Mark Taylor

Constructor Summary
SubrangeConfigKey(ConfigMeta meta)
          Constructs a key with the usual default.
SubrangeConfigKey(ConfigMeta meta, Subrange dflt, double vmin, double vmax)
          Constructs a key with a given default.
 
Method Summary
static ConfigMeta createAxisSubMeta(String axname, String axisName)
          Returns a metadata object to describe a SubrangeConfigKey for use with a coordinate axis.
static ConfigMeta createShaderClipMeta(String axname, String axisName)
          Returns a metadaa object to describe a SubrangeConfigKey for use as a restriction on a colour ramp (Shader).
 Specifier<Subrange> createSpecifier()
          Constructs a graphical control with which the user can specify a suitable value for association with this key.
 Subrange stringToValue(String txt)
          Decodes a string value to the value type of this key.
 String valueToString(Subrange value)
          Reports a value as a string.
 
Methods inherited from class uk.ac.starlink.ttools.plot2.config.ConfigKey
cast, getDefaultValue, getMeta, getValueClass, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubrangeConfigKey

public SubrangeConfigKey(ConfigMeta meta,
                         Subrange dflt,
                         double vmin,
                         double vmax)
Constructs a key with a given default. The vmin and vmax parameters do not impose any hard limits on the value associated with this key, but they influence the values offered by the Specifier component.

Parameters:
meta - metadata
dflt - default subrange
vmin - minimum value suggested by GUI
vmax - maximum value suggested by GUI

SubrangeConfigKey

public SubrangeConfigKey(ConfigMeta meta)
Constructs a key with the usual default. The default subrange covers the whole range 0..1.

Parameters:
meta - metadata
Method Detail

valueToString

public String valueToString(Subrange 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<Subrange>
Parameters:
value - possible value associated with this key
Returns:
string representation

stringToValue

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

createSpecifier

public Specifier<Subrange> createSpecifier()
Description copied from class: ConfigKey
Constructs a graphical control with which the user can specify a suitable value for association with this key.

Specified by:
createSpecifier in class ConfigKey<Subrange>
Returns:
new specifier

createAxisSubMeta

public static ConfigMeta createAxisSubMeta(String axname,
                                           String axisName)
Returns a metadata object to describe a SubrangeConfigKey for use with a coordinate axis.

Parameters:
axname - abbreviated axis name (for CLI)
axisName - full axis name (for GUI)
Returns:
metadata object describing a subrange config key for an axis

createShaderClipMeta

public static ConfigMeta createShaderClipMeta(String axname,
                                              String axisName)
Returns a metadaa object to describe a SubrangeConfigKey for use as a restriction on a colour ramp (Shader).

Parameters:
axname - abbreviated axis name (for CLI)
axisName - full axis name (for GUI)
Returns:
metadata object describing a subrange config key for a shader


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