de.laures.cewolf.taglib
Class ChartImageDefinition

java.lang.Object
  extended by de.laures.cewolf.taglib.ChartImageDefinition
All Implemented Interfaces:
ChartHolder, ChartImage, java.io.Serializable

public class ChartImageDefinition
extends java.lang.Object
implements ChartImage, ChartHolder, java.io.Serializable

Serializable implementaton of a ChartImage.

Author:
glaures
See Also:
ChartImage, Serialized Form

Field Summary
private  ChartHolder chartHolder
           
private  int height
           
private static org.apache.commons.logging.Log log
           
private  java.lang.String mimeType
           
private  RenderedImage renderedImage
           
private  java.util.Date timeoutTime
           
private  int type
           
private  int width
           
 
Fields inherited from interface de.laures.cewolf.ChartImage
IMG_TYPE_CHART, IMG_TYPE_LEGEND
 
Constructor Summary
ChartImageDefinition(ChartHolder ch, int width, int height, int type, java.lang.String mimeType, int timeout)
          Constructor for ChartImage
 
Method Summary
private  void ensureRendered()
           
protected  void finalize()
           
 byte[] getBytes()
          Writes out a cached image to an outputstream.
 java.lang.Object getChart()
          Returns a chart.
 java.lang.Object getDataset()
          Returns the dataset produced when using this definition.The type of this object is dependant on the underlying chart implementation.
 int getHeight()
          Returns the height.
 java.lang.String getMimeType()
          Returns the mimeType.
 java.lang.Object getRenderingInfo()
           
 int getSize()
          Returns the size of the image in bytes.
 java.util.Date getTimeoutTime()
           
 int getType()
          Returns the type of the chart image.
 int getWidth()
          Returns the width.
private  void onImageRendered(RenderedImage renderedImage)
          Implemented onImageRendered method.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

chartHolder

private final ChartHolder chartHolder

height

private final int height

width

private final int width

type

private final int type

mimeType

private final java.lang.String mimeType

timeoutTime

private final transient java.util.Date timeoutTime

renderedImage

private RenderedImage renderedImage
Constructor Detail

ChartImageDefinition

public ChartImageDefinition(ChartHolder ch,
                            int width,
                            int height,
                            int type,
                            java.lang.String mimeType,
                            int timeout)
Constructor for ChartImage

Method Detail

getHeight

public int getHeight()
Returns the height.

Specified by:
getHeight in interface ChartImage
Returns:
int

getWidth

public int getWidth()
Returns the width.

Specified by:
getWidth in interface ChartImage
Returns:
int

getType

public int getType()
Description copied from interface: ChartImage
Returns the type of the chart image.

Specified by:
getType in interface ChartImage
Returns:
the type of the chart image
See Also:
ChartImage.IMG_TYPE_CHART, ChartImage.IMG_TYPE_LEGEND

getChart

public java.lang.Object getChart()
                          throws DatasetProduceException,
                                 ChartValidationException,
                                 PostProcessingException
Description copied from interface: ChartHolder
Returns a chart. The type of this object is dependant on the underlying chart implementation. As of this version of Cewolf it is of type org.jfree.chart.JFreeChart.

Specified by:
getChart in interface ChartHolder
Returns:
the chart object for this definition
Throws:
DatasetProduceException - if there could be no data produced for the cahrt
PostProcessingException - if a post processor failed to process the chart
ChartValidationException

getDataset

public java.lang.Object getDataset()
                            throws DatasetProduceException
Description copied from interface: ChartHolder
Returns the dataset produced when using this definition.The type of this object is dependant on the underlying chart implementation. As of this version of Cewolf it is of type org.jfree.data.Dataset.

Specified by:
getDataset in interface ChartHolder
Returns:
Object the dataset for this definition
Throws:
DatasetProduceException - if the dataset could not be produced

getMimeType

public java.lang.String getMimeType()
Returns the mimeType.

Specified by:
getMimeType in interface ChartImage
Returns:
String

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable
See Also:
Object.finalize()

getRenderingInfo

public java.lang.Object getRenderingInfo()
                                  throws CewolfException
Throws:
CewolfException
See Also:
de.laures.cewolf.ChartImage#getRenderingInfo()

getBytes

public byte[] getBytes()
                throws CewolfException
Description copied from interface: ChartImage
Writes out a cached image to an outputstream. This method only marks the object as accessed and therfore frees it for cache cleanup.

Specified by:
getBytes in interface ChartImage
Throws:
CewolfException

ensureRendered

private void ensureRendered()
                     throws CewolfException
Throws:
CewolfException

getSize

public int getSize()
            throws CewolfException
Description copied from interface: ChartImage
Returns the size of the image in bytes.

Specified by:
getSize in interface ChartImage
Returns:
size of the image
Throws:
CewolfException - if the size could not be determined
See Also:
ChartImage.getSize()

getTimeoutTime

public java.util.Date getTimeoutTime()
Specified by:
getTimeoutTime in interface ChartImage

onImageRendered

private void onImageRendered(RenderedImage renderedImage)
Implemented onImageRendered method.

Parameters:
renderedImage - The image
See Also:
de.laures.cewolf.ChartHolder#onImageRendered(de.laures.cewolf.util.RenderedImage).