uk.ac.starlink.topcat.plot
Class GraphicsWindow

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by uk.ac.starlink.topcat.AuxWindow
                          extended by uk.ac.starlink.topcat.plot.GraphicsWindow
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
DensityWindow, HistogramWindow, LinesWindow, Plot3DWindow, PlotWindow

public abstract class GraphicsWindow
extends AuxWindow

Abstract superclass for windows doing N-dimensional plots of table data.

The basic way that plotting works is as follows. Almost all the controls visible on the GraphicsWindow do nothing except trigger the replot action getReplotListener() when their state changes, which schedules a replot to occur later on the event dispatch thread. When the replot is executed, the getPlotState() method is called which goes through all the controls and assembles a PlotState object (of a class which is probably specific to the window implementation). Only if this PlotState differs from the last gathered PlotState will any actual plotting action take place. This means that we don't worry about triggering loads of replot actions - as long as the state doesn't change materially between one and the next, they're cheap. If the state does change materially, then a new plot is required. The work done for plotting depends on the details of how the PlotState has changed - in some cases new data will be acquired (PointSelection.readPoints is called - possibly expensive), but if the data is the same as before, the plot just needs to be redrawn (usually quite fast, since the various plotting classes are written as efficiently as possible). It is therefore very important for performance reasons that you can tell whether one plot state differs from the last one. Since the PlotState is a newly created object each time, its equals() method is used - so PlotState.equals() must be written with great care. There's an assertion in this class which tests that two PlotStates gathered at the same time are equal, so you should find out if your equals() method is calling two equal states unequal. If it's calling two unequal states equal, then you'll find that the plot doesn't get updated when state changes.

Since:
26 Oct 2005
Author:
Mark Taylor
See Also:
Serialized Form

Nested Class Summary
protected  class GraphicsWindow.ExportAction
          Actions for exporting the plot to a file.
protected  class GraphicsWindow.ReplotListener
          General purpose listener which replots given an event.
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GraphicsWindow(String viewName, uk.ac.starlink.ttools.plot.TablePlot plot, String[] axisNames, int naux, boolean hasLabels, ErrorModeSelectionModel[] errorModeModels, Component parent)
          Constructor.
 
Method Summary
protected  AxesSelector addExtraAxes(AxesSelector axsel)
          Adds additional axes to a given AxesSelector as appropriate for this window.
protected  void addNewSubsets(BitSet pointsMask)
          Adds a new row subset to tables associated with this window as appropriate.
 uk.ac.starlink.ttools.plot.Range[] calculateRanges(uk.ac.starlink.ttools.plot.PlotData data, uk.ac.starlink.ttools.plot.PlotState state)
          Calculates data ranges for a given data set.
 JMenu createErrorModeMenu()
          Constructs and returns a menu which can be used to select error modes for this window.
static ErrorModeSelectionModel[] createErrorModeModels(String[] axisNames)
          Creates a default set of ErrorModeSelectionModels given a list of axis names.
 JMenu createErrorRendererMenu(uk.ac.starlink.ttools.plot.ErrorRenderer[] renderers)
          Constructs and returns a menu which can be used to select error styles to be imposed at once on all subsets.
 JMenu createMarkerStyleMenu(uk.ac.starlink.ttools.plot.StyleSet[] styleSets)
          Constructs and returns a menu for selecting marker styles.
protected  uk.ac.starlink.ttools.plot.PlotState createPlotState()
          Constructs a new PlotState.
protected  PointSelector createPointSelector()
          Returns a new PointSelector instance to be used for selecting points to be plotted.
protected abstract  StyleEditor createStyleEditor()
          Creates a style editor suitable for this window.
 void dispose()
           
protected  void doReplot(uk.ac.starlink.ttools.plot.PlotState state)
          Performs an actual plot.
static uk.ac.starlink.ttools.plot.StyleSet[] fixDefaultErrorRenderers(uk.ac.starlink.ttools.plot.ErrorRenderer erend, uk.ac.starlink.ttools.plot.StyleSet[] styleSets)
          Utility method to adjust an array of style sets so that all its members use a given error renderer by default.
 int getAuxAxisCount()
          Returns the total (maximum) number of auxiliary axes used by this window.
 Action getAxisEditAction()
          Returns an action which can be used to configure axes manually.
 AxisWindow getAxisWindow()
          Returns the axis configuration window associated with this window.
 int getColumnIndex(TableColumn tcol)
          Returns the index in the TableModel (not the TableColumnModel) of the given TableColumn.
 uk.ac.starlink.ttools.plot.Range[] getDataRanges()
          Returns the most recently calculated data range objects.
abstract  uk.ac.starlink.ttools.plot.StyleSet getDefaultStyles(int npoint)
          Returns a StyleSet which can supply markers.
 ErrorModeSelectionModel[] getErrorModeModels()
          Returns the models for selecting error modes.
 JMenu getExportMenu()
          Returns the menu which contains export actions.
 JComponent getExtrasPanel()
          Returns a panel into which additional window-specific control components can be added.
 ToggleButtonModel[] getFlipModels()
          Returns an array of button models representing the inversion state for each axis.
 ToggleButtonModel getGridModel()
          Returns the button model used to select whether a grid will be drawn or not.
 ToggleButtonModel getLegendModel()
          Returns the model which indicates whether the legend is visible or not.
 ToggleButtonModel[] getLogModels()
          Returns an array of button models representing the log/linear state for each axis.
 int getMainRangeCount()
          Returns the number of axes whose ranges can be reset excluding any auxiliary axes.
 double getPadRatio()
          Returns the ratio by which the data ranges calculated by the GraphicsWindow implememetation of calculateRanges(uk.ac.starlink.topcat.plot.PointSelection, uk.ac.starlink.topcat.plot.Points, uk.ac.starlink.ttools.plot.PlotState) are padded.
 uk.ac.starlink.ttools.plot.TablePlot getPlot()
          Returns the plot object for this window.
protected abstract  JComponent getPlotPanel()
          Returns the component containing the graphics output of this window.
 uk.ac.starlink.ttools.plot.PlotState getPlotState()
          Returns an object which characterises the choices the user has made in the GUI to indicate the plot that s/he wants to see.
 Points getPoints()
          Returns the most recently read Points object.
 PointSelectorSet getPointSelectors()
          Returns the PointSelectorSet component used by this window.
 JToolBar getPointSelectorToolBar()
          Returns the toolbar used for controls specific to the PointSelector component.
 Action getReplotAction()
          Returns an action which can be used to force a replot of the plot.
protected  GraphicsWindow.ReplotListener getReplotListener()
          Returns a listener which will perform a replot when any event occurs.
 Action getRescaleAction()
          Returns an action which will recalculate data ranges, clear view ranges, and replot the data.
static uk.ac.starlink.ttools.plot.StyleSet[] getStandardMarkStyleSets()
          Returns an array of StyleSets which dispense MarkStyle objects, suitable for general purpose scatter plots.
 Box getStatusBox()
          Returns a line suitable for putting status information into.
 MutableStyleSet getStyles()
          Returns a style set suitable for use with a new PointSelector.
 uk.ac.starlink.ttools.plot.Range[] getViewRanges()
          Returns an array of ranges which may be set to determine the actual range of visible data displayed by this plot.
 int getVisibleAuxAxisCount()
          Returns the number of currently visible auxiliary axes for this window.
protected  void init()
          Perform initialisation which can't be done in the constructor (typically because it calls potentially overridden methods).
protected  boolean isLegendInteresting(uk.ac.starlink.ttools.plot.PlotState state)
          Indicates whether the legend is worth showing for a given plot state.
 void replot()
          Redraws the plot if any of the characteristics indicated by the currently-requested plot state have changed since the last time it was done.
 void setGuidePointCount(int npoint)
          Provides a hint to this window how many points it's likely to be plotting.
 void setMainTable(TopcatModel tcModel)
          Sets the main table in the point selector component.
 void setPadRatio(double pad)
          Sets the ratio by which the data ranges calculated by the GraphicsWindow implementation of calculateRanges(uk.ac.starlink.topcat.plot.PointSelection, uk.ac.starlink.topcat.plot.Points, uk.ac.starlink.ttools.plot.PlotState) are padded.
 void setStyles(uk.ac.starlink.ttools.plot.StyleSet styleSet)
          Sets the style set to use for this window.
 void setVisible(boolean visible)
           
 
Methods inherited from class uk.ac.starlink.topcat.AuxWindow
addHelp, beep, confirm, createImportTableAction, createSaveTableAction, getBodyPanel, getControlPanel, getHelpMenu, getIconImage, getMainArea, getSponsorLogos, getToolBar, getWindowMenu, makeTitledBorder, makeVisible, placeProgressBar, positionAfter, recursiveSetEnabled, setBusy, setCloseIsExit, setMainHeading
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

GraphicsWindow

public GraphicsWindow(String viewName,
                      uk.ac.starlink.ttools.plot.TablePlot plot,
                      String[] axisNames,
                      int naux,
                      boolean hasLabels,
                      ErrorModeSelectionModel[] errorModeModels,
                      Component parent)
Constructor. A number of main axes are defined by the axisNames array, which also defines the dimensionality. The naux variable gives a maximum number of auxiliary axes which will be managed by this window - these give extra dimensions which can be mapped to, for instance, colour changes in plotted points. If no auxiliary axes are required, supply naux=0.

Parameters:
viewName - name of the view window
plot - component which draws the plot
axisNames - array of labels by which each main axis is known
naux - number of auxiliary axes
errorModeModels - array of selecction models for error modes
parent - parent window - may be used for positioning
Method Detail

setVisible

public void setVisible(boolean visible)
Overrides:
setVisible in class AuxWindow

init

protected void init()
Perform initialisation which can't be done in the constructor (typically because it calls potentially overridden methods).


getExtrasPanel

public JComponent getExtrasPanel()
Returns a panel into which additional window-specific control components can be added. By default it is empty.

Returns:
extra control panel

getMainRangeCount

public int getMainRangeCount()
Returns the number of axes whose ranges can be reset excluding any auxiliary axes.


setGuidePointCount

public void setGuidePointCount(int npoint)
Provides a hint to this window how many points it's likely to be plotting. This should be called before the window is first displayed, and may influence the default plotting style.

Parameters:
npoint - approximate number of data points that may be plotted

setPadRatio

public void setPadRatio(double pad)
Sets the ratio by which the data ranges calculated by the GraphicsWindow implementation of calculateRanges(uk.ac.starlink.topcat.plot.PointSelection, uk.ac.starlink.topcat.plot.Points, uk.ac.starlink.ttools.plot.PlotState) are padded.

Parameters:
pad - padding ratio (typically a few percent)

getPadRatio

public double getPadRatio()
Returns the ratio by which the data ranges calculated by the GraphicsWindow implememetation of calculateRanges(uk.ac.starlink.topcat.plot.PointSelection, uk.ac.starlink.topcat.plot.Points, uk.ac.starlink.ttools.plot.PlotState) are padded.

Returns:
padding ratio (by default a few percent)

getPointSelectorToolBar

public JToolBar getPointSelectorToolBar()
Returns the toolbar used for controls specific to the PointSelector component.

Returns:
point selector toolbar

getExportMenu

public JMenu getExportMenu()
Returns the menu which contains export actions.

Returns:
export menu

createMarkerStyleMenu

public JMenu createMarkerStyleMenu(uk.ac.starlink.ttools.plot.StyleSet[] styleSets)
Constructs and returns a menu for selecting marker styles. Selecting an item from this list resets all plotting styles in this window according to the selected StyleSet.

Parameters:
styleSets - style sets to be presented in the menu
Returns:
menu

createErrorModeMenu

public JMenu createErrorModeMenu()
Constructs and returns a menu which can be used to select error modes for this window.

Returns:
new error mode selection menu

createErrorRendererMenu

public JMenu createErrorRendererMenu(uk.ac.starlink.ttools.plot.ErrorRenderer[] renderers)
Constructs and returns a menu which can be used to select error styles to be imposed at once on all subsets.

Parameters:
renderers - full list of renderers which may be used to draw errors

getPointSelectors

public PointSelectorSet getPointSelectors()
Returns the PointSelectorSet component used by this window.

Returns:
point selector set

getDataRanges

public uk.ac.starlink.ttools.plot.Range[] getDataRanges()
Returns the most recently calculated data range objects. These were calculated by invocation of calculateRanges(uk.ac.starlink.topcat.plot.PointSelection, uk.ac.starlink.topcat.plot.Points, uk.ac.starlink.ttools.plot.PlotState), which probably occurred during the last data read or rescale operation. They describe the natural ranges of the data, which typically means that they defibe an N-dimensional region into which all the current data points fall.

Returns:
array of data ranges, one for each axis

getViewRanges

public uk.ac.starlink.ttools.plot.Range[] getViewRanges()
Returns an array of ranges which may be set to determine the actual range of visible data displayed by this plot. The dimensions should generally match those returned by getDataRanges(). The actual range of visible data will generally be got by combining the data range with the visible range on each axis. Elements of the returned array may have their states altered, but should not be replaced, since these elements are kept up to date by the editors in the axis window.

Returns:
array of visible ranges, one for each axis

getFlipModels

public ToggleButtonModel[] getFlipModels()
Returns an array of button models representing the inversion state for each axis. Selected state for each model indicates that that axis has been flipped.

Returns:
button models for flip state

getLogModels

public ToggleButtonModel[] getLogModels()
Returns an array of button models representing the log/linear state for each axis. Selected state for each model indicates that that axis is logarithmic, unselected means linear.

Returns:
button models for log state

getErrorModeModels

public ErrorModeSelectionModel[] getErrorModeModels()
Returns the models for selecting error modes.

Returns:
error mode models

getLegendModel

public ToggleButtonModel getLegendModel()
Returns the model which indicates whether the legend is visible or not.

Returns:
legend visibility model

getPoints

public Points getPoints()
Returns the most recently read Points object.

Returns:
points object

getStatusBox

public Box getStatusBox()
Returns a line suitable for putting status information into.

Returns:
status component

getAuxAxisCount

public int getAuxAxisCount()
Returns the total (maximum) number of auxiliary axes used by this window.

Returns:
maximum number of aux axes

getVisibleAuxAxisCount

public int getVisibleAuxAxisCount()
Returns the number of currently visible auxiliary axes for this window.

Returns:
number of visible aux axes

getPlot

public uk.ac.starlink.ttools.plot.TablePlot getPlot()
Returns the plot object for this window.

Returns:
plot

getPlotPanel

protected abstract JComponent getPlotPanel()
Returns the component containing the graphics output of this window. This is the component which is exported or printed etc alongside the legend which is managed by GraphicsWindow. It should therefore contain only the output data, not any user interface decoration.

Returns:
plot container

doReplot

protected void doReplot(uk.ac.starlink.ttools.plot.PlotState state)
Performs an actual plot.

Parameters:
state - plot state determining details of plot configuration

createPointSelector

protected PointSelector createPointSelector()
Returns a new PointSelector instance to be used for selecting points to be plotted.

Returns:
new point selector component

addExtraAxes

protected AxesSelector addExtraAxes(AxesSelector axsel)
Adds additional axes to a given AxesSelector as appropriate for this window. The returned value may or may not be the same as the input axsel object.

This method is called by GraphicsWindow's implementation of createPointSelector().

Parameters:
axsel - basic axes selector
Returns:
axes selector containing additional auxiliary axes as appropriate

createStyleEditor

protected abstract StyleEditor createStyleEditor()
Creates a style editor suitable for this window.

Returns:
new style editor

getDefaultStyles

public abstract uk.ac.starlink.ttools.plot.StyleSet getDefaultStyles(int npoint)
Returns a StyleSet which can supply markers. The npoint may be used as a hint for how many points are expected to be drawn with it.

Parameters:
npoint - approximate number of points - use -1 for unknown
Returns:
style factory

setStyles

public void setStyles(uk.ac.starlink.ttools.plot.StyleSet styleSet)
Sets the style set to use for this window.

Parameters:
styleSet - new style set

getStyles

public MutableStyleSet getStyles()
Returns a style set suitable for use with a new PointSelector. Note this is not the same object as was set by setStyles(uk.ac.starlink.ttools.plot.StyleSet), but it is based on it - it will dispense styles from the same set, but avoid styles already dispensed to other selectors.

Returns:
style set suitable for a new selector

createPlotState

protected uk.ac.starlink.ttools.plot.PlotState createPlotState()
Constructs a new PlotState. This is called by getPlotState() prior to the PlotState configuration done there. Thus if a subclass wants to provide and configure a particular state (for instance one of a specialised subclass of PlotState) it can override this method to do so. The default implementation just invokes new PlotState().

Returns:
returns a new PlotState object ready for generic configuration

getPlotState

public uk.ac.starlink.ttools.plot.PlotState getPlotState()
Returns an object which characterises the choices the user has made in the GUI to indicate the plot that s/he wants to see.

The GraphicsWindow implementation of this method as well as populating the state with standard information also calls PointSelection.readPoints(javax.swing.BoundedRangeModel) and calculateRanges(uk.ac.starlink.topcat.plot.PointSelection, uk.ac.starlink.topcat.plot.Points, uk.ac.starlink.ttools.plot.PlotState) if necessary.

Returns:
snapshot of the currently-selected plot request

getGridModel

public ToggleButtonModel getGridModel()
Returns the button model used to select whether a grid will be drawn or not.

Returns:
grid toggle model

getReplotAction

public Action getReplotAction()
Returns an action which can be used to force a replot of the plot.

Returns:
replot action

getRescaleAction

public Action getRescaleAction()
Returns an action which will recalculate data ranges, clear view ranges, and replot the data.

Returns:
rescale action

getAxisEditAction

public Action getAxisEditAction()
Returns an action which can be used to configure axes manually.

Returns:
axis configuration action

setMainTable

public void setMainTable(TopcatModel tcModel)
Sets the main table in the point selector component.

Parameters:
tcModel - new table

replot

public void replot()
Redraws the plot if any of the characteristics indicated by the currently-requested plot state have changed since the last time it was done. If no changes have been made, no work is done, in which case it will be cheap to call.

This method schedules a replot on the event dispatch thread, so it may be called from any thread.


isLegendInteresting

protected boolean isLegendInteresting(uk.ac.starlink.ttools.plot.PlotState state)
Indicates whether the legend is worth showing for a given plot state.

Parameters:
state - plot state
Returns:
true iff the legend would show non-trivial information

getReplotListener

protected GraphicsWindow.ReplotListener getReplotListener()
Returns a listener which will perform a replot when any event occurs.

Returns:
replot listener

getAxisWindow

public AxisWindow getAxisWindow()
Returns the axis configuration window associated with this window.

Returns:
axis editor dialogue

addNewSubsets

protected void addNewSubsets(BitSet pointsMask)
Adds a new row subset to tables associated with this window as appropriate. The subset is based on a bit vector representing the points in this window's Points object.

Parameters:
pointsMask - bit vector giving included points

calculateRanges

public uk.ac.starlink.ttools.plot.Range[] calculateRanges(uk.ac.starlink.ttools.plot.PlotData data,
                                                          uk.ac.starlink.ttools.plot.PlotState state)
Calculates data ranges for a given data set. The returned Range array is the one which will be returned from future calls of getDataRanges().

Parameters:
data - point data for the plot
state - plot state
Returns:
ranges

getColumnIndex

public int getColumnIndex(TableColumn tcol)
Returns the index in the TableModel (not the TableColumnModel) of the given TableColumn.

Parameters:
tcol - the column whose index is to be found
Returns:
the index of tcol in the table model

dispose

public void dispose()
Overrides:
dispose in class Window

createErrorModeModels

public static ErrorModeSelectionModel[] createErrorModeModels(String[] axisNames)
Creates a default set of ErrorModeSelectionModels given a list of axis names.

Parameters:
axisNames - array of axis names
Returns:
array of error model selection models, one for each axis

getStandardMarkStyleSets

public static uk.ac.starlink.ttools.plot.StyleSet[] getStandardMarkStyleSets()
Returns an array of StyleSets which dispense MarkStyle objects, suitable for general purpose scatter plots.

Returns:
styleset library

fixDefaultErrorRenderers

public static uk.ac.starlink.ttools.plot.StyleSet[] fixDefaultErrorRenderers(uk.ac.starlink.ttools.plot.ErrorRenderer erend,
                                                                             uk.ac.starlink.ttools.plot.StyleSet[] styleSets)
Utility method to adjust an array of style sets so that all its members use a given error renderer by default.

Parameters:
erend - desired default error renderer
styleSets - input style set array
Returns:
output array of modified style sets


Copyright © 2003-2018 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.