changeset 5133:8e52b4829cd1

Fix flys/issue1228: Units in tabular calculation output.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 28 Feb 2013 12:37:07 +0100 (2013-02-28)
parents c2b377bcc025
children 203c7babcd54 cad911029c9d
files flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java flys-artifacts/src/main/resources/messages.properties flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_de_DE.properties flys-artifacts/src/main/resources/messages_en.properties
diffstat 6 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java	Thu Feb 28 12:26:02 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java	Thu Feb 28 12:37:07 2013 +0100
@@ -246,6 +246,10 @@
         return Resources.getMsg(context.getMeta(), key, def);
     }
 
+    protected String msg(String key, String def, Object[] args) {
+        return Resources.getMsg(context.getMeta(), key, def, args);
+    }
+
 
     /**
      * This method starts CSV creation. It makes use of writeCSVData() which has
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Thu Feb 28 12:26:02 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Thu Feb 28 12:37:07 2013 +0100
@@ -426,10 +426,12 @@
     ) {
         logger.info("WaterlevelExporter.writeCSVHeader");
 
+        String unit = FLYSUtils.getRiver((FLYSArtifact) master).getWstUnit().getName();
+
         if (atGauge) {
             writer.writeNext(new String[] {
                 msg(CSV_KM_HEADER, DEFAULT_CSV_KM_HEADER),
-                msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER),
+                msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] { unit }),
                 msg(CSV_Q_HEADER, DEFAULT_CSV_Q_HEADER),
                 (isQ
                     ? msg(CSV_Q_DESC_HEADER, DEFAULT_CSV_Q_DESC_HEADER)
@@ -441,7 +443,8 @@
         else {
             writer.writeNext(new String[] {
                 msg(CSV_KM_HEADER, DEFAULT_CSV_KM_HEADER),
-                msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER),
+                    // TODO flys/issue1128 (unit per river)
+                msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] { unit }),
                 msg(CSV_Q_HEADER, DEFAULT_CSV_Q_HEADER),
                 msg(CSV_LOCATION_HEADER, DEFAULT_CSV_LOCATION_HEADER)
             });
--- a/flys-artifacts/src/main/resources/messages.properties	Thu Feb 28 12:26:02 2013 +0100
+++ b/flys-artifacts/src/main/resources/messages.properties	Thu Feb 28 12:37:07 2013 +0100
@@ -301,7 +301,7 @@
 
 
 export.waterlevel.csv.header.km = River-Km
-export.waterlevel.csv.header.w = W [NN + m]
+export.waterlevel.csv.header.w = W [{0}]
 export.waterlevel.csv.header.q = Q [m\u00b3/s]
 export.waterlevel.csv.header.q.desc = Description
 export.waterlevel.csv.header.location = Location
--- a/flys-artifacts/src/main/resources/messages_de.properties	Thu Feb 28 12:26:02 2013 +0100
+++ b/flys-artifacts/src/main/resources/messages_de.properties	Thu Feb 28 12:37:07 2013 +0100
@@ -291,7 +291,7 @@
 chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [m]
 
 export.waterlevel.csv.header.km = Fluss-Km
-export.waterlevel.csv.header.w = W [NN + m]
+export.waterlevel.csv.header.w = W [{0}]
 export.waterlevel.csv.header.q = Q [m\u00b3/s]
 export.waterlevel.csv.header.q.desc = Bezeichnung
 export.waterlevel.csv.header.location = Lage
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties	Thu Feb 28 12:26:02 2013 +0100
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties	Thu Feb 28 12:37:07 2013 +0100
@@ -300,7 +300,7 @@
 chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [m]
 
 export.waterlevel.csv.header.km = Fluss-Km
-export.waterlevel.csv.header.w = W [NN + m]
+export.waterlevel.csv.header.w = W [{0}]
 export.waterlevel.csv.header.q = Q [m\u00b3/s]
 export.waterlevel.csv.header.q.desc = Bezeichnung
 export.waterlevel.csv.header.location = Lage
--- a/flys-artifacts/src/main/resources/messages_en.properties	Thu Feb 28 12:26:02 2013 +0100
+++ b/flys-artifacts/src/main/resources/messages_en.properties	Thu Feb 28 12:37:07 2013 +0100
@@ -303,7 +303,7 @@
 chart.beddifference.yaxis.label.heights = Absolute Height [m]
 
 export.waterlevel.csv.header.km = River-Km
-export.waterlevel.csv.header.w = W [NN + m]
+export.waterlevel.csv.header.w = W [{0}]
 export.waterlevel.csv.header.q = Q [m\u00b3/s]
 export.waterlevel.csv.header.q.desc = Description
 export.waterlevel.csv.header.location = Location

http://dive4elements.wald.intevation.org