lt.monarch.chart.plugins
Class ImagePlugin<ChartType extends Chart<?>>

java.lang.Object
  extended by lt.monarch.chart.plugins.AbstractChartPlugin<ChartType>
      extended by lt.monarch.chart.plugins.ImagePlugin<ChartType>
All Implemented Interfaces:
java.io.Serializable, ChartPlugin<ChartType>
Direct Known Subclasses:
GIFEncoderPlugin, JPEGEncoderPlugin, PNGEncoderPlugin, SVGEncoderPlugin, TIFFEncoderPlugin, WBMPEncoderPlugin

public abstract class ImagePlugin<ChartType extends Chart<?>>
extends AbstractChartPlugin<ChartType>

Base plug-in class for generating chart images. Creates image from any specified View.

See Also:
Serialized Form

Nested Class Summary
Modifier and Type Class and Description
protected static class ImagePlugin.ChartImageBuilder
           
 
Field Summary
Modifier and Type Field and Description
protected  java.awt.Image chartImage
           
protected  View chartView
           
protected  java.awt.Container container
           
protected  AbstractEncoder encoder
           
protected  int imageHeight
           
protected  int imageWidth
           
protected  java.awt.Insets insets
           
protected  boolean scaleImage
           
 
Constructor Summary
Constructor and Description
ImagePlugin(java.awt.Container container)
          Plug-in constructor.
ImagePlugin(int iWidth, int iHeight, java.awt.Container container)
          Plug-in constructor.
ImagePlugin(int iWidth, int iHeight, View cView)
          Plugin constructor.
ImagePlugin(View cView)
          Plug-in constructor.
 
Method Summary
Modifier and Type Method and Description
 void activate()
          Called during plug-in installation
 void deactivate()
          Called during plug-in uninstall.
 void generateImageFile(java.io.OutputStream outStream)
          Generates image from chart View.
 AbstractEncoder getEncoder()
          Returns image encoder.
 java.awt.Insets getInsets()
          Returns insets that surrounds the original chart view i the resulting images.
protected  java.awt.Image processBeforeEncoding(java.awt.Image image)
          This method is called from generateImageFile method after chart is rendered into image and before image is passed to encoder.
 void setInsets(java.awt.Insets insets)
          Sets insets that will surround the original chart view or view of chart container in the resulting images.
 
Methods inherited from class lt.monarch.chart.plugins.AbstractChartPlugin
adjustChart, chart, getChart, install, isActivated, paint, uninstall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageWidth

protected int imageWidth

imageHeight

protected int imageHeight

chartView

protected View chartView

container

protected java.awt.Container container

scaleImage

protected boolean scaleImage

chartImage

protected java.awt.Image chartImage

encoder

protected AbstractEncoder encoder

insets

protected java.awt.Insets insets
Constructor Detail

ImagePlugin

public ImagePlugin(int iWidth,
                   int iHeight,
                   View cView)
Plugin constructor. View.

Parameters:
iWidth - width of chart image.
iHeight - height of chart image.
cView - View of the chart for image rendering.

ImagePlugin

public ImagePlugin(View cView)
Plug-in constructor. The size of the resulting image will be of the same as the size of the chart View.

Parameters:
cView - View of the chart for image rendering.

ImagePlugin

public ImagePlugin(int iWidth,
                   int iHeight,
                   java.awt.Container container)
Plug-in constructor. Allows to create an image from specified GUI Container.

Parameters:
iWidth - width of chart image.
iHeight - height of chart image.
container - Container of the chart for image rendering.

ImagePlugin

public ImagePlugin(java.awt.Container container)
Plug-in constructor. The size of the resulting image will be the same as the size of the chart Container.

Parameters:
container - Container of the chart for image rendering.
Method Detail

setInsets

public void setInsets(java.awt.Insets insets)
Sets insets that will surround the original chart view or view of chart container in the resulting images.

Parameters:
insets -

getInsets

public java.awt.Insets getInsets()
Returns insets that surrounds the original chart view i the resulting images.

Returns:
chart insets

activate

public void activate()
Called during plug-in installation

Specified by:
activate in class AbstractChartPlugin<ChartType extends Chart<?>>

deactivate

public void deactivate()
Called during plug-in uninstall.

Specified by:
deactivate in class AbstractChartPlugin<ChartType extends Chart<?>>

getEncoder

public AbstractEncoder getEncoder()
Returns image encoder.

Returns:
image encoder which is AbstractEncoder subclass.

generateImageFile

public void generateImageFile(java.io.OutputStream outStream)
Generates image from chart View.

Parameters:
outStream - where encoded image is sent.

processBeforeEncoding

protected java.awt.Image processBeforeEncoding(java.awt.Image image)
This method is called from generateImageFile method after chart is rendered into image and before image is passed to encoder.

Parameters:
image - image with chart view
Returns:
image after possible processing