# Class FormControl

java.lang.Object
uk.ac.starlink.topcat.plot2.FormControl

All Implemented Interfaces:
  `Control`

Direct Known Subclasses:
  `ModeFormControl, SimpleFormControl`

public abstract class FormControl extends Object implements Control
Control for providing coordinate and configuration information additional to base position coords and config. Combining the information gathered from this control with base config and coords provides enough to generate a PlotLayer.

Since:
  15 Mar 2013
Author:
  Mark Taylor

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`FormControl(Configger baseConfigger)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`addActionListener(ActionListener listener)`
Adds a listener to be messaged when the state of this control changes in a way which might affect the plot layer it would create.
`uk.ac.starlink.ttools.plot2.PlotLayer`
`createLayer(uk.ac.starlink.ttools.plot2.DataGeom geom, uk.ac.starlink.ttools.plot2.data.DataSpec dataSpec, RowSubset subset)`
Creates a plot layer given the current state of this control and some additional information.
`ActionListener`
`getActionForwarder()`
Returns an object which will forward actions to listeners registered with this panel.
`protected abstract uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[]`
`getConfigKeys()`
Returns the keys defining the additional configuration required by this control.
`Icon`
`getControlIcon()`
Returns an icon to represent this control, visible in the stack.
`String`
`getControlLabel()`
Returns a short string to label this control, visible in the stack.
`protected abstract JComponent`
`getCoordPanel()`
Returns the panel into which the user enters additional coordinate information required for this control, if any.
`abstract uk.ac.starlink.ttools.plot2.config.ConfigMap`
`getExtraConfig()`
Returns the additional configuration entered by the user in this control.
`abstract GuiCoordContent[]`
`getExtraCoordContents()`
Returns the data and metadata for the additional coordinates entered by the user in this control.
`JComponent`
`getPanel()`
Returns the GUI component that is the business end of this control.
`protected abstract uk.ac.starlink.ttools.plot2.Plotter<?>`
`getPlotter()`
Returns the Plotter object which generates plot layers from the information provided by this control
`FormStylePanel`
`getStylePanel()`
Returns the style panel currently in use.
`void`
`removeActionListener(ActionListener listener)`
Removes a previously added listener.
`protected abstract void`
`setTable(TopcatModel tcModel)`
Performs implementation-specific configuration of this control for a given TopcatModel.
`void`
`setTable(TopcatModel tcModel, SubsetConfigManager subManager, SubsetStack subStack)`
Configures this control for use with a given TopcatModel.
`void`
`submitReports(Map<RowSubset, uk.ac.starlink.ttools.plot2.ReportMap> reports)`
Accepts plot reports generated by plotting layers.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### FormControl

protected FormControl(Configger baseConfigger)
Constructor.

Parameters:
  `baseConfigger` - provides global configuration info

## Method Details

### getCoordPanel

protected abstract JComponent getCoordPanel()
Returns the panel into which the user enters additional coordinate information required for this control, if any.

Returns:
  coordinate entry panel

### getPlotter

protected abstract uk.ac.starlink.ttools.plot2.Plotter<?> getPlotter()
Returns the Plotter object which generates plot layers from the information provided by this control

Returns:
  plotter

### getConfigKeys

protected abstract uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] getConfigKeys()
Returns the keys defining the additional configuration required by this control.

Returns:
  config keys

### getPanel

public JComponent getPanel()
Description copied from interface: `Control`
Returns the GUI component that is the business end of this control. It will typically contain components for user interaction.

Specified by:
  `getPanel` in interface `Control`
Returns:
  this controls graphical component

### getExtraCoordContents

public abstract GuiCoordContent[] getExtraCoordContents()
Returns the data and metadata for the additional coordinates entered by the user in this control. If these constitute insufficient information to generate a plot (not all required coords have been filled in), null is returned.

Returns:
  extra coordinate information, or null if incomplete

### getExtraConfig

public abstract uk.ac.starlink.ttools.plot2.config.ConfigMap getExtraConfig()
Returns the additional configuration entered by the user in this control.

Returns:
  extra config information

### setTable

public void setTable(TopcatModel tcModel, SubsetConfigManager subManager, SubsetStack subStack)
Configures this control for use with a given TopcatModel. The subset manager is supplied as well to provide subset-specific configuration defaults.

Parameters:
  `tcModel` - topcat model
  `subManager` - subset manager with info about the row subsets for `tcModel`
  `subStack` - subset stack controlling/displaying subset visibility

### setTable

protected abstract void setTable(TopcatModel tcModel)
Performs implementation-specific configuration of this control for a given TopcatModel.

Parameters:
  `tcModel` - new topcat model to install

### getStylePanel

public FormStylePanel getStylePanel()
Returns the style panel currently in use.

Returns:
  style panel

### createLayer

public uk.ac.starlink.ttools.plot2.PlotLayer createLayer(uk.ac.starlink.ttools.plot2.DataGeom geom, uk.ac.starlink.ttools.plot2.data.DataSpec dataSpec, RowSubset subset)
Creates a plot layer given the current state of this control and some additional information.

Parameters:
  `geom` - data position geometry
  `dataSpec` - data specification, which must contain any data required by this control's extra coords and be set up for the given subset
  `subset` - row subset in the current table for which the layer is to be plotted
Returns:
  new plot layer, may be null in case of incorrect GUI config

### getActionForwarder

public ActionListener getActionForwarder()
Returns an object which will forward actions to listeners registered with this panel.

Returns:
  action forwarder

### addActionListener

public void addActionListener(ActionListener listener)
Adds a listener to be messaged when the state of this control changes in a way which might affect the plot layer it would create.

Specified by:
  `addActionListener` in interface `Control`
Parameters:
  `listener` - listener to add

### removeActionListener

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

Specified by:
  `removeActionListener` in interface `Control`
Parameters:
  `listener` - to remove

### getControlLabel

public String getControlLabel()
Description copied from interface: `Control`
Returns a short string to label this control, visible in the stack.

Specified by:
  `getControlLabel` in interface `Control`
Returns:
  label

### getControlIcon

public Icon getControlIcon()
Description copied from interface: `Control`
Returns an icon to represent this control, visible in the stack.

Specified by:
  `getControlIcon` in interface `Control`
Returns:
  icon

### submitReports

public void submitReports(Map<RowSubset, uk.ac.starlink.ttools.plot2.ReportMap> reports)
Accepts plot reports generated by plotting layers. The supplied map is indexed by RowSubset.

Parameters:
  `reports` - map of row subsets to plot reports