Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java @ 782:4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
flys-client/trunk@2273 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 01 Jul 2011 08:44:24 +0000 |
parents | 6653cf54b45d |
children | 8ebaad41285b |
comparison
equal
deleted
inserted
replaced
781:6653cf54b45d | 782:4a7ece57f44c |
---|---|
13 import com.smartgwt.client.widgets.layout.HLayout; | 13 import com.smartgwt.client.widgets.layout.HLayout; |
14 import com.smartgwt.client.widgets.layout.VLayout; | 14 import com.smartgwt.client.widgets.layout.VLayout; |
15 import com.smartgwt.client.widgets.tab.TabSet; | 15 import com.smartgwt.client.widgets.tab.TabSet; |
16 import com.smartgwt.client.widgets.tab.Tab; | 16 import com.smartgwt.client.widgets.tab.Tab; |
17 | 17 |
18 import de.intevation.flys.client.shared.model.ArtifactDescription; | |
18 import de.intevation.flys.client.shared.model.Data; | 19 import de.intevation.flys.client.shared.model.Data; |
19 import de.intevation.flys.client.shared.model.DataItem; | 20 import de.intevation.flys.client.shared.model.DataItem; |
20 import de.intevation.flys.client.shared.model.DataList; | 21 import de.intevation.flys.client.shared.model.DataList; |
21 import de.intevation.flys.client.shared.model.DefaultData; | 22 import de.intevation.flys.client.shared.model.DefaultData; |
22 import de.intevation.flys.client.shared.model.DefaultDataItem; | 23 import de.intevation.flys.client.shared.model.DefaultDataItem; |
23 | 24 |
25 import de.intevation.flys.client.client.Config; | |
24 import de.intevation.flys.client.client.FLYSConstants; | 26 import de.intevation.flys.client.client.FLYSConstants; |
27 import de.intevation.flys.client.client.ui.range.DistanceInfoDataSource; | |
25 import de.intevation.flys.client.client.ui.range.RangeTable; | 28 import de.intevation.flys.client.client.ui.range.RangeTable; |
26 import de.intevation.flys.client.client.ui.range.LocationsTable; | 29 import de.intevation.flys.client.client.ui.range.LocationsTable; |
27 | 30 |
28 | 31 |
29 public class DistancePanel extends AbstractUIProvider implements BlurHandler { | 32 public class DistancePanel extends AbstractUIProvider implements BlurHandler { |
294 return Double.valueOf(defValue); | 297 return Double.valueOf(defValue); |
295 } | 298 } |
296 | 299 |
297 | 300 |
298 protected void initHelperPanel() { | 301 protected void initHelperPanel() { |
302 Config config = Config.getInstance(); | |
303 String url = config.getServerUrl(); | |
304 String river = getRiverName(); | |
305 | |
306 distancesTable.setAutoFetchData(true); | |
307 locationsTable.setAutoFetchData(true); | |
308 distancesTable.setDataSource(new DistanceInfoDataSource( | |
309 url, river, "distances")); | |
310 locationsTable.setDataSource(new DistanceInfoDataSource( | |
311 url, river, "locations")); | |
312 | |
299 tabs = new TabSet(); | 313 tabs = new TabSet(); |
300 tabs.setWidth100(); | 314 tabs.setWidth100(); |
301 tabs.setHeight100(); | 315 tabs.setHeight100(); |
302 | 316 |
303 Tab locations = new Tab(MSG.locations()); | 317 Tab locations = new Tab(MSG.locations()); |
309 tabs.addTab(locations, 0); | 323 tabs.addTab(locations, 0); |
310 tabs.addTab(distances, 1); | 324 tabs.addTab(distances, 1); |
311 | 325 |
312 helperContainer.addChild(tabs); | 326 helperContainer.addChild(tabs); |
313 } | 327 } |
328 | |
329 | |
330 protected String getRiverName() { | |
331 ArtifactDescription adescr = artifact.getArtifactDescription(); | |
332 DataList[] data = adescr.getOldData(); | |
333 | |
334 if (data != null && data.length > 0) { | |
335 for (int i = 0; i < data.length; i++) { | |
336 DataList dl = data[i]; | |
337 | |
338 if (dl.getState().equals("state.winfo.river")) { | |
339 for (int j = 0; j < dl.size(); j++) { | |
340 Data d = dl.get(j); | |
341 DataItem[] di = d.getItems(); | |
342 | |
343 if (di != null && di.length == 1) { | |
344 return d.getItems()[0].getStringValue(); | |
345 } | |
346 } | |
347 } | |
348 } | |
349 } | |
350 | |
351 return null; | |
352 } | |
314 } | 353 } |
315 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 354 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |