Class GraphicsWindow
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- uk.ac.starlink.topcat.AuxWindow
-
- uk.ac.starlink.topcat.plot.GraphicsWindow
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
,javax.swing.RootPaneContainer
,javax.swing.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, thegetPlotState()
method is called which goes through all the controls and assembles aPlotState
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, itsequals()
method is used - soPlotState.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
Nested Classes Modifier and Type Class Description 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
javax.swing.JFrame.AccessibleJFrame
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
-
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
-
-
Constructor Summary
Constructors Constructor Description GraphicsWindow(java.lang.String viewName, uk.ac.starlink.ttools.plot.TablePlot plot, java.lang.String[] axisNames, int naux, boolean hasLabels, ErrorModeSelectionModel[] errorModeModels, java.awt.Component parent)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected AxesSelector
addExtraAxes(AxesSelector axsel)
Adds additional axes to a given AxesSelector as appropriate for this window.protected void
addNewSubsets(java.util.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.javax.swing.JMenu
createErrorModeMenu()
Constructs and returns a menu which can be used to select error modes for this window.static ErrorModeSelectionModel[]
createErrorModeModels(java.lang.String[] axisNames)
Creates a default set of ErrorModeSelectionModels given a list of axis names.javax.swing.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.javax.swing.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.javax.swing.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(javax.swing.table.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.javax.swing.JMenu
getExportMenu()
Returns the menu which contains export actions.javax.swing.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 ofcalculateRanges(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 javax.swing.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.javax.swing.JToolBar
getPointSelectorToolBar()
Returns the toolbar used for controls specific to the PointSelector component.javax.swing.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.javax.swing.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 dispenseMarkStyle
objects, suitable for general purpose scatter plots.javax.swing.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 ofcalculateRanges(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, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, 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, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
GraphicsWindow
public GraphicsWindow(java.lang.String viewName, uk.ac.starlink.ttools.plot.TablePlot plot, java.lang.String[] axisNames, int naux, boolean hasLabels, ErrorModeSelectionModel[] errorModeModels, java.awt.Component parent)
Constructor. A number of main axes are defined by theaxisNames
array, which also defines the dimensionality. Thenaux
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, supplynaux=0
.- Parameters:
viewName
- name of the view windowplot
- component which draws the plotaxisNames
- array of labels by which each main axis is knownnaux
- number of auxiliary axeserrorModeModels
- array of selecction models for error modesparent
- parent window - may be used for positioning
-
-
Method Detail
-
setVisible
public void setVisible(boolean visible)
- Overrides:
setVisible
in classAuxWindow
-
init
protected void init()
Perform initialisation which can't be done in the constructor (typically because it calls potentially overridden methods).
-
getExtrasPanel
public javax.swing.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 ofcalculateRanges(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 ofcalculateRanges(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 javax.swing.JToolBar getPointSelectorToolBar()
Returns the toolbar used for controls specific to the PointSelector component.- Returns:
- point selector toolbar
-
getExportMenu
public javax.swing.JMenu getExportMenu()
Returns the menu which contains export actions.- Returns:
- export menu
-
createMarkerStyleMenu
public javax.swing.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 javax.swing.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 javax.swing.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 ofcalculateRanges(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 bygetDataRanges()
. 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 javax.swing.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 javax.swing.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 inputaxsel
object.This method is called by
GraphicsWindow
's implementation ofcreatePointSelector()
.- 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. Thenpoint
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 bysetStyles(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 bygetPlotState()
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 invokesnew 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 callsPointSelection.readPoints(javax.swing.BoundedRangeModel)
andcalculateRanges(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 javax.swing.Action getReplotAction()
Returns an action which can be used to force a replot of the plot.- Returns:
- replot action
-
getRescaleAction
public javax.swing.Action getRescaleAction()
Returns an action which will recalculate data ranges, clear view ranges, and replot the data.- Returns:
- rescale action
-
getAxisEditAction
public javax.swing.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(java.util.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 ofgetDataRanges()
.- Parameters:
data
- point data for the plotstate
- plot state- Returns:
- ranges
-
getColumnIndex
public int getColumnIndex(javax.swing.table.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 classjava.awt.Window
-
createErrorModeModels
public static ErrorModeSelectionModel[] createErrorModeModels(java.lang.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 dispenseMarkStyle
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 rendererstyleSets
- input style set array- Returns:
- output array of modified style sets
-
-