# Class ShaderConfigKey

java.lang.Object
uk.ac.starlink.ttools.plot2.config.ConfigKey<Shader>
uk.ac.starlink.ttools.plot2.config.ChoiceConfigKey<Shader>
uk.ac.starlink.ttools.plot2.config.ShaderConfigKey

public class ShaderConfigKey extends ChoiceConfigKey<Shader>
ConfigKey for selecting shader objects.

Since:
  9 Sep 2014
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`ShaderConfigKey(ConfigMeta meta, Shader[] shaders, Shader dflt)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`ShaderConfigKey`
`appendShaderDescription()`
Appends a list of the available shaders, as well as rules for naming custom ones, to the end of the existing XML documentation for this key.
`static ConfigMeta`
`createAxisMeta(String shortName, String longName, String axName)`
Creates a key description suitable for a colour map applied to a named axis.
`Specifier<Shader>`
`createSpecifier()`
Constructs a graphical control with which the user can specify a suitable value for association with this key.
`Shader`
`decodeString(String sval)`
Takes a string, and attempts to turn it into an object which may be a value for this key.
`String`
`stringifyValue(Shader value)`
Takes an object which may be a value of this key, and attempts to turn it into a string for reporting purposes.

### Methods inherited from class ChoiceConfigKey

`addOption, getOptionMap, stringToValue, valueToString`

### Methods inherited from class ConfigKey

`cast, getDefaultValue, getMeta, getValueClass, toString`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### ShaderConfigKey

public ShaderConfigKey(ConfigMeta meta, Shader[] shaders, Shader dflt)
Constructor.

Parameters:
  `meta` - metadata
  `shaders` - list of options
  `dflt` - default value

## Method Details

### decodeString

public Shader decodeString(String sval)
Description copied from class: `ChoiceConfigKey`
Takes a string, and attempts to turn it into an object which may be a value for this key. If the string is not of a recognised form, null is returned.

This method should be the opposite of `ChoiceConfigKey.stringifyValue(T)`, but does not need to be consistent with `stringToValue` or `valueToString`.

Specified by:
  `decodeString` in class `ChoiceConfigKey<Shader>`
Parameters:
  `sval` - string representation
Returns:
  typed object represented by sval, or null

### stringifyValue

public String stringifyValue(Shader value)
Description copied from class: `ChoiceConfigKey`
Takes an object which may be a value of this key, and attempts to turn it into a string for reporting purposes.

This method should if possible be the opposite of `ChoiceConfigKey.decodeString(String)`, but does not need to be consistent with `stringToValue` or `valueToString`. If no round-trippable value is available, null should be returned.

Specified by:
  `stringifyValue` in class `ChoiceConfigKey<Shader>`
Parameters:
  `value` - typed object
Returns:
  string representing object, or null

### createSpecifier

public Specifier<Shader> 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<Shader>`
Returns:
  new specifier

### appendShaderDescription

public ShaderConfigKey appendShaderDescription()
Appends a list of the available shaders, as well as rules for naming custom ones, to the end of the existing XML documentation for this key.

Returns:
  this object, as a convenience

### createAxisMeta

public static ConfigMeta createAxisMeta(String shortName, String longName, String axName)
Creates a key description suitable for a colour map applied to a named axis.

Parameters:
  `shortName` - metadata short name
  `longName` - metadata long name
  `axName` - user-readable name of axis to which this applies
Returns:
  new metadata object