annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java @ 4268:f75968f0ce80

Refactor GaugePanel and GaugeInfo to extract a base class Extract a base class from GaugePanel and GaugeInfo to reuse code for displaying the measurement station information.
author Björn Ricks <bjoern.ricks@intevation.de>
date Fri, 26 Oct 2012 12:19:54 +0200
parents a1bc5b8cff0f
children
rev   line source
3715
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui;
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
2
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
3 import com.google.gwt.core.client.GWT;
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
4 import com.google.gwt.user.client.rpc.AsyncCallback;
3865
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3847
diff changeset
5 import de.intevation.flys.client.client.FLYS;
3715
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
6 import de.intevation.flys.client.shared.model.RiverInfo;
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
7
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
8 /**
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3974
diff changeset
9 * The GaugePanel is intended to be used within a SectionStackSection
3842
44c1beb78ad1 Move GaugeTree to its own java file
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3841
diff changeset
10 *
44c1beb78ad1 Move GaugeTree to its own java file
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3841
diff changeset
11 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
3715
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
12 */
4268
f75968f0ce80 Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4253
diff changeset
13 public class GaugePanel extends InfoPanel {
4253
a1bc5b8cff0f Refactor GaugePanel to create it's own SectionStackSection
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4243
diff changeset
14
3715
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
15 /**
4268
f75968f0ce80 Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4253
diff changeset
16 * GaugePanel loads the GaugeInfo from the RiverInfoService and
f75968f0ce80 Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4253
diff changeset
17 * displays them in a tree underneath a RiverInfoPanel
3865
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3847
diff changeset
18 *
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3847
diff changeset
19 * @param flys The FLYS object
3715
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
20 */
4253
a1bc5b8cff0f Refactor GaugePanel to create it's own SectionStackSection
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4243
diff changeset
21 public GaugePanel(FLYS flys) {
4268
f75968f0ce80 Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4253
diff changeset
22 super(new GaugeTree(flys));
3715
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
23 }
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
24
4268
f75968f0ce80 Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4253
diff changeset
25 @Override
f75968f0ce80 Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4253
diff changeset
26 public String getSectionTitle() {
f75968f0ce80 Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4253
diff changeset
27 return MSG.gaugePanelTitle();
3837
6b2ae2ec5b01 Open and close gauge tree folds that correspond to the selected WINFO
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3834
diff changeset
28 }
6b2ae2ec5b01 Open and close gauge tree folds that correspond to the selected WINFO
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3834
diff changeset
29
6b2ae2ec5b01 Open and close gauge tree folds that correspond to the selected WINFO
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3834
diff changeset
30 /**
3715
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
31 * Loads the river info and renders it afterwards
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
32 */
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
33 public void refresh() {
4253
a1bc5b8cff0f Refactor GaugePanel to create it's own SectionStackSection
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4243
diff changeset
34 contract();
a1bc5b8cff0f Refactor GaugePanel to create it's own SectionStackSection
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4243
diff changeset
35
4243
e68a710d9652 Convert GaugeOverviewInfoService into RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4229
diff changeset
36 riverInfoService.getGauges(this.river, new AsyncCallback<RiverInfo>() {
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3974
diff changeset
37 @Override
3715
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
38 public void onFailure(Throwable e) {
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
39 GWT.log("Could not load the river info." + e);
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
40 }
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
41
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3974
diff changeset
42 @Override
3715
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
43 public void onSuccess(RiverInfo riverinfo) {
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
44 GWT.log("Loaded river info");
4268
f75968f0ce80 Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4253
diff changeset
45 render(riverinfo);
4253
a1bc5b8cff0f Refactor GaugePanel to create it's own SectionStackSection
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4243
diff changeset
46 expand();
3715
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
47 }
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
48 });
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
49 }
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
50
8d3e48f189d2 Add first draft for the gauge overview info ui
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
51 }

http://dive4elements.wald.intevation.org