changeset 1617:f13a7c126f24

Allow selection of multiple locations with mouse in MultipleLocationPanel. flys-client/trunk@3986 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 09 Feb 2012 09:52:37 +0000
parents ff8312688cd5
children 95b821d63db3
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java
diffstat 4 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Thu Feb 09 09:50:22 2012 +0000
+++ b/flys-client/ChangeLog	Thu Feb 09 09:52:37 2012 +0000
@@ -1,3 +1,15 @@
+2012-02-09	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java:
+	  Allow selection of more than one location via clicks to the
+	  locationpicker.
+
+	* src/main/java/de/intevation/flys/client/client/ui/LocationPanel.java:
+	  Initialize values in constructor.
+
+	* src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java:
+	  Minor cosmetics.
+
 2012-02-09	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/shared/DoubleUtils.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationPanel.java	Thu Feb 09 09:50:22 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationPanel.java	Thu Feb 09 09:52:37 2012 +0000
@@ -52,6 +52,7 @@
      * Creates a new LocationDistancePanel instance.
      */
     public LocationPanel() {
+        values = new double[0];
     }
 
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java	Thu Feb 09 09:50:22 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java	Thu Feb 09 09:52:37 2012 +0000
@@ -25,6 +25,7 @@
 import de.intevation.flys.client.shared.model.DataItem;
 import de.intevation.flys.client.shared.model.DataList;
 import de.intevation.flys.client.shared.model.DistanceInfoObject;
+import de.intevation.flys.client.shared.DoubleUtils;
 import de.intevation.flys.client.shared.model.RangeData;
 
 import de.intevation.flys.client.client.services.DistanceInfoService;
@@ -299,10 +300,11 @@
      * @param e event passed.
      */
     public void onRecordClick (RecordClickEvent e) {
-        Record record = e.getRecord();
-        double[] selected = new double[1];
+        Record record     = e.getRecord();
+        double[] old      = getLocationValues();
+        double[] selected = DoubleUtils.copyOf(old, old.length + 1);
         try {
-            selected[0] =
+            selected[old.length] =
                 Double.parseDouble(record.getAttribute("from"));
         }
         catch(NumberFormatException nfe) {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java	Thu Feb 09 09:50:22 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java	Thu Feb 09 09:52:37 2012 +0000
@@ -77,7 +77,7 @@
      */
     public Data[] getData() {
         saveLocationValues(locationPanel);
-        double[] values      = getLocationValues();
+        double[] values = getLocationValues();
         Data[] data = new Data[values.length+1];
 
         for (int i = 0; i < values.length; i++) {

http://dive4elements.wald.intevation.org