changeset 2938:0de3665daf36

Fix issue706. flys-client/trunk@4892 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Sun, 08 Jul 2012 07:44:34 +0000
parents a30d77d86386
children 8e6b1df7c3b0
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java
diffstat 2 files changed, 35 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Sat Jul 07 09:37:23 2012 +0000
+++ b/flys-client/ChangeLog	Sun Jul 08 07:44:34 2012 +0000
@@ -1,4 +1,11 @@
-2012-07-02	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+2012-07-08	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Fix issue706.
+
+	* src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java:
+	  Allow only one value to be entered by clicking.
+
+2012-07-07	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java,
 	  src/main/java/de/intevation/flys/client/client/ui/chart/ManualWSPEditor.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java	Sat Jul 07 09:37:23 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java	Sun Jul 08 07:44:34 2012 +0000
@@ -3,10 +3,16 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import com.google.gwt.core.client.GWT;
 import com.google.gwt.i18n.client.NumberFormat;
 
 import de.intevation.flys.client.shared.model.Data;
 
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+
+import com.smartgwt.client.data.Record;
+
 
 /**
  * This UIProvider creates a widget to enter a single location (km).
@@ -89,5 +95,26 @@
 
         return data;
     }
+
+
+    /* This is a copy of super.super.onRecordClick. Straighten out
+       this weird family. */
+    /**
+     * Callback when an item from the input helper was clicked.
+     * Set the respective km-value in the location value field.
+     * @param e event passed.
+     */
+    public void onRecordClick (RecordClickEvent e) {
+        Record record = e.getRecord();
+        double[] selected = new double[1];
+        try {
+            selected[0] =
+                Double.parseDouble(record.getAttribute("from"));
+        }
+        catch(NumberFormatException nfe) {
+            // Is there anything else to do here?
+        }
+        setLocationValues(selected);
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org