org.apache.struts2.dispatcher
Class ChartResult

java.lang.Object
  extended by org.apache.struts2.dispatcher.ChartResult
All Implemented Interfaces:
com.opensymphony.xwork2.Result, java.io.Serializable

public class ChartResult
extends java.lang.Object
implements com.opensymphony.xwork2.Result

A custom Result type for chart data. Built on top of JFreeChart. When executed this Result will write the given chart as a PNG to the servlet output stream.

See Also:
Serialized Form

Constructor Summary
ChartResult()
           
ChartResult(org.jfree.chart.JFreeChart chart, int height, int width)
           
 
Method Summary
 void execute(com.opensymphony.xwork2.ActionInvocation invocation)
          Executes the result.
 ChartResult setChart(org.jfree.chart.JFreeChart chart)
          Sets the JFreeChart to use.
 ChartResult setHeight(int height)
          Sets the chart height.
 ChartResult setWidth(int width)
          Sets the chart width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChartResult

public ChartResult()

ChartResult

public ChartResult(org.jfree.chart.JFreeChart chart,
                   int height,
                   int width)
Method Detail

setChart

public ChartResult setChart(org.jfree.chart.JFreeChart chart)
Sets the JFreeChart to use.

Parameters:
chart - a JFreeChart object.

setHeight

public ChartResult setHeight(int height)
Sets the chart height.

Parameters:
height - the height of the chart in pixels.

setWidth

public ChartResult setWidth(int width)
Sets the chart width.

Parameters:
width - the width of the chart in pixels.

execute

public void execute(com.opensymphony.xwork2.ActionInvocation invocation)
             throws java.lang.Exception
Executes the result. Writes the given chart as a PNG to the servlet output stream.

Specified by:
execute in interface com.opensymphony.xwork2.Result
Parameters:
invocation - an encapsulation of the action execution state.
Throws:
java.lang.Exception - if an error occurs when creating or writing the chart to the servlet output stream.


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.