Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java @ 2176:65dac9cf6ff5
Issue 138.
PDF output for waterlevel calculation result.
flys-artifacts/trunk@3774 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 26 Jan 2012 15:38:46 +0000 |
parents | 0318fa6f0844 |
children | 5d1ba04d2f68 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Thu Jan 26 13:12:19 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Thu Jan 26 15:38:46 2012 +0000 @@ -37,6 +37,9 @@ /** The name of the CSV facet which triggers the CSV creation. */ public static final String FACET_CSV = "csv"; + /** The name of the PDF facet which triggers the PDF creation. */ + public static final String FACET_PDF = "pdf"; + /** The default charset for the CSV export. */ public static final String DEFAULT_CSV_CHARSET = "UTF-8"; @@ -73,6 +76,13 @@ /** + * Concrete subclasses need to use this method to write their special data + * objects into the PDF document. + */ + protected abstract void writePDF(OutputStream out); + + + /** * This method enables concrete subclasses to collected its own special * data. * @@ -140,6 +150,9 @@ if (facet != null && facet.equals(FACET_CSV)) { generateCSV(); } + else if (facet != null && facet.equals(FACET_PDF)) { + generatePDF(); + } else { throw new IOException("invalid facet for exporter."); } @@ -223,6 +236,17 @@ /** + * This method starts PDF creation. + */ + protected void generatePDF() + throws IOException + { + logger.info("AbstractExporter.generatePDF"); + writePDF(this.out); + } + + + /** * Returns an instance of <i>EmptySettings</i> currently! * * @return an instance of <i>EmptySettings</i>.