Package uk.ac.starlink.topcat.activate
Class ChoiceConfigurator
java.lang.Object
uk.ac.starlink.topcat.activate.AbstractActivatorConfigurator
uk.ac.starlink.topcat.activate.ChoiceConfigurator
- All Implemented Interfaces:
ActivatorConfigurator
ActivatorConfigurator implementation that allows the user to choose
between a number of supplied GUI options.
- Since:
- 22 Jun 2022
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConstructs an activator in accordance with the current state of this GUI.Returns a short status message for display to the user.Indicates whether an activator created by the current state of this configurator is known to be harmless.getState()
Returns an object that contains the current state of this configurator.void
setState
(ConfigState state) Restores the state of this object from a given state object.Methods inherited from class uk.ac.starlink.topcat.activate.AbstractActivatorConfigurator
addActionListener, createDisplayField, createDisplayLabel, getActionForwarder, getPanel, removeActionListener
-
Constructor Details
-
ChoiceConfigurator
Constructor. A list of supplied configurator options is provided. Note that in addition to the normal ActivatorConfigurator interface, these instances ought to provide a human-readable implementation ofObject.toString()
, and the component returned by theirActivatorConfigurator.getPanel()
method should give a visual indication for its {JComponent#setEnabled enabled} property.- Parameters:
configurators
- configurator options
-
-
Method Details
-
getActivator
Description copied from interface:ActivatorConfigurator
Constructs an activator in accordance with the current state of this GUI. If the current state not an adequate specification, null may be returned. In that case, the getConfigMessage method should generally provide an explanation.This method may be called often, so should be cheap to invoke. The idea is that it will be called immediately before the activator is used, so the returned object may fix, rather than arrange to gather at a later date, information acquired from the GUI.
- Returns:
- currently configured activator, or null
- See Also:
-
getConfigMessage
Description copied from interface:ActivatorConfigurator
Returns a short status message for display to the user. This is supposed to be a comment, if one is needed, on the current state of the configuration.As a rule, exactly one of this method and the
getActivator
should return null. If there is no activator, this method should return some reason why the configuration is incorrect or incomplete, and otherwise it should return null.- Returns:
- message, typically indicating configuration problems, or null
-
getSafety
Description copied from interface:ActivatorConfigurator
Indicates whether an activator created by the current state of this configurator is known to be harmless.Implementations should be cautious; if some slightly adjusted state might be dangerous, false could be returned as well (that's why this method is on ActivatorConfigurator and not Activator itself).
- Returns:
- safety status of the currently configured state
-
getState
Description copied from interface:ActivatorConfigurator
Returns an object that contains the current state of this configurator. This includes options selected by the user, but does not include any description of the table on which this configurator is working.- Returns:
- configuration state
-
setState
Description copied from interface:ActivatorConfigurator
Restores the state of this object from a given state object.- Parameters:
state
- stored state
-