Package uk.ac.starlink.topcat.plot2
Class ConfigSpecifier
java.lang.Object
uk.ac.starlink.ttools.plot2.config.SpecifierPanel<uk.ac.starlink.ttools.plot2.config.ConfigMap>
uk.ac.starlink.topcat.plot2.ConfigSpecifier
- All Implemented Interfaces:
uk.ac.starlink.ttools.plot2.config.Specifier<uk.ac.starlink.ttools.plot2.config.ConfigMap>
- Direct Known Subclasses:
AutoConfigSpecifier
,OptionalConfigSpecifier
public class ConfigSpecifier
extends uk.ac.starlink.ttools.plot2.config.SpecifierPanel<uk.ac.starlink.ttools.plot2.config.ConfigMap>
Specifier which supplies a ConfigMap.
This just aggregates specifiers for a given set of ConfigKeys;
the GUI component contains a specifier component for each key,
and the specified value is a map containing the values for each key.
By default the GUI component is just a stack of the constituent
specifier components, but these can be decorated by supplying
a suitable ConfigSpecifier.ComponentGui
object.
The checkConfig
method provides a hook for
additional conditions that will be applied to the ConfigMap output
values from this specifier.
- Since:
- 12 Mar 2013
- Author:
- Mark Taylor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
GUI component policy. -
Constructor Summary
ConstructorsConstructorDescriptionConfigSpecifier
(uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] keys) Constructs a config specifier with a default GUI.ConfigSpecifier
(uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] keys, ConfigSpecifier.ComponentGui gui) Constructs a config specifier with a custom GUI for constituent keys. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkConfig
(uk.ac.starlink.ttools.plot2.config.ConfigMap config) Performs additional checks on the result produced by this specifier prior to returning the value fromgetSpecifiedValue()
.static void
checkRangeSense
(uk.ac.starlink.ttools.plot2.config.ConfigMap config, String axName, uk.ac.starlink.ttools.plot2.config.ConfigKey<Double> minKey, uk.ac.starlink.ttools.plot2.config.ConfigKey<Double> maxKey) Utility method to check that min/max keys specifying a range are not the wrong way round.protected JComponent
uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[]
Returns the keys for which this specifier gathers values.uk.ac.starlink.ttools.plot2.config.ConfigMap
<T> uk.ac.starlink.ttools.plot2.config.Specifier
<T> getSpecifier
(uk.ac.starlink.ttools.plot2.config.ConfigKey<T> key) Returns the individual specifier used to gather values for a particular key owned by this object.void
reportError
(uk.ac.starlink.ttools.plot2.config.ConfigException err) May be used by a client of this specifier to report an error associated with one of the config values obtained by this specifier.void
setSpecifiedValue
(uk.ac.starlink.ttools.plot2.config.ConfigMap configMap) void
submitReport
(uk.ac.starlink.ttools.plot2.ReportMap report) Methods inherited from class uk.ac.starlink.ttools.plot2.config.SpecifierPanel
addActionListener, fireAction, getActionForwarder, getChangeForwarder, getComponent, isXFill, removeActionListener
-
Constructor Details
-
ConfigSpecifier
public ConfigSpecifier(uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] keys) Constructs a config specifier with a default GUI.- Parameters:
keys
- config keys to gather values for
-
ConfigSpecifier
public ConfigSpecifier(uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] keys, ConfigSpecifier.ComponentGui gui) Constructs a config specifier with a custom GUI for constituent keys.- Parameters:
keys
- config keys to gather values forgui
- specifier generation factory that can provide customised specifiers for different keys
-
-
Method Details
-
createComponent
- Specified by:
createComponent
in classuk.ac.starlink.ttools.plot2.config.SpecifierPanel<uk.ac.starlink.ttools.plot2.config.ConfigMap>
-
getSpecifiedValue
public uk.ac.starlink.ttools.plot2.config.ConfigMap getSpecifiedValue() -
checkConfig
protected void checkConfig(uk.ac.starlink.ttools.plot2.config.ConfigMap config) throws uk.ac.starlink.ttools.plot2.config.ConfigException Performs additional checks on the result produced by this specifier prior to returning the value fromgetSpecifiedValue()
. If something is wrong with the suppliedconfig
, implementations may throw a ConfigException here to indicate the problem. Per-key specifiers ought in general to police the values that they return, but this method provides a hook for checks applying to disallowed interactions between individually legal values.The default implementation does nothing.
- Parameters:
config
- config map to check- Throws:
uk.ac.starlink.ttools.plot2.config.ConfigException
- if there's something wrong with the supplied map- See Also:
-
setSpecifiedValue
public void setSpecifiedValue(uk.ac.starlink.ttools.plot2.config.ConfigMap configMap) -
submitReport
public void submitReport(uk.ac.starlink.ttools.plot2.ReportMap report) -
getConfigKeys
public uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] getConfigKeys()Returns the keys for which this specifier gathers values.- Returns:
- config keys
-
getSpecifier
public <T> uk.ac.starlink.ttools.plot2.config.Specifier<T> getSpecifier(uk.ac.starlink.ttools.plot2.config.ConfigKey<T> key) Returns the individual specifier used to gather values for a particular key owned by this object.- Parameters:
key
- config key- Returns:
- specifier for key
-
reportError
public void reportError(uk.ac.starlink.ttools.plot2.config.ConfigException err) May be used by a client of this specifier to report an error associated with one of the config values obtained by this specifier. The error will be presented to the user somehow or other, and the state of the component will be altered so that the same error doesn't keep happening, at least not without further user activity.- Parameters:
err
- error encountered in using a value supplied by this specifier
-
checkRangeSense
public static void checkRangeSense(uk.ac.starlink.ttools.plot2.config.ConfigMap config, String axName, uk.ac.starlink.ttools.plot2.config.ConfigKey<Double> minKey, uk.ac.starlink.ttools.plot2.config.ConfigKey<Double> maxKey) throws uk.ac.starlink.ttools.plot2.config.ConfigException Utility method to check that min/max keys specifying a range are not the wrong way round. Note that indefinite values at either end are OK.- Parameters:
config
- config mapaxName
- axis name, used for error messagesminKey
- config key for minimum valuemaxKey
- config key for maximum value- Throws:
uk.ac.starlink.ttools.plot2.config.ConfigException
- if the min value is definitely greater than or equal to the max value
-