public abstract class AxisController<P,A> extends Object implements Configger
Modifier | Constructor and Description |
---|---|
protected |
AxisController(uk.ac.starlink.ttools.plot2.SurfaceFactory<P,A> surfFact)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(ActionListener listener)
Adds a listener notified when any of the controls changes.
|
protected void |
addAspectConfigTab(String label,
uk.ac.starlink.ttools.plot2.config.Specifier<uk.ac.starlink.ttools.plot2.config.ConfigMap> aspectSpecifier)
Adds a tab to the main control for specifying the aspect.
|
void |
addControl(ConfigControl control)
Adds a control to the list of controls managed by this object.
|
protected void |
addNavigatorTab()
Adds a tab to the main control for selecting navigator options.
|
boolean |
assertHasKeys(uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] requiredKeys)
Utility method to assert that all of a given set of keys
are actually being obtained by this controller.
|
void |
clearAspect()
Clears any settings in tabs added by the
addAspectConfigTab method. |
protected boolean |
clearRange(P oldProfile,
P newProfile,
uk.ac.starlink.ttools.plot2.PlotLayer[] oldLayers,
uk.ac.starlink.ttools.plot2.PlotLayer[] newLayers,
boolean lock)
Indicates whether a new configuration should result in clearing
the current ranges and plot aspect.
|
abstract void |
configureForLayers(LayerControl[] layerControls)
This abstract method provides a hook for implementations to adjust
their GUI state based on the layer controls which will be supplying
layers for them to plot.
|
protected abstract boolean |
forceClearRange(P oldProfile,
P newProfile)
Determines whether the change between two profiles forces an
unconditional re-range of the plotting surface.
|
ActionListener |
getActionForwarder()
Returns an object which will forward actions to listeners registered
with this panel.
|
A |
getAspect()
Returns the plot aspect to use for setting up the plot surface.
|
uk.ac.starlink.ttools.plot2.config.ConfigMap |
getConfig()
Returns the configuration defined by all this object's controls.
|
Control[] |
getControls()
Returns all the controls for user configuration of this controller.
|
ConfigControl |
getMainControl()
Returns the control that provides the main part of the GUI
configurability.
|
uk.ac.starlink.ttools.plot2.Navigator<A> |
getNavigator()
Returns the navigator specified by this control.
|
uk.ac.starlink.ttools.plot.Range[] |
getRanges()
Returns the current fixed data coordinate ranges.
|
uk.ac.starlink.ttools.plot2.SurfaceFactory<P,A> |
getSurfaceFactory()
Returns this control's surface factory.
|
void |
removeActionListener(ActionListener listener)
Removes a listener previously added by addActionListener.
|
void |
setAspect(A aspect)
Sets the plot aspect which defines the view on the data.
|
void |
setLatestSurface(uk.ac.starlink.ttools.plot2.Surface surface)
Accepts information about the latest plotting surface to be plotted
by the panel associated with this controller.
|
void |
setRanges(uk.ac.starlink.ttools.plot.Range[] ranges)
Sets fixed data position coordinate ranges.
|
void |
submitReports(Map<LayerId,uk.ac.starlink.ttools.plot2.ReportMap> reports)
Accepts report information generated by plotting layers.
|
void |
updateState(P profile,
uk.ac.starlink.ttools.plot2.PlotLayer[] layers,
boolean axisLock)
Configures this controller for a given set of plot layers.
|
protected AxisController(uk.ac.starlink.ttools.plot2.SurfaceFactory<P,A> surfFact)
surfFact
- plot surface factorypublic uk.ac.starlink.ttools.plot2.SurfaceFactory<P,A> getSurfaceFactory()
public ConfigControl getMainControl()
public Control[] getControls()
public void addControl(ConfigControl control)
control
- control to addpublic uk.ac.starlink.ttools.plot2.config.ConfigMap getConfig()
public void addActionListener(ActionListener listener)
listener
- listener to addpublic void removeActionListener(ActionListener listener)
listener
- listener to removepublic ActionListener getActionForwarder()
public void setRanges(uk.ac.starlink.ttools.plot.Range[] ranges)
ranges
- fixed data position coordinate ranges, or null to clearpublic uk.ac.starlink.ttools.plot.Range[] getRanges()
public void setAspect(A aspect)
aspect
- fixed aspect, or null to clearpublic A getAspect()
public abstract void configureForLayers(LayerControl[] layerControls)
layerControls
- layer controls expected to provide layers
to be plotted on these axesprotected void addNavigatorTab()
public uk.ac.starlink.ttools.plot2.Navigator<A> getNavigator()
protected void addAspectConfigTab(String label, uk.ac.starlink.ttools.plot2.config.Specifier<uk.ac.starlink.ttools.plot2.config.ConfigMap> aspectSpecifier)
label
- tab labelaspectSpecifier
- config specifier for aspect keyspublic void clearAspect()
addAspectConfigTab
method.public void updateState(P profile, uk.ac.starlink.ttools.plot2.PlotLayer[] layers, boolean axisLock)
clearRange
.
This isn't perfect, since it only allows to clear the range or not. Sometimes you might want finer control, e.g. to clear the range in one dimension and retain it in others. It may be possible to fit that into the updateState API, but it would require more work.
profile
- surface profilelayers
- layers which will be plottedaxisLock
- whether re-ranging is inhibited;
normally, if true axes will not be reset by this
method, but the implementation can override that
if it needs topublic boolean assertHasKeys(uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] requiredKeys)
requiredKeys
- list of keys this control should obtaingetConfig
method contains entries
for all the required keysAssertionError
- if the result would be false and assertions
are enabledpublic void submitReports(Map<LayerId,uk.ac.starlink.ttools.plot2.ReportMap> reports)
The default implementation does nothing, but subclasses may override it to enquire about plot results.
reports
- per-layer plot reports for layers generated
by the most recent plotpublic void setLatestSurface(uk.ac.starlink.ttools.plot2.Surface surface)
The default implementation does nothing, but subclasses may override it to acquire information about plot state.
surface
- latest plotting surface.protected boolean clearRange(P oldProfile, P newProfile, uk.ac.starlink.ttools.plot2.PlotLayer[] oldLayers, uk.ac.starlink.ttools.plot2.PlotLayer[] newLayers, boolean lock)
oldProfile
- profile for last plotnewProfile
- profile for next plotoldLayers
- layer set for last plotnewLayers
- layer set for next plotlock
- whether re-ranging is inhibited;
normally, if lock
is true this
method should return false, but the implementation
can overrule this and return true even when locked
if it needs toprotected abstract boolean forceClearRange(P oldProfile, P newProfile)
oldProfile
- profile before changenewProfile
- profile after changeCopyright © 2003-2025 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.