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
public class ChoiceConfigurator extends AbstractActivatorConfigurator
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 Constructor Description ChoiceConfigurator(ActivatorConfigurator[] configurators)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Activator
getActivator()
Constructs an activator in accordance with the current state of this GUI.java.lang.String
getConfigMessage()
Returns a short status message for display to the user.Safety
getSafety()
Indicates whether an activator created by the current state of this configurator is known to be harmless.ConfigState
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 Detail
-
ChoiceConfigurator
public ChoiceConfigurator(ActivatorConfigurator[] configurators)
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 Detail
-
getActivator
public Activator 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:
ActivatorConfigurator.getConfigMessage()
-
getConfigMessage
public java.lang.String 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
public Safety 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
public ConfigState 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
public void setState(ConfigState state)
Description copied from interface:ActivatorConfigurator
Restores the state of this object from a given state object.- Parameters:
state
- stored state
-
-