Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationInfoPanel.java @ 8417:71144e25a6c9
Add comment to measurement stations info.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 16 Oct 2014 13:39:22 +0200 |
parents | 900299ab8e6e |
children |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.client.ui.stationinfo; |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
10 |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
11 import java.util.Date; |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
12 |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
13 import com.google.gwt.core.client.GWT; |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
14 import com.google.gwt.i18n.client.DateTimeFormat; |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
15 import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
16 import com.smartgwt.client.widgets.Label; |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
17 import com.smartgwt.client.widgets.layout.HLayout; |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
18 import com.smartgwt.client.widgets.layout.VLayout; |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
19 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
20 import org.dive4elements.river.client.client.FLYSConstants; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
21 import org.dive4elements.river.client.shared.model.MeasurementStation; |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
22 |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
23 public class MeasurementStationInfoPanel extends VLayout { |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
24 |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
25 /** The message class that provides i18n strings.*/ |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
26 private FLYSConstants MSG = GWT.create(FLYSConstants.class); |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
27 |
8417
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
28 private static final int KEY_WIDTH = 150; |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
29 |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
30 public MeasurementStationInfoPanel(MeasurementStation station) { |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
31 setStyleName("infopanel"); |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
32 setWidth100(); |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
33 |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
34 VLayout grid = new VLayout(); |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
35 |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
36 HLayout line1 = new HLayout(); |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
37 String type = station.getMeasurementType(); |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
38 if (type != null) { |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
39 Label key = new Label(MSG.measurement_station_type()); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
40 Label value = new Label(type); |
8417
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
41 key.setWidth(KEY_WIDTH); |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
42 line1.addMember(key); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
43 line1.addMember(value); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
44 grid.addMember(line1); |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
45 } |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
46 |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
47 HLayout line2 = new HLayout(); |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
48 String riverside = station.getRiverSide(); |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
49 if (riverside != null) { |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
50 Label key = new Label(MSG.riverside()); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
51 Label value = new Label(riverside); |
8417
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
52 key.setWidth(KEY_WIDTH); |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
53 line2.addMember(key); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
54 line2.addMember(value); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
55 grid.addMember(line2); |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
56 } |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
57 |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
58 HLayout line3 = new HLayout(); |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
59 String gaugename = station.getGaugeName(); |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
60 if (gaugename != null) { |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
61 Label key = new Label(MSG.measurement_station_gauge_name()); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
62 Label value = new Label(gaugename); |
8417
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
63 key.setWidth(KEY_WIDTH); |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
64 line3.addMember(key); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
65 line3.addMember(value); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
66 grid.addMember(line3); |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
67 } |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
68 |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
69 HLayout line4 = new HLayout(); |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
70 DateTimeFormat df = DateTimeFormat.getFormat( |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
71 PredefinedFormat.DATE_MEDIUM); |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
72 |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
73 Date starttime = station.getStartTime(); |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
74 if (starttime != null) { |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
75 Label key = new Label(MSG.measurement_station_start_time()); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
76 Label value = new Label(df.format(starttime)); |
8417
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
77 key.setWidth(KEY_WIDTH); |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
78 line4.addMember(key); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
79 line4.addMember(value); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
80 grid.addMember(line4); |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
81 } |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
82 |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
83 HLayout line5 = new HLayout(); |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
84 String moperator = station.getOperator(); |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
85 if (moperator != null) { |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
86 Label key = new Label(MSG.measurement_station_operator()); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
87 Label value = new Label(moperator); |
8417
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
88 key.setWidth(KEY_WIDTH); |
7933
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
89 line5.addMember(key); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
90 line5.addMember(value); |
900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
91 grid.addMember(line5); |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
92 } |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
93 |
8417
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
94 HLayout line6 = new HLayout(); |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
95 String mcomment = station.getComment(); |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
96 if (mcomment != null) { |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
97 Label key = new Label(MSG.measurement_station_comment()); |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
98 Label value = new Label(mcomment); |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
99 key.setWidth(KEY_WIDTH); |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
100 value.setWidth(300); |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
101 line6.addMember(key); |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
102 line6.addMember(value); |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
103 grid.addMember(line6); |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
104 } |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
7933
diff
changeset
|
105 |
4962
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
106 addMember(grid); |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
107 } |
6f6461e07854
Move classes to its own java file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
108 } |