Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/MeasurementStationTree.java @ 4476:099d136b215b
Try to fix resize problems with MapWidget in DigitizePanel (#802).
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Mon, 12 Nov 2012 21:12:08 +0100 |
parents | 651b93c10dc5 |
children | bbd82bd8e541 |
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 |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
5 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
|
6 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
|
7 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
|
8 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
|
9 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
|
10 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
|
11 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
|
12 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
|
13 |
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.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
|
15 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
16 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
|
17 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
|
18 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
|
19 |
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 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
|
21 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
|
22 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
23 /** |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
24 * @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
|
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 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
|
27 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
28 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
|
29 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
|
30 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
|
31 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
|
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 |
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 * 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
|
36 * 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
|
37 */ |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
38 @Override |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
39 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
|
40 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
|
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 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
|
43 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
44 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
|
45 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
46 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
|
47 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
|
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 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
|
50 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
|
51 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
|
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 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
54 else { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
55 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
|
56 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
|
57 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
|
58 } |
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 // 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
|
62 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
|
63 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
|
64 } |
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 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
|
69 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
|
70 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
|
71 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
|
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 else { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
74 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
|
75 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
76 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
77 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
78 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
|
79 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
|
80 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
|
81 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
|
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 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
|
85 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
86 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
|
87 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
88 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
|
89 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
|
90 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
|
91 MeasurementStationDecoratorPanel |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
92 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
|
93 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
|
94 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
|
95 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
|
96 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
97 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
98 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
|
99 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
|
100 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
101 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
102 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
|
103 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
|
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 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
106 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
|
107 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
|
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 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
110 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
111 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
|
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 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
|
114 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
|
115 setAutoHeight(); |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
116 setAutoWidth(); |
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 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
|
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 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
|
121 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
|
122 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
123 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
|
124 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
|
125 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
126 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
|
127 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
|
128 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
|
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 else { |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
131 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
|
132 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
|
133 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
134 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
135 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
|
136 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
|
137 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
|
138 kmtext += " - "; |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
139 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
140 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
|
141 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
|
142 } |
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 || 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
|
144 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
|
145 } |
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 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
|
148 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
149 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
|
150 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
151 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
|
152 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
|
153 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
|
154 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
|
155 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
|
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 |
4291
6589f1c95101
Add link for info about the measurement station
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4290
diff
changeset
|
159 Integer number = station.getID(); |
6589f1c95101
Add link for info about the measurement station
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4290
diff
changeset
|
160 String url = number != null ? |
6589f1c95101
Add link for info about the measurement station
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4290
diff
changeset
|
161 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
|
162 MSG.measurement_station_url(); |
6589f1c95101
Add link for info about the measurement station
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4290
diff
changeset
|
163 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
|
164 url, "_blank"); |
6589f1c95101
Add link for info about the measurement station
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4290
diff
changeset
|
165 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
|
166 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
167 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
168 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
169 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
|
170 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
171 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
|
172 setStyleName("infopanel"); |
4327
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
173 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
|
174 |
4327
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
175 String type = station.getMeasurementType(); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
176 if (type != null) { |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
177 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
|
178 grid.setText(0, 1, type); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
179 } |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
180 |
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 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
|
182 if (riverside != null) { |
4327
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
183 grid.setText(1, 0, MSG.riverside()); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
184 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
|
185 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
186 |
4327
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
187 String gaugename = station.getGaugeName(); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
188 if (gaugename != null) { |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
189 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
|
190 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
|
191 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
192 |
4290
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
193 DateTimeFormat df = DateTimeFormat.getMediumDateFormat(); |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
194 |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
195 Date starttime = station.getStartTime(); |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
196 if (starttime != null) { |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
197 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
|
198 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
|
199 } |
6aa8cd8da224
Display observation start time in measurement station tree
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4269
diff
changeset
|
200 |
4327
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
201 String moperator = station.getOperator(); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
202 if (moperator != null) { |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
203 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
|
204 grid.setText(4, 1, moperator); |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
205 } |
7b701d9dca98
Reorder elements in the MeasurementStation details
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4291
diff
changeset
|
206 |
4269
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
207 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
|
208 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
209 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
210 |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
211 @Override |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
212 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
|
213 } |
0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
214 } |