diff flys-client/src/main/java/de/intevation/flys/client/client/ui/wq/WAutoTable.java @ 4981:0e6e44e6725f

flys-client: (first draft) In GaugeInfo show link to show main values.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 14 Feb 2013 09:32:29 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/wq/WAutoTable.java	Thu Feb 14 09:32:29 2013 +0100
@@ -0,0 +1,70 @@
+package de.intevation.flys.client.client.ui.wq;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.i18n.client.NumberFormat;
+
+import com.smartgwt.client.util.SC;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+import de.intevation.flys.client.client.services.WQInfoService;
+import de.intevation.flys.client.client.services.WQInfoServiceAsync;
+
+import de.intevation.flys.client.shared.model.WQInfoObject;
+import de.intevation.flys.client.shared.model.WQInfoRecord;
+
+import de.intevation.flys.client.client.FLYSConstants;
+
+import de.intevation.flys.client.client.Config;
+
+public class WAutoTable extends WTable {
+
+    WQInfoServiceAsync wqInfoService =
+            GWT.create(WQInfoService.class);
+
+    public WAutoTable(String riverName, double[] dist) {
+        super();
+        Config config = Config.getInstance();
+        String locale = config.getLocale();
+        wqInfoService.getWQInfo(locale, riverName, dist[0], dist[1],
+            new AsyncCallback<WQInfoObject[]>() {
+                @Override
+                public void onFailure(Throwable caught) {
+                    GWT.log("Could not recieve wq informations.");
+                    SC.warn(caught.getMessage());
+                }
+
+                @Override
+                public void onSuccess(WQInfoObject[] wqi) {
+                    int num = wqi != null ? wqi.length :0;
+                    GWT.log("Recieved " + num + " wq informations.");
+
+                    if (num == 0) {
+                        return;
+                    }
+
+                    addWQInfo(wqi);
+
+                    boolean isQ = false;
+                    boolean isFree = false;
+                    boolean isRange = true;
+                }
+            }
+        );
+    }
+
+
+    protected void addWQInfo (WQInfoObject[] wqi) {
+        for(WQInfoObject wi: wqi) {
+            WQInfoRecord rec = new WQInfoRecord(wi);
+
+            if (wi.getType().equals("W")) {
+                this.addData(rec);
+            }
+            else {
+                this.addData(rec);
+            }
+        }
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org