Class TablePlot

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
LinesPlot, Plot3D, SurfacePlot

public abstract class TablePlot extends JComponent
Superclass for all components which draw plots from table data.
Since:
3 Apr 2008
Author:
Mark Taylor
See Also:
  • Constructor Details

    • TablePlot

      protected TablePlot()
      Constructor.
  • Method Details

    • setState

      public void setState(PlotState state)
      Sets the plot state for this plot. This characterises how the plot will be done next time this component is painted.
      Parameters:
      state - plot state
    • getState

      public PlotState getState()
      Returns the most recently set state for this plot.
      Returns:
      plot state
    • addPlotListener

      public void addPlotListener(PlotListener listener)
      Adds a listener which will be notified when this plot has been painted.
      Parameters:
      listener - listener to add
    • removePlotListener

      public void removePlotListener(PlotListener listener)
      Removes a listener previously added by addPlotListener.
      Parameters:
      listener - listener to remove
    • firePlotChangedLater

      protected void firePlotChangedLater(PlotEvent evt)
      Sends a plot event to all registered listeners, deferring the send by submitting it for future execution on the AWT event dispatch thread. Although this will normally be called from the event dispatch thread, it will normally be called from within a JComponent.paintComponent(java.awt.Graphics) invocation. I'm not certain it's a bad idea to call other swing-type methods from within a paint, but it sounds like a good thing to avoid.
      Parameters:
      evt - event to dispatch
    • calculateBounds

      public DataBounds calculateBounds(PlotData data, PlotState state)
      Calculates data bounds for a given data set as appropriate for this plot.
      Parameters:
      data - plot data
      state - plot state
      Returns:
      data bounds object
    • getPlotBounds

      public abstract Rectangle getPlotBounds()
      Returns 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.
      Returns:
      plot region bounds
    • isVectorContext

      public static boolean isVectorContext(Graphics g)
      Determines whether the given graphics context represents a vector graphics type environment (such as PostScript).
      Parameters:
      g - graphics context to test
      Returns:
      true iff g is PostScript-like