changeset 8235:c0da2514f4ce

(issue1448) Look through all the data for sq_ti_id in following states.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 08 Sep 2014 18:31:17 +0200 (2014-09-08)
parents b6371be363b1
children 90727aa9913d
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadEpochPanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadPeriodPanel.java
diffstat 2 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadEpochPanel.java	Mon Sep 08 17:52:52 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadEpochPanel.java	Mon Sep 08 18:31:17 2014 +0200
@@ -254,16 +254,19 @@
         String river = artifact.getArtifactDescription().getRiver();
 
         String sq_ti_id = "";
-        if (data.length > 0) {
-            Data str = getData(data[0].getAll(), "sq_ti_id");
+        for (int i = 0; i < data.length; i++) {
+            Data str = getData(data[i].getAll(), "sq_ti_id");
             if (str != null) {
                 DataItem[] strItems = str.getItems();
                 sq_ti_id = strItems[0].getStringValue();
-            } else {
-                GWT.log("Failed to find sq time interval id in data.");
+                break;
             }
         }
 
+        if (sq_ti_id.isEmpty()){
+            GWT.log("Failed to find sq time interval id in data.");
+        }
+
         sedLoadInfoService.getSedimentLoadInfo(locale, river, "single", km[0], km[1], sq_ti_id,
             new AsyncCallback<SedimentLoadInfoObject[]>() {
                 public void onFailure(Throwable caught) {
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadPeriodPanel.java	Mon Sep 08 17:52:52 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadPeriodPanel.java	Mon Sep 08 18:31:17 2014 +0200
@@ -207,16 +207,19 @@
         String river = artifact.getArtifactDescription().getRiver();
 
         String sq_ti_id = "";
-        if (data.length > 0) {
-            Data str = getData(data[0].getAll(), "sq_ti_id");
+        for (int i = 0; i < data.length; i++) {
+            Data str = getData(data[i].getAll(), "sq_ti_id");
             if (str != null) {
                 DataItem[] strItems = str.getItems();
                 sq_ti_id = strItems[0].getStringValue();
-            } else {
-                GWT.log("Failed to find sq time interval id in data.");
+                break;
             }
         }
 
+        if (sq_ti_id.isEmpty()){
+            GWT.log("Failed to find sq time interval id in data.");
+        }
+
         sedLoadInfoService.getSedimentLoadInfo(locale, river, "single", km[0], km[1], sq_ti_id,
             new AsyncCallback<SedimentLoadInfoObject[]>() {
                 public void onFailure(Throwable caught) {

http://dive4elements.wald.intevation.org