[Dive4elements-commits] [PATCH] Fix the "Saale-Thüringen" hover effect in the interactive JS map

Wald Commits scm-commit at wald.intevation.org
Mon Jun 17 13:18:04 CEST 2013


# HG changeset patch
# User Christian Lins <christian.lins at intevation.de>
# Date 1371467880 -7200
# Node ID 0b3193d268b6bcf8960e22dfd97ce9985fc83c00
# Parent  39aaa4e358d28cff05443e60873b471e073b4e61
Fix the "Saale-Thüringen" hover effect in the interactive JS map.

diff -r 39aaa4e358d2 -r 0b3193d268b6 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/LinkSelection.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/LinkSelection.java	Mon Jun 17 12:05:49 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/LinkSelection.java	Mon Jun 17 13:18:00 2013 +0200
@@ -8,11 +8,7 @@
 
 package org.dive4elements.river.client.client.ui;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import com.google.gwt.core.client.GWT;
-
 import com.smartgwt.client.types.VerticalAlignment;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.HTMLPane;
@@ -29,6 +25,9 @@
 import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.dive4elements.river.client.client.FLYSConstants;
 import org.dive4elements.river.client.client.event.StepForwardEvent;
 import org.dive4elements.river.client.shared.model.Data;
@@ -67,7 +66,7 @@
 
     private class Trigger {
 
-        private LinkSelection ls;
+        private final LinkSelection ls;
 
         public Trigger(LinkSelection ls) {
             this.ls = ls;
@@ -310,6 +309,9 @@
 
     private static boolean availableRiver(String river) {
         HLayout row = riverList.get(river);
+        if (row == null) {
+            row = riverList.get(unstripRiver(river));
+        }
         return row != null && row.isVisible();
     }
 
@@ -319,11 +321,41 @@
         }
     }
 
-    private native void callHighlightRiver(String name) /*-{
+    /**
+     * Replaces some umlauts to ASCII chars. As JavaScript is extremly
+     * nasty with unicode characters we're doing this in Java.
+     * @param name
+     * @return
+     */
+    private String stripRiver(String name) {
+        return name.replace("\u00fc", "ue");
+    }
+
+    /**
+     * Replaces "ue" with the fitting umlaut unicode character.
+     * FIXME: This is a hack to make the "Saale-Thüringen" river hover effect
+     * working.
+     * @param name
+     * @return
+     */
+    private static String unstripRiver(String name) {
+        return name.replace("ue", "\u00fc");
+    }
+
+    private void callHighlightRiver(String name) {
+        GWT.log(stripRiver(name));
+        __callHighlightRiver(stripRiver(name));
+    }
+
+    private void callUnHighlightRiver(String name) {
+        __callUnHighlightRiver(stripRiver(name));
+    }
+
+    private native void __callHighlightRiver(String name) /*-{
         $wnd.highlight(name);
     }-*/;
 
-    private native void callUnHighlightRiver(String name) /*-{
+    private native void __callUnHighlightRiver(String name) /*-{
         $wnd.unHighlight(name);
     }-*/;
 
diff -r 39aaa4e358d2 -r 0b3193d268b6 gwt-client/src/main/webapp/images/FLYS_Karte_interactive.html
--- a/gwt-client/src/main/webapp/images/FLYS_Karte_interactive.html	Mon Jun 17 12:05:49 2013 +0200
+++ b/gwt-client/src/main/webapp/images/FLYS_Karte_interactive.html	Mon Jun 17 13:18:00 2013 +0200
@@ -26,7 +26,7 @@
         if (river) {
           highlighted = name;
           river.style.visibility="visible";
-        }
+        } 
       }
       function highlightList(name) {
         name = stripRiver(name);


More information about the Dive4elements-commits mailing list