Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/exports/ChartExportHelper.java @ 771:a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
gnv-artifacts/trunk@827 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 25 Mar 2010 09:01:14 +0000 |
parents | e5f1e868ee3e |
children | 9a828e5a2390 |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ChartExportHelper.java Wed Mar 24 15:32:07 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ChartExportHelper.java Thu Mar 25 09:01:14 2010 +0000 @@ -37,15 +37,41 @@ import org.jfree.chart.JFreeChart; /** - * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + * This class is a helper class which supports some methods to export charts + * into specific formats. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class ChartExportHelper { + /** + * Constant field to define A4 as default page size. + */ private static final String DEFAULT_PAGE_SIZE = "A4"; + + /** + * Constant field to define UTF-8 as default encoding. + */ private static final String DEFAULT_ENCODING = "UTF-8"; + /** + * Logger used for logging with log4j. + */ private static Logger log = Logger.getLogger(ChartExportHelper.class); + + /** + * A method to export a <code>JFreeChart</code> as image to an + * <code>OutputStream</code> with a given format, width and height. + * + * @param out OutputStream + * @param JFreeChart Chart to be exported + * @param format Format (e.g. png, gif, jpg) + * @param width Width, the image used to be + * @param height Height, the image used to be + * + * @throws IOException if writing image to OutputStream failed. + */ public static void exportImage( OutputStream out, JFreeChart chart, @@ -67,6 +93,18 @@ } + /** + * A method to export a <code>JFreeChart</code> histogram as image to an + * <code>OutputStream</code> with a given format, width and height. + * + * @param out OutputStream + * @param histograms Array of {@link de.intevation.gnv.chart.Chart} objects + * @param format A format (e.g. png, gif, jpg) + * @param width Width the image used to be + * @param height Height the image used to be + * + * @throws IOException if writing image to OutputStream failed. + */ public static void exportHistograms( OutputStream out, Chart[] histograms, @@ -92,6 +130,16 @@ } + /** + * A method to export a <code>JFreeChart</code> histogram as SVG to an + * <code>OutputStream</code>. + * + * @param out OutputStream + * @param histograms Array of {@link de.intevation.gnv.chart.Chart} + * @param encoding Encoding, defaults to {@link DEFAULT_ENCODING} if null + * @param width Width the svg used to be + * @param height Height the svg used to be + */ public static void exportHistogramsAsSVG( OutputStream out, Chart[] histograms, @@ -127,6 +175,16 @@ } + /** + * A method to export a <code>JFreeChart</code> as SVG to an + * <code>OutputStream</code>. + * + * @param out OutputStream + * @param chart JFreeChart to be exported + * @param encoding Encoding, defaults to {@link DEFAULT_ENCODING} if null + * @param width Width the svg used to be + * @param height Height the svg used to be + */ public static void exportSVG( OutputStream out, JFreeChart chart, @@ -156,6 +214,21 @@ } + /** + * A method to export a <code>JFreeChart</code> as PDF to an + * <code>OutputStream</code>. + * + * @param out OutputStream + * @param chart JFreeChart + * @param pageFormat String to specify a page format, {@link + * DEFAULT_PAGE_SIZE} is used if no pageFormat is given + * @param landscape If this is true, the pdf is delivered in landscape + * format + * @param marginLeft Space to left border + * @param marginRight Space to right border + * @param marginTop Space to upper border + * @param marginBottom Space to lower border + */ public static void exportPDF( OutputStream out, JFreeChart chart, @@ -220,6 +293,22 @@ } + /** + * A method to export <code>JFreeChart</code> histograms as PDF to an + * <code>OutputStream</code>. Each histogram contained in histograms is + * drawn to an own page in the resulting pdf. + * + * @param out OutputStream + * @param histograms JFreeChart histograms + * @param pageFormat String to specify a page format, {@link + * DEFAULT_PAGE_SIZE} is used if no pageFormat is given + * @param landscape If this is true, the pdf is delivered in landscape + * format + * @param marginLeft Space to left border + * @param marginRight Space to right border + * @param marginTop Space to upper border + * @param marginBottom Space to lower border + */ public static void exportHistogramsAsPDF( OutputStream out, Chart[] histograms,