wt.query.template
Class ChartRasterizer

java.lang.Object
  extended bywt.query.template.ChartRasterizer

public class ChartRasterizer
extends Object

Utility class for converting data in the form of a Swing TableModel into a raster image. Acceptable values for imageFormatName include "JPG" and "PNG".

The constant FORMAT_JPEG can be used to designate encoding using JPG format. By default, for those image format types that enable compression the default compression ratio is set to 75%


Nested Class Summary
static interface ChartRasterizer.ChartFactory
          Simplified version of Chartable interface providing just needed inputs here (may need extension).
 
Field Summary
static String FORMAT_JPEG
          Constant for the JPEG format type
 
Constructor Summary
ChartRasterizer()
           
 
Method Summary
static void writeImage(Chartable chartable, TableModel data, int width, int height, Locale locale, String options, String imageFormatName, OutputStream outputStream, boolean paintAll)
          Write chart defined by 'chartable', 'data', and 'options' to 'outputStream'.
static void writeImage(ChartRasterizer.ChartFactory chartFactory, TableModel data, int width, int height, Locale locale, String imageFormatName, OutputStream outputStream, boolean paintAll)
          Write chart defined by 'chartFactory' and 'data' to 'outputStream'.
static void writeImage(Component component, int width, int height, String imageFormatName, OutputStream outputStream, boolean paintAll)
           
static void writeImage(Component component, int width, int height, String imageFormatName, OutputStream outputStream, boolean paintAll, float quality)
          Rasterize 'component' to 'outputStream'.
static void writeImage(Component component, String imageFormatName, OutputStream outputStream, boolean paintAll)
          Rasterize 'component' to 'outputStream'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMAT_JPEG

public static final String FORMAT_JPEG
Constant for the JPEG format type

See Also:
Constant Field Values
Constructor Detail

ChartRasterizer

public ChartRasterizer()
Method Detail

writeImage

public static void writeImage(Chartable chartable,
                              TableModel data,
                              int width,
                              int height,
                              Locale locale,
                              String options,
                              String imageFormatName,
                              OutputStream outputStream,
                              boolean paintAll)
                       throws WTException,
                              IOException
Write chart defined by 'chartable', 'data', and 'options' to 'outputStream'.

Throws:
WTException
IOException

writeImage

public static void writeImage(ChartRasterizer.ChartFactory chartFactory,
                              TableModel data,
                              int width,
                              int height,
                              Locale locale,
                              String imageFormatName,
                              OutputStream outputStream,
                              boolean paintAll)
                       throws WTException,
                              IOException
Write chart defined by 'chartFactory' and 'data' to 'outputStream'.

Throws:
WTException
IOException

writeImage

public static void writeImage(Component component,
                              int width,
                              int height,
                              String imageFormatName,
                              OutputStream outputStream,
                              boolean paintAll)
                       throws WTException,
                              IOException
Throws:
WTException
IOException

writeImage

public static void writeImage(Component component,
                              int width,
                              int height,
                              String imageFormatName,
                              OutputStream outputStream,
                              boolean paintAll,
                              float quality)
                       throws WTException,
                              IOException
Rasterize 'component' to 'outputStream'.

Throws:
WTException
IOException

writeImage

public static void writeImage(Component component,
                              String imageFormatName,
                              OutputStream outputStream,
                              boolean paintAll)
                       throws WTException,
                              IOException
Rasterize 'component' to 'outputStream'. Assumes image is to have same dimensions as the component.

Throws:
WTException
IOException