Package uk.ac.starlink.ttools.plot
Class SurfacePlot
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- uk.ac.starlink.ttools.plot.TablePlot
-
- uk.ac.starlink.ttools.plot.SurfacePlot
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.awt.print.Printable,java.io.Serializable
- Direct Known Subclasses:
DensityPlot,Histogram,ScatterPlot
public abstract class SurfacePlot extends TablePlot implements java.awt.print.Printable
Abstract superclass for plot components which display on aPlotSurface. Note that the PlotSurface is not specified in the constructor but must be set before any plotting is done. This class mainly handles keeping track of the current state (PlotStateandPlotSurfacemembers). The actual work is done by thepaintComponentmethod of concrete subclasses.The details of the plot are determined by a
PlotStateobject which indicates what the plot will look like. Setting these values does not itself trigger a change in the component, they only take effect whenpaintComponent(java.awt.Graphics)is called (e.g. following aJComponent.repaint(long, int, int, int, int)call). The drawing of axes and other decorations is done by a decoupledPlotSurfaceobject (bridge pattern).- Since:
- 11 Nov 2005
- Author:
- Mark Taylor
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSurfacePlot()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.RectanglegetPlotBounds()Returns the bounds of the actual plot.PlotSurfacegetSurface()Returns the plotting surface on which this component displays.protected voidpaintComponent(java.awt.Graphics g)intprint(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)Implements thePrintableinterface.voidsetFont(java.awt.Font font)voidsetState(PlotState state)Sets the plot state for this plot.voidsetSurface(PlotSurface surface)Sets the plotting surface which draws axes and other decorations that form the background to the actual plotted points.-
Methods inherited from class uk.ac.starlink.ttools.plot.TablePlot
addPlotListener, calculateBounds, firePlotChangedLater, getState, isVectorContext, removePlotListener
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Method Detail
-
setSurface
public void setSurface(PlotSurface surface)
Sets the plotting surface which draws axes and other decorations that form the background to the actual plotted points. This must be called before the component is drawn.- Parameters:
surface- plotting surface implementation
-
getSurface
public PlotSurface getSurface()
Returns the plotting surface on which this component displays.- Returns:
- plotting surface
-
getPlotBounds
public java.awt.Rectangle getPlotBounds()
Description copied from class:TablePlotReturns the bounds of the actual plot. This may be used for visual alignment of some items in the window. It is permissible to return just the bounds of the plot component itself, but alignment of other components (legends) may look better if the bounds of the actual plotting region (for instance, excluding external axis labels) is returned.- Specified by:
getPlotBoundsin classTablePlot- Returns:
- plot region bounds
-
setState
public void setState(PlotState state)
Description copied from class:TablePlotSets the plot state for this plot. This characterises how the plot will be done next time this component is painted.
-
setFont
public void setFont(java.awt.Font font)
- Overrides:
setFontin classjavax.swing.JComponent
-
print
public int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)Implements thePrintableinterface. At time of writing, this method is not used by TOPCAT, though it could be; in particular it is not used to implement the export to EPS functionality. The code is mostly pinched from SPLAT.- Specified by:
printin interfacejava.awt.print.Printable
-
paintComponent
protected void paintComponent(java.awt.Graphics g)
- Overrides:
paintComponentin classjavax.swing.JComponent
-
-