changeset 6349:0b3193d268b6

Fix the "Saale-Thüringen" hover effect in the interactive JS map.
author Christian Lins <christian.lins@intevation.de>
date Mon, 17 Jun 2013 13:18:00 +0200
parents 39aaa4e358d2
children 876c797c2805
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/LinkSelection.java gwt-client/src/main/webapp/images/FLYS_Karte_interactive.html
diffstat 2 files changed, 40 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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);
     }-*/;
 
--- 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);

http://dive4elements.wald.intevation.org