changeset 2210:66408cdca36f

Override getLabelFor() in HistoricalDischargeState to return an I18N string for the selected evaluation mode. flys-artifacts/trunk@3844 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 31 Jan 2012 15:43:38 +0000
parents e5aac8a88f17
children 5400631d2f96
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeState.java
diffstat 2 files changed, 34 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Jan 31 15:14:54 2012 +0000
+++ b/flys-artifacts/ChangeLog	Tue Jan 31 15:43:38 2012 +0000
@@ -1,3 +1,9 @@
+2012-01-31  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeState.java:
+	  Override getLabelFor() to return the I18N string for the selected
+	  evaluation mode.
+
 2012-01-31  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/conf/artifacts/winfo.xml: Modified types of parameters in the
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeState.java	Tue Jan 31 15:14:54 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeState.java	Tue Jan 31 15:43:38 2012 +0000
@@ -23,6 +23,9 @@
         Logger.getLogger(HistoricalDischargeState.class);
 
 
+    public static final String I18N_MODE_W = "historical.mode.w";
+    public static final String I18N_MODE_Q = "historical.mode.q";
+
     public static final String DATA_MODE   = "historical_mode";
     public static final String DATA_VALUES = "historical_values";
     public static final int    DATA_MODE_W = 0;
@@ -80,6 +83,29 @@
     }
 
 
+    @Override
+    protected String getLabelFor(
+        CallContext cc,
+        String      name,
+        String      value,
+        String      type
+    ) {
+        CallMeta meta = cc.getMeta();
+
+        if (name.equals(DATA_MODE)) {
+            if (value.equals(String.valueOf(DATA_MODE_W))) {
+                return Resources.getMsg(meta, I18N_MODE_W, I18N_MODE_W);
+            }
+            else {
+                return Resources.getMsg(meta, I18N_MODE_Q, I18N_MODE_Q);
+            }
+        }
+        else {
+            return value;
+        }
+    }
+
+
     protected Element[] createModeItem(
         ElementCreator creator,
         Artifact       artifact,
@@ -93,13 +119,13 @@
         Element modeW = createItem(
             creator,
             new String[] {
-                Resources.getMsg(meta, "historical.mode.w","historical.mode.w"),
+                Resources.getMsg(meta, I18N_MODE_W, I18N_MODE_W),
                 String.valueOf(DATA_MODE_W) } );
 
         Element modeQ = createItem(
             creator,
             new String[] {
-                Resources.getMsg(meta, "historical.mode.q","historical.mode.q"),
+                Resources.getMsg(meta, I18N_MODE_Q, I18N_MODE_Q),
                 String.valueOf(DATA_MODE_Q) } );
 
         return new Element[] { modeW, modeQ };

http://dive4elements.wald.intevation.org