public abstract class AWTLegend extends AWTImageViewport implements IDrawableListener, ILegend
AWTLegend represent information concerning a
AbstractDrawable that may be displayed as a metadata in the
ChartView.
The constructor of a AWTLegend registers itself as listener of its
parent AbstractDrawable, and unregister itself when it is disposed.
When defining a concrete AWTLegend, one should:
toImage(int width, int height) method, that defines
the picture representation.
drawableChanged(DrawableChangedEvent e) method, that
must select events that actually triggers an image update.
AWTLegend optimizes rendering by :
AWTLegend dimensions
changed.
| Modifier and Type | Field and Description |
|---|---|
protected Color |
background |
protected AbstractDrawable |
drawable |
protected Color |
foreground |
protected AWTImageGenerator |
imageGenerator |
protected Dimension |
minimumDimension |
imageHeight, imageObj, imageWidthlastViewPort, mode, ratioHeight, ratioWidth, screenBottom, screenGridDisplayed, screenHeight, screenLeft, screenSquaredDim, screenWidth, screenXOffset, screenYOffset| Constructor and Description |
|---|
AWTLegend(AbstractDrawable drawable) |
AWTLegend(AbstractDrawable drawable,
Color foreground,
Color background) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose() |
void |
drawableChanged(DrawableChangedEvent e) |
Color |
getBackground() |
Color |
getForeground() |
Dimension |
getMinimumDimension() |
Dimension |
getMinimumSize()
Return the minimum size for this graphic.
|
void |
saveImage(String filename) |
void |
setBackground(Color background) |
void |
setForeground(Color foreground) |
void |
setGeneratorColors() |
void |
setMinimumDimension(Dimension minimumDimension) |
void |
setMinimumSize(Dimension dimension) |
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
|
abstract BufferedImage |
toImage(int width,
int height) |
void |
updateImage()
Recompute the picture, using last used dimensions.
|
getImage, getPreferedSize, render, setImage, setImage, setImageapplyViewport, getLastViewPort, getMode, getRectangle, renderSubScreenGrid, setScreenGridDisplayed, setViewPort, setViewPort, setViewportModeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLastViewPort, getMode, getPreferedSize, render, setViewPort, setViewPort, setViewportModeprotected AbstractDrawable drawable
protected Color foreground
protected Color background
protected Dimension minimumDimension
protected AWTImageGenerator imageGenerator
public AWTLegend(AbstractDrawable drawable)
public AWTLegend(AbstractDrawable drawable, Color foreground, Color background)
public void dispose()
public abstract BufferedImage toImage(int width, int height)
public void setViewPort(int width,
int height,
float left,
float right)
setViewPort in interface IImageViewportsetViewPort in class AbstractViewportManagerwidth - 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.public void drawableChanged(DrawableChangedEvent e)
drawableChanged in interface IDrawableListenerdrawableChanged in interface ILegendpublic void updateImage()
ILegendupdateImage in interface ILegendpublic void saveImage(String filename) throws IOException
IOExceptionpublic Dimension getMinimumSize()
AWTImageViewportgetMinimumSize in interface IImageViewportgetMinimumSize in class AWTImageViewportpublic void setMinimumSize(Dimension dimension)
public void setGeneratorColors()
public Color getForeground()
public void setForeground(Color foreground)
public Color getBackground()
public void setBackground(Color background)
public Dimension getMinimumDimension()
public void setMinimumDimension(Dimension minimumDimension)
Copyright © 2016. All rights reserved.