Package uk.ac.starlink.topcat.activate

# Interface ActivatorConfigurator

All Known Implementing Classes:
  `AbstractActivatorConfigurator`, `ChoiceConfigurator`, `Hips2fitsConfigurator`, `SkyPosConfigurator`, `UrlColumnConfigurator`

public interface ActivatorConfigurator
Defines a GUI component that the user can interact with to specify an activation action. This is a GUI factory for Activator instances.

Since:
  23 Jan 2018
Author:
  Mark Taylor

## Method Summary

Modifier and Type
Method
Description
`void`
`addActionListener(ActionListener listener)`
Adds a listener that will be informed when the GUI state changes in such a way that the result of `getActivator` or `getConfigMessage` may change.
`Activator`
`getActivator()`
Constructs an activator in accordance with the current state of this GUI.
`String`
`getConfigMessage()`
Returns a short status message for display to the user.
`JComponent`
`getPanel()`
Returns the GUI component with which the user can interact.
`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`
`removeActionListener(ActionListener listener)`
Removes a previously added listener.
`void`
`setState(ConfigState state)`
Restores the state of this object from a given state object.

## Method Details

### getPanel

JComponent getPanel()
Returns the GUI component with which the user can interact.

Returns:
  configuration panel

### getActivator

Activator getActivator()
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()`

### getConfigMessage

String getConfigMessage()
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

### addActionListener

void addActionListener(ActionListener listener)
Adds a listener that will be informed when the GUI state changes in such a way that the result of `getActivator` or `getConfigMessage` may change.

Parameters:
  `listener` - listener to add

### removeActionListener

void removeActionListener(ActionListener listener)
Removes a previously added listener.

Parameters:
  `listener` - listener to remove

### getState

ConfigState getState()
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

void setState(ConfigState state)
Restores the state of this object from a given state object.

Parameters:
  `state` - stored state

### getSafety

Safety getSafety()
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