Class AWTLegend

All Implemented Interfaces:
IDrawableListener, ILegend, IImageViewport
Direct Known Subclasses:
AWTColorbarLegend, AWTSerieLegend, AWTSeriesLegend

public abstract class AWTLegend extends AWTImageViewport implements IDrawableListener, ILegend
A AWTLegend represent information concerning a Drawable that may be displayed as a metadata in the ChartView. ChartView renders legend on the right side of the chart, hence avoiding superposition of legend and chart. The constructor of a AWTLegend registers itself as listener of its parent Drawable, and unregister itself when it is disposed. When defining a concrete AWTLegend, one should: Last, a AWTLegend optimizes rendering by :
  • storing current image dimension,
  • computing a new image only if the required AWTLegend dimensions changed.
Author:
Martin Pernollet
  • Field Details

    • drawable

      protected Drawable drawable
    • foreground

      protected Color foreground
    • background

      protected Color background
    • minimumDimension

      protected Dimension minimumDimension
    • imageGenerator

      protected AWTImageGenerator imageGenerator
  • Constructor Details

    • AWTLegend

      public AWTLegend(Drawable drawable)
    • AWTLegend

      public AWTLegend(Drawable drawable, Color foreground, Color background)
  • Method Details

    • dispose

      public void dispose()
    • toImage

      public abstract BufferedImage toImage(int width, int height)
    • setViewPort

      public void setViewPort(int width, int height, float left, float right)
      Defines viewport dimensions, and precompute an image if required (i.e. if the viewport dimension have changed
      Specified by:
      setViewPort in interface IImageViewport
      Overrides:
      setViewPort in class AbstractViewportManager
      Parameters:
      width - the width of the target window.
      height - the height of the target window.
      left - the width's ratio where this subscreen starts in the target window.
      right - the width's ratio where this subscreen stops in the target window.
    • drawableChanged

      public void drawableChanged(DrawableChangedEvent e)
      Specified by:
      drawableChanged in interface IDrawableListener
      Specified by:
      drawableChanged in interface ILegend
    • updateImage

      public void updateImage()
      Description copied from interface: ILegend
      Recompute the picture, using last used dimensions.
      Specified by:
      updateImage in interface ILegend
    • saveImage

      public void saveImage(String filename) throws IOException
      Throws:
      IOException
    • getMinimumDimension

      public Dimension getMinimumDimension()
      Description copied from class: AWTImageViewport
      Return the minimum size for this graphic.
      Specified by:
      getMinimumDimension in interface IImageViewport
      Overrides:
      getMinimumDimension in class AWTImageViewport
    • setMinimumDimension

      @Deprecated public void setMinimumDimension(Dimension dimension)
      Deprecated.
      Now overriden by automatic processing of minimum dimension
      Parameters:
      dimension -
    • setMinimumWidth

      @Deprecated public void setMinimumWidth(int minimumWidth)
      Deprecated.
    • setGeneratorColors

      public void setGeneratorColors()
    • getForeground

      public Color getForeground()
    • setForeground

      public void setForeground(Color foreground)
    • getBackground

      public Color getBackground()
    • setBackground

      public void setBackground(Color background)