de.laures.cewolf.util
Class Renderer

java.lang.Object
  extended by de.laures.cewolf.util.Renderer
All Implemented Interfaces:
WebConstants

public class Renderer
extends java.lang.Object
implements WebConstants

Renderer for ChartImageDefinitions.

Author:
glaures, tbardzil
See Also:
ChartImage

Field Summary
private static org.apache.commons.logging.Log log
           
 
Fields inherited from interface de.laures.cewolf.WebConstants
AMPERSAND, HEIGHT_PARAM, IMG_PARAM, MIME_JPEG, MIME_PNG, MIME_SVG, REMOVE_AFTER_RENDERING, SESSIONID_KEY, WIDTH_PARAM
 
Constructor Summary
private Renderer()
          Creates a new instance of Renderer
 
Method Summary
static org.jfree.chart.title.LegendTitle getLegend(org.jfree.chart.JFreeChart chart)
           
private static void handleJPEG(java.io.ByteArrayOutputStream baos, org.jfree.chart.JFreeChart chart, int width, int height, org.jfree.chart.ChartRenderingInfo info)
          Handles rendering a chart as a JPEG.
private static void handlePNG(java.io.ByteArrayOutputStream baos, org.jfree.chart.JFreeChart chart, int width, int height, org.jfree.chart.ChartRenderingInfo info)
          Handles rendering a chart as a PNG.
private static void handleSVG(java.io.ByteArrayOutputStream baos, org.jfree.chart.JFreeChart chart, int width, int height)
          Handles rendering a chart as a SVG.
static void removeLegend(org.jfree.chart.JFreeChart chart)
           
static RenderedImage render(ChartImage cd, java.lang.Object chart)
          Renders a chart image
private static RenderedImage renderChart(ChartImage cd, java.lang.Object chart)
          Renders a chart
private static RenderedImage renderLegend(ChartImage cd, java.lang.Object c)
          Renders a legend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

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

Renderer

private Renderer()
Creates a new instance of Renderer

Method Detail

render

public static RenderedImage render(ChartImage cd,
                                   java.lang.Object chart)
                            throws CewolfException
Renders a chart image

Parameters:
cd - the chart to render
Returns:
the rendered image
Throws:
CewolfException

renderChart

private static RenderedImage renderChart(ChartImage cd,
                                         java.lang.Object chart)
                                  throws CewolfException
Renders a chart

Parameters:
cd - the chart image to be rendered
Returns:
the rendered image
Throws:
CewolfException

handlePNG

private static void handlePNG(java.io.ByteArrayOutputStream baos,
                              org.jfree.chart.JFreeChart chart,
                              int width,
                              int height,
                              org.jfree.chart.ChartRenderingInfo info)
                       throws java.io.IOException
Handles rendering a chart as a PNG. Currently this method is synchronized because of concurrency issues with JFreeChart.

Parameters:
baos -
chart -
width -
height -
info -
Throws:
java.io.IOException

handleJPEG

private static void handleJPEG(java.io.ByteArrayOutputStream baos,
                               org.jfree.chart.JFreeChart chart,
                               int width,
                               int height,
                               org.jfree.chart.ChartRenderingInfo info)
                        throws java.io.IOException
Handles rendering a chart as a JPEG. Currently this method is synchronized because of concurrency issues with JFreeChart.

Parameters:
baos -
chart -
width -
height -
info -
Throws:
java.io.IOException

handleSVG

private static void handleSVG(java.io.ByteArrayOutputStream baos,
                              org.jfree.chart.JFreeChart chart,
                              int width,
                              int height)
                       throws java.io.IOException
Handles rendering a chart as a SVG. Currently this method is synchronized because of concurrency issues with JFreeChart.

Parameters:
baos -
chart -
width -
height -
Throws:
java.io.IOException

getLegend

public static org.jfree.chart.title.LegendTitle getLegend(org.jfree.chart.JFreeChart chart)

removeLegend

public static void removeLegend(org.jfree.chart.JFreeChart chart)

renderLegend

private static RenderedImage renderLegend(ChartImage cd,
                                          java.lang.Object c)
                                   throws CewolfException
Renders a legend

Parameters:
cd - the chart iamge to be rendred
Returns:
the rendered image
Throws:
CewolfException