changeset 4899:8cbea3354ac5 dc-km-filter

[branch:dc-km-filter] DatacageWindow: Send from/to-km to datacage.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 29 Jan 2013 12:05:12 +0100
parents ad9f1bdd51ba
children 137ff80f0a01
files flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWindow.java
diffstat 1 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWindow.java	Tue Jan 29 11:49:55 2013 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWindow.java	Tue Jan 29 12:05:12 2013 +0100
@@ -1,6 +1,7 @@
 package de.intevation.flys.client.client.ui;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import com.google.gwt.core.client.GWT;
@@ -68,11 +69,37 @@
         setWidth(400);
         setHeight(500);
 
+        String startKm =
+            artifact.getArtifactDescription().getDataValueAsString("ld_from");
+        String endKm =
+            artifact.getArtifactDescription().getDataValueAsString("ld_to");
+        String parameter = "load-system:true";
+
+        if (startKm == null || startKm.equals("") || endKm == null
+            || endKm.equals("")) {
+            String locations =
+                artifact.getArtifactDescription().getDataValueAsString("ld_locations");
+            if (locations != null && !locations.equals("")) {
+                String[] ls = locations.split(" ");
+                Double locs[] = new Double[ls.length];
+                for (int i = 0; i < ls.length ; i++) {
+                    locs[i] = Double.parseDouble(ls[i]);
+                }
+                Arrays.sort(locs);
+                parameter = parameter + ";startkm:" + locs[0] +
+                    ";endkm:" + locs[locs.length-1];
+            }
+        }
+        else {
+            parameter = parameter + ";startkm:" + startKm +
+                ";endkm:" + endKm;
+        }
+        GWT.log("parameter " + parameter);
         DatacageWidget dw = new DatacageWidget(
             artifact,
             user,
             outs,
-            "load-system:true",
+            parameter,
             true);
         dw.addDatacageHandler(this);
         dw.addDatacageDoubleClickHandler(this);

http://dive4elements.wald.intevation.org