# Class PerUnitConfigKey<U extends Unit>

java.lang.Object
uk.ac.starlink.ttools.plot2.config.ConfigKey<U>
uk.ac.starlink.ttools.plot2.config.OptionConfigKey<U>
uk.ac.starlink.ttools.plot2.config.PerUnitConfigKey<U>

public class PerUnitConfigKey<U extends Unit> extends OptionConfigKey<U>
ConfigKey for unit selection. The main trick this OptionConfigKey subclass has is to manage Reporting of a plot's `Combiner.Type`, so it can work in concert with a Combiner config key to provide a more comprehensible GUI. If the Combiner is not density-like, then this selector is irrelevant, and so the GUI component is disabled. Client PlotLayers should assemble ReportMaps with the ReportKey from this ConfigKeys' `getCombinerTypeReportKey()` method filled in appropriately.

Since:
  25 Jan 2018
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`PerUnitConfigKey(ConfigMeta meta, Class<U> clazz, U[] options, U dflt)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`Specifier<U>`
`createSpecifier()`
Constructs a graphical control with which the user can specify a suitable value for association with this key.
`ReportKey<Combiner.Type>`
`getCombinerTypeReportKey()`
Returns a ReportKey that client PlotLayers should fill in when generating their ReportMap.
`String`
`getXmlDescription(U unit)`
Returns a description in XML of the given option value.

### Methods inherited from class OptionConfigKey

`addOptionsXml, getOptions, getOptionsXml, setOptionUsage, 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

### PerUnitConfigKey

public PerUnitConfigKey(ConfigMeta meta, Class<U> clazz, U[] options, U dflt)
Constructor.

Parameters:
  `meta` - metadata
  `clazz` - class to which all the possible options belong
  `options` - array of possible values for this key
  `dflt` - default option, should be one of `options`

## Method Details

### getCombinerTypeReportKey

public ReportKey<Combiner.Type> getCombinerTypeReportKey()
Returns a ReportKey that client PlotLayers should fill in when generating their ReportMap.

Returns:
  combiner key report key

### getXmlDescription

public String getXmlDescription(U unit)
Description copied from class: `OptionConfigKey`
Returns a description in XML of the given option value. This, along with `OptionConfigKey.valueToString(T)`, is used by the `OptionConfigKey.getOptionsXml()` method to assemble a described list of the options.

Specified by:
  `getXmlDescription` in class `OptionConfigKey<U extends Unit>`
Parameters:
  `unit` - possible value of this key
Returns:
  short snippet of XML (not wrapped in any outer element) describing the value; may be null if no description required or available

### createSpecifier

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

Overrides:
  `createSpecifier` in class `OptionConfigKey<U extends Unit>`
Returns:
  new specifier