Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
4980:e70ff0a600a3 | 4981:0e6e44e6725f |
---|---|
1 package de.intevation.flys.client.client.ui.wq; | |
2 | |
3 import com.google.gwt.core.client.GWT; | |
4 import com.google.gwt.i18n.client.NumberFormat; | |
5 | |
6 import com.smartgwt.client.util.SC; | |
7 | |
8 import com.google.gwt.user.client.rpc.AsyncCallback; | |
9 | |
10 import de.intevation.flys.client.client.services.WQInfoService; | |
11 import de.intevation.flys.client.client.services.WQInfoServiceAsync; | |
12 | |
13 import de.intevation.flys.client.shared.model.WQInfoObject; | |
14 import de.intevation.flys.client.shared.model.WQInfoRecord; | |
15 | |
16 import de.intevation.flys.client.client.FLYSConstants; | |
17 | |
18 import de.intevation.flys.client.client.Config; | |
19 | |
20 public class WAutoTable extends WTable { | |
21 | |
22 WQInfoServiceAsync wqInfoService = | |
23 GWT.create(WQInfoService.class); | |
24 | |
25 public WAutoTable(String riverName, double[] dist) { | |
26 super(); | |
27 Config config = Config.getInstance(); | |
28 String locale = config.getLocale(); | |
29 wqInfoService.getWQInfo(locale, riverName, dist[0], dist[1], | |
30 new AsyncCallback<WQInfoObject[]>() { | |
31 @Override | |
32 public void onFailure(Throwable caught) { | |
33 GWT.log("Could not recieve wq informations."); | |
34 SC.warn(caught.getMessage()); | |
35 } | |
36 | |
37 @Override | |
38 public void onSuccess(WQInfoObject[] wqi) { | |
39 int num = wqi != null ? wqi.length :0; | |
40 GWT.log("Recieved " + num + " wq informations."); | |
41 | |
42 if (num == 0) { | |
43 return; | |
44 } | |
45 | |
46 addWQInfo(wqi); | |
47 | |
48 boolean isQ = false; | |
49 boolean isFree = false; | |
50 boolean isRange = true; | |
51 } | |
52 } | |
53 ); | |
54 } | |
55 | |
56 | |
57 protected void addWQInfo (WQInfoObject[] wqi) { | |
58 for(WQInfoObject wi: wqi) { | |
59 WQInfoRecord rec = new WQInfoRecord(wi); | |
60 | |
61 if (wi.getType().equals("W")) { | |
62 this.addData(rec); | |
63 } | |
64 else { | |
65 this.addData(rec); | |
66 } | |
67 } | |
68 } | |
69 } | |
70 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |