Class PerUnitConfigKey<U extends Unit>
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.config.ConfigKey<T>
-
- 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'sCombiner.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, java.lang.Class<U> clazz, U[] options, U dflt)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods 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.java.lang.String
getXmlDescription(U unit)
Returns a description in XML of the given option value.-
Methods inherited from class uk.ac.starlink.ttools.plot2.config.OptionConfigKey
addOptionsXml, getOptions, getOptionsXml, setOptionUsage, stringToValue, valueToString
-
Methods inherited from class uk.ac.starlink.ttools.plot2.config.ConfigKey
cast, getDefaultValue, getMeta, getValueClass, toString
-
-
-
-
Constructor Detail
-
PerUnitConfigKey
public PerUnitConfigKey(ConfigMeta meta, java.lang.Class<U> clazz, U[] options, U dflt)
Constructor.- Parameters:
meta
- metadataclazz
- class to which all the possible options belongoptions
- array of possible values for this keydflt
- default option, should be one ofoptions
-
-
Method Detail
-
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 java.lang.String getXmlDescription(U unit)
Description copied from class:OptionConfigKey
Returns a description in XML of the given option value. This, along withOptionConfigKey.valueToString(T)
, is used by theOptionConfigKey.getOptionsXml()
method to assemble a described list of the options.- Specified by:
getXmlDescription
in classOptionConfigKey<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 classOptionConfigKey<U extends Unit>
- Returns:
- new specifier
-
-