# Class MatrixPositionCoordPanel

java.lang.Object
uk.ac.starlink.topcat.plot2.BasicCoordPanel
uk.ac.starlink.topcat.plot2.SimplePositionCoordPanel
uk.ac.starlink.topcat.plot2.MatrixPositionCoordPanel

All Implemented Interfaces:
  `CoordPanel, PositionCoordPanel`

public class MatrixPositionCoordPanel extends SimplePositionCoordPanel
CoordPanel for specifying matrix plots. This has a variable number of coordinates, under the control of the user.

Since:
  20 Sep 2023
Author:
  Mark Taylor

## Nested Class Summary

### Nested classes/interfaces inherited from class BasicCoordPanel

`BasicCoordPanel.CoordStack`

## Constructor Summary

Constructors
Constructor
Description
`MatrixPositionCoordPanel()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`autoPopulate()`
Makes some attempt to fill in the fields with non-blank values.
`uk.ac.starlink.ttools.plot2.data.Coord[]`
`getAdditionalManagedCoords()`
Returns a list of coordinates which do not correspond to the selectors displayed here, but which should not be acquired by other means.
`GuiCoordContent[]`
`getContents()`
Returns the coordinate values currently selected in this panel.
`uk.ac.starlink.ttools.plot2.data.Coord[]`
`getCoords()`
Returns the coordinates which this panel is getting values for.
`List<uk.ac.starlink.util.Bi<String, JComponent>>`
`getExtraTabs()`
Returns definitions for additional tabs to add alongside the main Position tab in the FormLayerControl.
`int`
`getVisibleCoordCount()`
Returns the number of coordinate entry fields currently visible.
`boolean`
`isPreferredCoord(uk.ac.starlink.ttools.plot2.data.Coord coord)`
Indicates whether a coordinate is one that ought to get filled in if possible.
`void`
`setTable(TopcatModel tcModel, boolean autoFill)`
Sets the table with reference to which this panel will resolve coordinate descriptions.

### Methods inherited from class SimplePositionCoordPanel

`createPanel, getDataGeom`

### Methods inherited from class BasicCoordPanel

`addActionListener, addButtons, createDefaultStack, getActionForwarder, getColumnSelector, getComponent, getConfig, getConfigSpecifier, getInfos, getStack, getTable, multiplyCoords, populate, removeActionListener, setColumnSelector`

### Methods inherited from class Object

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

### Methods inherited from interface CoordPanel

`addActionListener, getColumnSelector, getComponent, getConfig, getConfigSpecifier, removeActionListener`

## Constructor Details

### MatrixPositionCoordPanel

public MatrixPositionCoordPanel()
Constructor.

## Method Details

### getVisibleCoordCount

public int getVisibleCoordCount()
Returns the number of coordinate entry fields currently visible.

Returns:
  number of coord entry fields

### getExtraTabs

public List<uk.ac.starlink.util.Bi<String, JComponent>> getExtraTabs()
Description copied from interface: `PositionCoordPanel`
Returns definitions for additional tabs to add alongside the main Position tab in the FormLayerControl. In most cases an empty list will be returned.

Returns:
  list of (TabName,TabContent) pairs to add

### isPreferredCoord

public boolean isPreferredCoord(uk.ac.starlink.ttools.plot2.data.Coord coord)
Description copied from class: `BasicCoordPanel`
Indicates whether a coordinate is one that ought to get filled in if possible. The CoordPanel implementation simply returns coord.`Coord.isRequired()`, but subclasses can override this if more nuanced behaviour is necessary.

In particular in order for autopopulation to work correctly, it may be necessary to return true for all members of a group of coordinates for which at least one has to be filled in for a viable plot.

Overrides:
  `isPreferredCoord` in class `BasicCoordPanel`
Parameters:
  `coord` - candidate coordinate
Returns:
  true if we should try hard to get a value

### autoPopulate

public void autoPopulate()
Description copied from class: `BasicCoordPanel`
Makes some attempt to fill in the fields with non-blank values. The default implementation fills in the first few suitable columns, but subclasses are encouraged to override this behaviour if something smarter is possible.

Overrides:
  `autoPopulate` in class `BasicCoordPanel`

### getCoords

public uk.ac.starlink.ttools.plot2.data.Coord[] getCoords()
Description copied from class: `BasicCoordPanel`
Returns the coordinates which this panel is getting values for.

Specified by:
  `getCoords` in interface `CoordPanel`
Overrides:
  `getCoords` in class `BasicCoordPanel`
Returns:
  coords

### getAdditionalManagedCoords

public uk.ac.starlink.ttools.plot2.data.Coord[] getAdditionalManagedCoords()
Description copied from class: `BasicCoordPanel`
Returns a list of coordinates which do not correspond to the selectors displayed here, but which should not be acquired by other means.

This is a hack to work round situations when coordinates are added into results by non-obvious means. In most cases the output result will be an empty array, which is what the implementation in this class does. But subclasses can override it for special behaviour.

Specified by:
  `getAdditionalManagedCoords` in interface `CoordPanel`
Overrides:
  `getAdditionalManagedCoords` in class `BasicCoordPanel`
Returns:
  list of coords which this panel will arrange to provide values for in some non-standard way

### getContents

public GuiCoordContent[] getContents()
Description copied from class: `BasicCoordPanel`
Returns the coordinate values currently selected in this panel. If there is insufficient information to contribute to a plot (not all of the `required` coord values are filled in) then null will be returned.

Specified by:
  `getContents` in interface `CoordPanel`
Overrides:
  `getContents` in class `BasicCoordPanel`
Returns:
  nCoord-element array of coord contents, or null

### setTable

public void setTable(TopcatModel tcModel, boolean autoFill)
Description copied from class: `BasicCoordPanel`
Sets the table with reference to which this panel will resolve coordinate descriptions.

If the existing selected coordinate values still make sense (if the new table has sufficiently compatible column names), they are retained. If the columns cannot be retained they are cleared, and in that case if the `autopopulate` parameter is set, some default columns will be used.

Specified by:
  `setTable` in interface `CoordPanel`
Overrides:
  `setTable` in class `BasicCoordPanel`
Parameters:
  `tcModel` - table from which coordinate values will be drawn
  `autoFill` - whether to autopopulate columns when old ones can't be used or are absent