changeset 2207:a38f43f626f5

Display the name of the reference gauge in the static ui of 'historical discharge curves' calculation. flys-artifacts/trunk@3832 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 30 Jan 2012 13:36:36 +0000
parents e2124ca11adb
children b8a1e488b684
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java
diffstat 2 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Jan 30 13:33:18 2012 +0000
+++ b/flys-artifacts/ChangeLog	Mon Jan 30 13:36:36 2012 +0000
@@ -1,3 +1,10 @@
+2012-01-30  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java:
+	  Override getLabelFor() method defined in DefaultState to return the name
+	  of a Gauge based on the official number which is stored in the
+	  parameterization.
+
 2012-01-30  Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Allow manual points in more diagram types.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java	Mon Jan 30 13:33:18 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java	Mon Jan 30 13:36:36 2012 +0000
@@ -28,6 +28,9 @@
         Logger.getLogger(ReferenceGaugeState.class);
 
 
+    public static final String DATA_NAME = "reference_gauge";
+
+
     @Override
     protected Element[] createItems(
         XMLUtils.ElementCreator cr,
@@ -56,5 +59,30 @@
 
         return opts;
     }
+
+
+    @Override
+    protected String getLabelFor(
+        CallContext cc,
+        String      name,
+        String      value,
+        String      type
+    ) {
+        if (name.equals(DATA_NAME)) {
+            try {
+                long  number = Long.valueOf(value);
+                Gauge gauge  = Gauge.getGaugeByOfficialNumber(number);
+
+                if (gauge != null) {
+                    return gauge.getName();
+                }
+            }
+            catch (NumberFormatException nfe) {
+                // do nothing
+            }
+        }
+
+        return super.getLabelFor(cc, name, value, type);
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org