Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
2175:3f90f4d37c8d | 2176:65dac9cf6ff5 |
---|---|
35 | 35 |
36 | 36 |
37 /** The name of the CSV facet which triggers the CSV creation. */ | 37 /** The name of the CSV facet which triggers the CSV creation. */ |
38 public static final String FACET_CSV = "csv"; | 38 public static final String FACET_CSV = "csv"; |
39 | 39 |
40 /** The name of the PDF facet which triggers the PDF creation. */ | |
41 public static final String FACET_PDF = "pdf"; | |
42 | |
40 /** The default charset for the CSV export. */ | 43 /** The default charset for the CSV export. */ |
41 public static final String DEFAULT_CSV_CHARSET = "UTF-8"; | 44 public static final String DEFAULT_CSV_CHARSET = "UTF-8"; |
42 | 45 |
43 /** The default separator for the CSV export. */ | 46 /** The default separator for the CSV export. */ |
44 public static final char DEFAULT_CSV_SEPARATOR = ','; | 47 public static final char DEFAULT_CSV_SEPARATOR = ','; |
68 * objects into the CSV document. | 71 * objects into the CSV document. |
69 * | 72 * |
70 * @param writer The CSVWriter. | 73 * @param writer The CSVWriter. |
71 */ | 74 */ |
72 protected abstract void writeCSVData(CSVWriter writer); | 75 protected abstract void writeCSVData(CSVWriter writer); |
76 | |
77 | |
78 /** | |
79 * Concrete subclasses need to use this method to write their special data | |
80 * objects into the PDF document. | |
81 */ | |
82 protected abstract void writePDF(OutputStream out); | |
73 | 83 |
74 | 84 |
75 /** | 85 /** |
76 * This method enables concrete subclasses to collected its own special | 86 * This method enables concrete subclasses to collected its own special |
77 * data. | 87 * data. |
138 logger.debug("AbstractExporter.generate"); | 148 logger.debug("AbstractExporter.generate"); |
139 | 149 |
140 if (facet != null && facet.equals(FACET_CSV)) { | 150 if (facet != null && facet.equals(FACET_CSV)) { |
141 generateCSV(); | 151 generateCSV(); |
142 } | 152 } |
153 else if (facet != null && facet.equals(FACET_PDF)) { | |
154 generatePDF(); | |
155 } | |
143 else { | 156 else { |
144 throw new IOException("invalid facet for exporter."); | 157 throw new IOException("invalid facet for exporter."); |
145 } | 158 } |
146 } | 159 } |
147 | 160 |
221 writer.close(); | 234 writer.close(); |
222 } | 235 } |
223 | 236 |
224 | 237 |
225 /** | 238 /** |
239 * This method starts PDF creation. | |
240 */ | |
241 protected void generatePDF() | |
242 throws IOException | |
243 { | |
244 logger.info("AbstractExporter.generatePDF"); | |
245 writePDF(this.out); | |
246 } | |
247 | |
248 | |
249 /** | |
226 * Returns an instance of <i>EmptySettings</i> currently! | 250 * Returns an instance of <i>EmptySettings</i> currently! |
227 * | 251 * |
228 * @return an instance of <i>EmptySettings</i>. | 252 * @return an instance of <i>EmptySettings</i>. |
229 */ | 253 */ |
230 public Settings getSettings() { | 254 public Settings getSettings() { |