Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult3.java @ 9332:c64de8cc4e97
bundu.bezugswst missing volume calcResult3
author | gernotbelger |
---|---|
date | Fri, 27 Jul 2018 19:24:57 +0200 |
parents | |
children | d194c5b24bf8 |
comparison
equal
deleted
inserted
replaced
9331:127638669052 | 9332:c64de8cc4e97 |
---|---|
1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde | |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package org.dive4elements.river.artifacts.bundu.bezugswst; | |
11 | |
12 import java.util.ArrayList; | |
13 import java.util.Collection; | |
14 | |
15 import org.dive4elements.river.artifacts.bundu.BunduResultType; | |
16 import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; | |
17 import org.dive4elements.river.artifacts.common.AbstractExportContext; | |
18 import org.dive4elements.river.artifacts.common.ExportContextCSV; | |
19 import org.dive4elements.river.artifacts.common.ExportContextPDF; | |
20 import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; | |
21 import org.dive4elements.river.artifacts.common.ResultRow; | |
22 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | |
23 | |
24 /** | |
25 * Contains the results of a //TODO LINK{@link BezugswstCalculation}. | |
26 * | |
27 * @author Gernot Belger | |
28 */ | |
29 final class BezugswstMissVolCalculationResult3 extends AbstractCalculationExportableResult implements BunduWstExporter.MissResultType { | |
30 | |
31 private static final long serialVersionUID = 1L; | |
32 | |
33 private static final String JASPER_FILE = "/jasper/templates/bundu.bezugswst.result3.jrxml"; | |
34 | |
35 public BezugswstMissVolCalculationResult3(final String label, final Collection<ResultRow> rows) { | |
36 super(label, rows); | |
37 | |
38 } | |
39 | |
40 @Override | |
41 protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) { | |
42 // no metadata | |
43 } | |
44 | |
45 @Override | |
46 protected String getJasperFile() { | |
47 return JASPER_FILE; | |
48 } | |
49 | |
50 protected String[] formatRow(final AbstractExportContext exportContext, final ResultRow row) { | |
51 | |
52 final Collection<String> lines = new ArrayList<>(20); | |
53 | |
54 lines.add(exportContext.formatRowValue(row, BunduResultType.stationForMiss)); | |
55 lines.add(exportContext.formatRowValue(row, BunduResultType.missVolume)); | |
56 lines.add(exportContext.formatRowValue(row, BunduResultType.missMass)); | |
57 return lines.toArray(new String[lines.size()]); | |
58 } | |
59 | |
60 @Override | |
61 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { | |
62 | |
63 final int colSize = 3; | |
64 exportContextCSV.writeTitleForTabs("bundu.export.csv.title.bezugswst.result3", colSize); // Voraussetzung für Tabs ist, dass der Titel vor den Headern | |
65 final Collection<String> header = new ArrayList<>(colSize); | |
66 | |
67 header.add(exportContextCSV.formatCsvHeader(BunduResultType.stationForMiss)); | |
68 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolume)); | |
69 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missMass)); | |
70 | |
71 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); | |
72 | |
73 } | |
74 | |
75 @Override | |
76 protected String[] formatCSVRow(final ExportContextCSV exportContextCSV, final ResultRow row) { | |
77 | |
78 return this.formatRow(exportContextCSV, row); | |
79 } | |
80 | |
81 @Override | |
82 protected String[] formatPDFRow(final ExportContextPDF exportContextPDF, final ResultRow row) { | |
83 | |
84 return this.formatRow(exportContextPDF, row); | |
85 } | |
86 | |
87 @Override | |
88 protected void addJRTableHeader(final ExportContextPDF exportContextPDF, final MetaAndTableJRDataSource source) { | |
89 /* column headings */ | |
90 | |
91 exportContextPDF.addJRMetadata(source, "station_header", BunduResultType.stationForMiss); | |
92 exportContextPDF.addJRMetadata(source, "channel_miss_volume_header", BunduResultType.missVolume); | |
93 exportContextPDF.addJRMetadata(source, "channel_miss_mass_header", BunduResultType.missMass); | |
94 | |
95 } | |
96 } |