Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadExporter.java @ 7634:10993baf02c5
(issue1632) Add Unit to CSV export
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 03 Dec 2013 12:50:15 +0100 |
parents | 41567bf1e131 |
children | 0426c1efd680 |
comparison
equal
deleted
inserted
replaced
7633:e469d9939a52 | 7634:10993baf02c5 |
---|---|
17 | 17 |
18 import java.text.NumberFormat; | 18 import java.text.NumberFormat; |
19 | 19 |
20 import org.apache.log4j.Logger; | 20 import org.apache.log4j.Logger; |
21 | 21 |
22 import org.dive4elements.river.artifacts.access.SedimentLoadAccess; | |
22 import org.dive4elements.river.artifacts.model.CalculationResult; | 23 import org.dive4elements.river.artifacts.model.CalculationResult; |
23 import org.dive4elements.river.artifacts.model.minfo.SedimentLoad; | 24 import org.dive4elements.river.artifacts.model.minfo.SedimentLoad; |
24 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFraction; | 25 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFraction; |
25 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadResult; | 26 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadResult; |
27 | |
28 import org.dive4elements.river.artifacts.D4EArtifact; | |
26 | 29 |
27 import org.dive4elements.river.exports.AbstractExporter; | 30 import org.dive4elements.river.exports.AbstractExporter; |
28 | 31 |
29 import org.dive4elements.river.utils.Formatter; | 32 import org.dive4elements.river.utils.Formatter; |
30 | 33 |
138 /** Writes i18ned header for csv file/stream. */ | 141 /** Writes i18ned header for csv file/stream. */ |
139 protected void writeCSVHeader(CSVWriter writer) { | 142 protected void writeCSVHeader(CSVWriter writer) { |
140 logger.debug("writeCSVHeader()"); | 143 logger.debug("writeCSVHeader()"); |
141 | 144 |
142 List<String> header = new LinkedList<String>(); | 145 List<String> header = new LinkedList<String>(); |
143 if (results != null) { | 146 if (results != null) { |
147 SedimentLoadAccess access = | |
148 new SedimentLoadAccess((D4EArtifact) master); | |
149 | |
150 String unit = " [" + msg("state.minfo.sediment.load." + | |
151 access.getUnit(), "translation missing") + "]"; | |
152 | |
144 header.add(msg(CSV_KM, "km")); | 153 header.add(msg(CSV_KM, "km")); |
145 header.add(msg(CSV_YEAR, "Jahr")); | 154 header.add(msg(CSV_YEAR, "Jahr")); |
146 header.add(msg(CSV_SUSP_SEDIMENT, "Schwebst.")); | 155 header.add(msg(CSV_SUSP_SEDIMENT, "Schwebst.") + unit); |
147 header.add(msg(CSV_SUSP_SAND, "Susp.Sand")); | 156 header.add(msg(CSV_SUSP_SAND, "Susp.Sand") + unit); |
148 header.add(msg(CSV_SUSP_SAND_BB, "Susp.Sand(BB)")); | 157 header.add(msg(CSV_SUSP_SAND_BB, "Susp.Sand(BB)") + unit); |
149 header.add(msg(CSV_SAND, "Sand")); | 158 header.add(msg(CSV_SAND, "Sand") + unit); |
150 header.add(msg(CSV_FINEMIDDLE, "Kies(f+m)")); | 159 header.add(msg(CSV_FINEMIDDLE, "Kies(f+m)") + unit); |
151 header.add(msg(CSV_COARSE, "Kies(g)")); | 160 header.add(msg(CSV_COARSE, "Kies(g)") + unit); |
152 header.add(msg(CSV_TOTAL, "Gesamt")); | 161 header.add(msg(CSV_TOTAL, "Gesamt") + unit); |
153 } | 162 } |
154 writer.writeNext(header.toArray(new String[header.size()])); | 163 writer.writeNext(header.toArray(new String[header.size()])); |
155 } | 164 } |
156 | 165 |
157 /** Store data internally, accepting only SedimentLoadResults[] in | 166 /** Store data internally, accepting only SedimentLoadResults[] in |