changeset 638:c580666a843f

Removed CallMeta object from state which should not be serialized. Implemented a little workarround instead to save localized strings for axes descriptions of horizontal profile charts (issue180). gnv-artifacts/trunk@721 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 02 Mar 2010 08:43:50 +0000
parents 154d158238d3
children a94ed2755480
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java
diffstat 2 files changed, 25 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Mon Mar 01 16:00:39 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Tue Mar 02 08:43:50 2010 +0000
@@ -1,3 +1,11 @@
+2010-03-02  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue180
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java:
+	  Removed CallMeta object from state which should not be serialized.
+	  Implemented a little workarround to save localized strings on this state.
+
 2010-03-01  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	  Issue182
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java	Mon Mar 01 16:00:39 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java	Tue Mar 02 08:43:50 2010 +0000
@@ -35,7 +35,8 @@
      */
     private static final long serialVersionUID = -7989531326553305293L;
 
-    protected CallMeta callMeta;
+    protected String ipos;
+    protected String jpos;
 
     /**
      * Constructor
@@ -54,12 +55,10 @@
             new NamedArrayList<KeyValueDescibeData>(dataName, 2);
 
         keyValueDescibeData.setMultiSelect(super.dataMultiSelect);
-        keyValueDescibeData.add(new DefaultKeyValueDescribeData("IPOSITION",
-                RessourceFactory.getInstance().getRessource(
-                        callMeta.getLanguages(), "iposition", "iposition")));
-        keyValueDescibeData.add(new DefaultKeyValueDescribeData("JPOSITION",
-                RessourceFactory.getInstance().getRessource(
-                        callMeta.getLanguages(), "jposition", "jposition")));
+        keyValueDescibeData.add(new DefaultKeyValueDescribeData(
+            "IPOSITION", ipos));
+        keyValueDescibeData.add(new DefaultKeyValueDescribeData(
+            "JPOSITION", jpos));
         describeData.add(keyValueDescibeData);
 
         return describeData;
@@ -72,7 +71,17 @@
     public void initialize(String uuid, CallContext context)
     throws StateException
     {
-        this.callMeta = context.getMeta();
+        CallMeta callMeta        = context.getMeta();
+        RessourceFactory factory = RessourceFactory.getInstance();
+
+        // XXX Workarround - we need these strings in purifyResult, but have no
+        // CallMeta object there which is necessary to get resources from 
+        // RessourceFactory. Storing the strings here is not nice, because the 
+        // Locale object could change!
+        ipos = factory.getRessource(
+            callMeta.getLanguages(), "iposition", "iposition");
+        jpos = factory.getRessource(
+            callMeta.getLanguages(), "jposition", "jposition");
     }
 
 

http://dive4elements.wald.intevation.org