Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/MeasurementStationTree.java @ 4327:7b701d9dca98
Reorder elements in the MeasurementStation details
Also add the gauge name to the info.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Tue, 30 Oct 2012 13:04:34 +0100 |
parents | 6589f1c95101 |
children | 651b93c10dc5 |
rev | line source |
---|---|
4269
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2 |
4290
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
3 import java.util.Date; |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
4 |
4269
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
5 import com.google.gwt.core.client.GWT; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
6 import com.google.gwt.event.dom.client.ClickEvent; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
7 import com.google.gwt.event.dom.client.ClickHandler; |
4290
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
8 import com.google.gwt.i18n.client.DateTimeFormat; |
4269
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
9 import com.google.gwt.i18n.client.NumberFormat; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
10 import com.google.gwt.user.client.ui.Anchor; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
11 import com.google.gwt.user.client.ui.DecoratorPanel; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
12 import com.google.gwt.user.client.ui.Grid; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
13 import com.google.gwt.user.client.ui.Label; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
14 import com.google.gwt.user.client.ui.Tree; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
15 import com.google.gwt.user.client.ui.TreeItem; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
16 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
17 import com.smartgwt.client.widgets.layout.HLayout; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
18 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.flys.client.client.FLYS; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.flys.client.shared.model.Data; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.flys.client.shared.model.DataItem; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.flys.client.shared.model.DataList; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.flys.client.shared.model.MeasurementStation; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.flys.client.shared.model.RiverInfo; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
25 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
26 import java.util.ArrayList; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
27 import java.util.Iterator; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
28 import java.util.List; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
29 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
30 /** |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
31 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
32 */ |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
33 public class MeasurementStationTree extends InfoTree { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
34 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
35 public MeasurementStationTree(FLYS flys) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
36 this.flys = flys; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
37 tree = new Tree(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
38 setWidget(tree); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
39 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
40 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
41 /** |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
42 * Resets the items of the tree. |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
43 * If the list of gauges is empty or null the tree will be empty. |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
44 */ |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
45 @Override |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
46 public void setRiverInfo(RiverInfo riverinfo) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
47 tree.clear(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
48 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
49 List<MeasurementStation> stations = riverinfo.getMeasurementStations(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
50 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
51 if (stations != null && !stations.isEmpty()) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
52 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
53 ArrayList<MeasurementStation> emptystations = |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
54 new ArrayList<MeasurementStation>(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
55 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
56 if (!riverinfo.isKmUp()) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
57 for (MeasurementStation station : stations) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
58 addStation(station, emptystations); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
59 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
60 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
61 else { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
62 for (int i = stations.size()-1; i >= 0; i--) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
63 MeasurementStation station = stations.get(i); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
64 addStation(station, emptystations); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
65 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
66 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
67 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
68 // put empty stations to the end |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
69 for (MeasurementStation station : emptystations) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
70 addStation(station); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
71 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
72 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
73 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
74 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
75 private void addStation(MeasurementStation station, |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
76 List<MeasurementStation> empty) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
77 if (station.getKmStart() != null && station.getKmEnd() != null) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
78 addStation(station); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
79 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
80 else { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
81 empty.add(station); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
82 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
83 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
84 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
85 private void addStation(MeasurementStation station) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
86 MeasurementStationItem sitem = |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
87 new MeasurementStationItem(flys, station); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
88 tree.addItem(sitem); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
89 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
90 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
91 class MeasurementStationItem extends TreeItem { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
92 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
93 private MeasurementStation station; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
94 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
95 public MeasurementStationItem(FLYS flys, MeasurementStation station) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
96 MeasurementStationHead head = |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
97 new MeasurementStationHead(flys, station); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
98 MeasurementStationDecoratorPanel |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
99 panel = new MeasurementStationDecoratorPanel(station); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
100 setWidget(head); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
101 addItem(panel); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
102 this.station = station; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
103 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
104 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
105 public Double getStart() { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
106 return station.getKmStart(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
107 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
108 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
109 public Double getEnd() { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
110 return station.getKmEnd(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
111 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
112 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
113 public Integer getID() { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
114 return station.getID(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
115 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
116 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
117 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
118 class MeasurementStationHead extends HLayout { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
119 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
120 public MeasurementStationHead(FLYS flys, MeasurementStation station) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
121 setStyleName("infohead"); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
122 setAutoHeight(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
123 setAutoWidth(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
124 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
125 NumberFormat nf = NumberFormat.getDecimalFormat(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
126 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
127 Label label = new Label(station.getName(), true); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
128 addMember(label); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
129 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
130 Double start; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
131 Double end; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
132 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
133 if (!station.isKmUp()) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
134 start = station.getKmStart(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
135 end = station.getKmEnd(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
136 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
137 else { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
138 start = station.getKmEnd(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
139 end = station.getKmStart(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
140 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
141 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
142 String kmtext = ""; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
143 if (start != null) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
144 kmtext += nf.format(start); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
145 kmtext += " - "; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
146 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
147 if (end != null) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
148 kmtext += nf.format(end); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
149 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
150 if (start != null || end != null) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
151 kmtext += " km"; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
152 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
153 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
154 label = new Label(kmtext); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
155 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
156 addMember(label); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
157 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
158 Double dstation = station.getStation(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
159 if (dstation != null) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
160 String stext = nf.format(dstation); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
161 stext += " km"; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
162 label = new Label(stext); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
163 addMember(label); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
164 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
165 |
4291
6589f1c95101
Add link for info about the measurement station
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4290
diff
changeset
|
166 Integer number = station.getID(); |
6589f1c95101
Add link for info about the measurement station
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4290
diff
changeset
|
167 String url = number != null ? |
6589f1c95101
Add link for info about the measurement station
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4290
diff
changeset
|
168 MSG.measurement_station_url() + number : |
6589f1c95101
Add link for info about the measurement station
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4290
diff
changeset
|
169 MSG.measurement_station_url(); |
6589f1c95101
Add link for info about the measurement station
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4290
diff
changeset
|
170 Anchor anchor = new Anchor(MSG.measurement_station_info_link(), |
6589f1c95101
Add link for info about the measurement station
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4290
diff
changeset
|
171 url, "_blank"); |
6589f1c95101
Add link for info about the measurement station
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4290
diff
changeset
|
172 addMember(anchor); |
4269
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
173 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
174 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
175 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
176 class MeasurementStationDecoratorPanel extends DecoratorPanel { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
177 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
178 public MeasurementStationDecoratorPanel(MeasurementStation station) { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
179 setStyleName("infopanel"); |
4327
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
180 Grid grid = new Grid(5, 2); |
4269
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
181 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
182 NumberFormat nf = NumberFormat.getDecimalFormat(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
183 |
4327
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
184 String type = station.getMeasurementType(); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
185 if (type != null) { |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
186 grid.setText(0, 0, MSG.measurement_station_type()); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
187 grid.setText(0, 1, type); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
188 } |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
189 |
4269
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
190 String riverside = station.getRiverSide(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
191 if (riverside != null) { |
4327
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
192 grid.setText(1, 0, MSG.riverside()); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
193 grid.setText(1, 1, riverside); |
4269
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
194 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
195 |
4327
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
196 String gaugename = station.getGaugeName(); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
197 if (gaugename != null) { |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
198 grid.setText(2, 0, MSG.measurement_station_gauge_name()); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
199 grid.setText(2, 1, gaugename); |
4269
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
200 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
201 |
4290
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
202 DateTimeFormat df = DateTimeFormat.getMediumDateFormat(); |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
203 |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
204 Date starttime = station.getStartTime(); |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
205 if (starttime != null) { |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
206 grid.setText(3, 0, MSG.measurement_station_start_time()); |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
207 grid.setText(3, 1, df.format(starttime)); |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
208 } |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
209 |
4327
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
210 String moperator = station.getOperator(); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
211 if (moperator != null) { |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
212 grid.setText(4, 0, MSG.measurement_station_operator()); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
213 grid.setText(4, 1, moperator); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
214 } |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
215 |
4269
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
216 setWidget(grid); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
217 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
218 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
219 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
220 @Override |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
221 public void open() { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
222 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
223 } |