changeset 7634:10993baf02c5

(issue1632) Add Unit to CSV export
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 03 Dec 2013 12:50:15 +0100
parents e469d9939a52
children 0426c1efd680
files artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadExporter.java
diffstat 1 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadExporter.java	Tue Dec 03 11:48:20 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadExporter.java	Tue Dec 03 12:50:15 2013 +0100
@@ -19,11 +19,14 @@
 
 import org.apache.log4j.Logger;
 
+import org.dive4elements.river.artifacts.access.SedimentLoadAccess;
 import org.dive4elements.river.artifacts.model.CalculationResult;
 import org.dive4elements.river.artifacts.model.minfo.SedimentLoad;
 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFraction;
 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadResult;
 
+import org.dive4elements.river.artifacts.D4EArtifact;
+
 import org.dive4elements.river.exports.AbstractExporter;
 
 import org.dive4elements.river.utils.Formatter;
@@ -140,16 +143,22 @@
         logger.debug("writeCSVHeader()");
 
         List<String> header = new LinkedList<String>();
-        if (results != null)  {
+        if (results != null) {
+            SedimentLoadAccess access =
+                new SedimentLoadAccess((D4EArtifact) master);
+
+            String unit = " [" + msg("state.minfo.sediment.load." +
+                    access.getUnit(), "translation missing") + "]";
+
             header.add(msg(CSV_KM,          "km"));
             header.add(msg(CSV_YEAR,        "Jahr"));
-            header.add(msg(CSV_SUSP_SEDIMENT, "Schwebst."));
-            header.add(msg(CSV_SUSP_SAND,   "Susp.Sand"));
-            header.add(msg(CSV_SUSP_SAND_BB, "Susp.Sand(BB)"));
-            header.add(msg(CSV_SAND,        "Sand"));
-            header.add(msg(CSV_FINEMIDDLE,  "Kies(f+m)"));
-            header.add(msg(CSV_COARSE,      "Kies(g)"));
-            header.add(msg(CSV_TOTAL,       "Gesamt"));
+            header.add(msg(CSV_SUSP_SEDIMENT, "Schwebst.") + unit);
+            header.add(msg(CSV_SUSP_SAND,   "Susp.Sand") + unit);
+            header.add(msg(CSV_SUSP_SAND_BB, "Susp.Sand(BB)") + unit);
+            header.add(msg(CSV_SAND,        "Sand") + unit);
+            header.add(msg(CSV_FINEMIDDLE,  "Kies(f+m)") + unit);
+            header.add(msg(CSV_COARSE,      "Kies(g)") + unit);
+            header.add(msg(CSV_TOTAL,       "Gesamt") + unit);
         }
         writer.writeNext(header.toArray(new String[header.size()]));
     }

http://dive4elements.wald.intevation.org