public class BasicCoordPanel extends Object implements CoordPanel
Modifier and Type | Class and Description |
---|---|
static interface |
BasicCoordPanel.CoordStack
Interface for presenting a list of coordinate selection components.
|
Constructor and Description |
---|
BasicCoordPanel(uk.ac.starlink.ttools.plot2.data.Coord[] coords)
Constructs a CoordPanel for selecting just Coords.
|
BasicCoordPanel(uk.ac.starlink.ttools.plot2.data.Coord[] coords,
uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] configKeys)
Constructs a CoordPanel for selecting Coords and Config values.
|
BasicCoordPanel(uk.ac.starlink.ttools.plot2.data.Coord[] coords,
uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] configKeys,
BasicCoordPanel.CoordStack stack)
Constructs a CoordPanel for selecting Coords and Config values
with a custom stack.
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(ActionListener listener)
Adds a listener which will be notified when the coordinate selection
changes.
|
void |
addButtons(Action[] acts)
Adds a row of buttons to the control panel for a given array of actions.
|
void |
autoPopulate()
Makes some attempt to fill in the fields with non-blank values.
|
static BasicCoordPanel.CoordStack |
createDefaultStack()
Returns a CoordStack implementation suitable for general-purpose use.
|
ActionForwarder |
getActionForwarder()
Returns an object which will forward actions to listeners registered
with this panel.
|
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.
|
ColumnDataComboBoxModel |
getColumnSelector(int ic,
int iu)
Returns the selector component model for a given user coordinate.
|
JComponent |
getComponent()
Returns the graphical component for this object.
|
uk.ac.starlink.ttools.plot2.config.ConfigMap |
getConfig()
Returns the config map associated with this panel.
|
ConfigSpecifier |
getConfigSpecifier()
Returns this panel's config specifier.
|
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.
|
static uk.ac.starlink.table.ValueInfo[] |
getInfos(ColumnDataComboBoxModel model)
Returns a list of column metadata items for the items in a
list model of columns.
|
BasicCoordPanel.CoordStack |
getStack()
Returns the component listing all the coordinates.
|
TopcatModel |
getTable()
Returns the currently configured topcat model.
|
boolean |
isPreferredCoord(uk.ac.starlink.ttools.plot2.data.Coord coord)
Indicates whether a coordinate is one that ought to get filled in
if possible.
|
static uk.ac.starlink.ttools.plot2.data.Coord[] |
multiplyCoords(uk.ac.starlink.ttools.plot2.data.Coord[] coords,
int ncopy)
Returns a list of coordinates which is like multiple copies of a
supplied group.
|
static boolean |
populate(ColumnDataComboBoxModel model,
uk.ac.starlink.table.ValueInfo info)
Tries to find an item of a given combo box model matching a given
metadata item.
|
void |
removeActionListener(ActionListener listener)
Removes a listener which was added previously.
|
void |
setColumnSelector(int ic,
int iu,
ColumnDataComboBoxModel model)
Resets the selector component model for a given user coordinate.
|
void |
setTable(TopcatModel tcModel,
boolean autoPopulate)
Sets the table with reference to which this panel will resolve
coordinate descriptions.
|
public BasicCoordPanel(uk.ac.starlink.ttools.plot2.data.Coord[] coords)
coords
- coordinate definitions for which values are requiredpublic BasicCoordPanel(uk.ac.starlink.ttools.plot2.data.Coord[] coords, uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] configKeys)
coords
- coordinate definitions for which values are requiredconfigKeys
- config value keyspublic BasicCoordPanel(uk.ac.starlink.ttools.plot2.data.Coord[] coords, uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] configKeys, BasicCoordPanel.CoordStack stack)
createDefaultStack()
may be used
if there are no special requirements.coords
- coordinate definitions for which values are requiredconfigKeys
- config value keysstack
- coord stack implementationpublic void addButtons(Action[] acts)
acts
- custom actionspublic uk.ac.starlink.ttools.plot2.data.Coord[] getCoords()
getCoords
in interface CoordPanel
public ConfigSpecifier getConfigSpecifier()
getConfigSpecifier
in interface CoordPanel
public uk.ac.starlink.ttools.plot2.config.ConfigMap getConfig()
getConfig
in interface CoordPanel
getConfigSpecifier().getSpecifiedValue()
public JComponent getComponent()
getComponent
in interface CoordPanel
public BasicCoordPanel.CoordStack getStack()
public void addActionListener(ActionListener listener)
addActionListener
in interface CoordPanel
listener
- listenerpublic void removeActionListener(ActionListener listener)
removeActionListener
in interface CoordPanel
listener
- listenerpublic ActionForwarder getActionForwarder()
public void setTable(TopcatModel tcModel, boolean autoPopulate)
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.
setTable
in interface CoordPanel
tcModel
- table from which coordinate values will be drawnautoPopulate
- whether to autopopulate columns when old ones
can't be used or are absentpublic void autoPopulate()
public TopcatModel getTable()
public GuiCoordContent[] getContents()
required
coord values are filled in)
then null will be returned.getContents
in interface CoordPanel
public ColumnDataComboBoxModel getColumnSelector(int ic, int iu)
getColumnSelector
in interface CoordPanel
ic
- coord indexiu
- user info index for the given coordpublic void setColumnSelector(int ic, int iu, ColumnDataComboBoxModel model)
ic
- coord indexiu
- user info index for the given coordmodel
- new selector modelpublic boolean isPreferredCoord(uk.ac.starlink.ttools.plot2.data.Coord 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.
coord
- candidate coordinatepublic uk.ac.starlink.ttools.plot2.data.Coord[] getAdditionalManagedCoords()
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.
getAdditionalManagedCoords
in interface CoordPanel
public static uk.ac.starlink.table.ValueInfo[] getInfos(ColumnDataComboBoxModel model)
model
- column list modelpublic static boolean populate(ColumnDataComboBoxModel model, uk.ac.starlink.table.ValueInfo info)
model
- list modelinfo
- template for selection valuepublic static BasicCoordPanel.CoordStack createDefaultStack()
public static uk.ac.starlink.ttools.plot2.data.Coord[] multiplyCoords(uk.ac.starlink.ttools.plot2.data.Coord[] coords, int ncopy)
coords
- basic coordinatesncopy
- number of copies to makeCopyright © 2003-2025 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.