comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/wq/WQAutoTabSet.java @ 4985:8c9567dd2e60

Fix i18n in GaugeInfo Basedataview. Include Q values.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 14 Feb 2013 10:46:56 +0100
parents
children 1caf1d735079
comparison
equal deleted inserted replaced
4984:6baf466e8cb5 4985:8c9567dd2e60
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 import com.smartgwt.client.widgets.tab.Tab;
8 import com.smartgwt.client.widgets.tab.TabSet;
9
10 import com.google.gwt.user.client.rpc.AsyncCallback;
11
12 import de.intevation.flys.client.client.services.WQInfoService;
13 import de.intevation.flys.client.client.services.WQInfoServiceAsync;
14
15 import de.intevation.flys.client.shared.model.WQInfoObject;
16 import de.intevation.flys.client.shared.model.WQInfoRecord;
17
18 import de.intevation.flys.client.client.FLYSConstants;
19
20 import de.intevation.flys.client.client.Config;
21
22 public class WQAutoTabSet extends TabSet {
23
24 WQInfoServiceAsync wqInfoService =
25 GWT.create(WQInfoService.class);
26
27 /** The message class that provides i18n strings.*/
28 protected FLYSConstants MESSAGE = GWT.create(FLYSConstants.class);
29
30 protected QDTable qdTable;
31
32 protected WTable wTable;
33
34 public WQAutoTabSet(String riverName, double[] dist) {
35 super();
36
37 this.setWidth100();
38 this.setHeight100();
39
40 Tab wTab = new Tab(MESSAGE.wq_table_w());
41 Tab qTab = new Tab(MESSAGE.wq_table_q());
42
43 qdTable = new QDTable();
44 qdTable.hideIconFields();
45 wTable = new WTable();
46
47 wTab.setPane(wTable);
48 qTab.setPane(qdTable);
49
50 this.addTab(wTab, 0);
51 this.addTab(qTab, 1);
52
53 Config config = Config.getInstance();
54 String locale = config.getLocale();
55 wqInfoService.getWQInfo(locale, riverName, dist[0], dist[1],
56 new AsyncCallback<WQInfoObject[]>() {
57 @Override
58 public void onFailure(Throwable caught) {
59 GWT.log("Could not recieve wq informations.");
60 SC.warn(caught.getMessage());
61 }
62
63 @Override
64 public void onSuccess(WQInfoObject[] wqi) {
65 int num = wqi != null ? wqi.length :0;
66 GWT.log("Recieved " + num + " wq informations.");
67
68 if (num == 0) {
69 return;
70 }
71
72 addWQInfo(wqi);
73 }
74 }
75 );
76 }
77
78
79 protected void addWQInfo (WQInfoObject[] wqi) {
80 for(WQInfoObject wi: wqi) {
81 WQInfoRecord rec = new WQInfoRecord(wi);
82
83 if (wi.getType().equals("W")) {
84 wTable.addData(rec);
85 }
86 else {
87 qdTable.addData(rec);
88 }
89 }
90 }
91 }
92 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org