changeset 4144:d7db9baa4e62

#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 16 Oct 2012 09:55:15 +0200
parents 947d79b9c675
children d39f229ea990
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeComputeState.java
diffstat 2 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Oct 15 16:09:12 2012 +0200
+++ b/flys-artifacts/ChangeLog	Tue Oct 16 09:55:15 2012 +0200
@@ -1,3 +1,10 @@
+2012-10-16  Ingo Weinzierl <ingo@intevation.de>
+
+	flys/issue930
+
+	* src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeComputeState.java:
+	  Add unit [cm] to the facet description if calculation mode is W.
+
 2012-10-15  Ingo Weinzierl <ingo@intevation.de>
 
 	flys/issue904
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeComputeState.java	Mon Oct 15 16:09:12 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeComputeState.java	Tue Oct 16 09:55:15 2012 +0200
@@ -37,6 +37,8 @@
     private static final Logger logger =
         Logger.getLogger(HistoricalDischargeComputeState.class);
 
+    public static final String DEFAULT_UNIT = "cm";
+
 
     @Override
     protected void appendItems(
@@ -103,7 +105,7 @@
             facets.add(new HistoricalDischargeFacet(
                 i,
                 HISTORICAL_DISCHARGE_Q,
-                wqt.getName()));
+                createFacetTitle(wqt)));
 
             if (wqt instanceof HistoricalWQTimerange) {
                 logger.debug("Create another facet for historical differences.");
@@ -117,5 +119,25 @@
             i++;
         }
     }
+
+
+    protected String createFacetTitle(WQTimerange wqt) {
+        String name = wqt.getName();
+
+        return name != null && name.indexOf("W") >= 0
+            ? createFacetTitleW(wqt)
+            : createFacetTitleQ(wqt);
+    }
+
+
+    protected String createFacetTitleW(WQTimerange wqt) {
+        String name = wqt.getName();
+        return name + " " + DEFAULT_UNIT;
+    }
+
+
+    protected String createFacetTitleQ(WQTimerange wqt) {
+        return wqt.getName();
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org