comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationRecord.java @ 4956:f46a07c11324

Refactor Pegel- and Messtelleninfo in client ui Use SmartGWT ListGrid instead of GWT Tree to display the station entires.
author Björn Ricks <bjoern.ricks@intevation.de>
date Fri, 01 Feb 2013 16:32:48 +0100
parents
children 3b58bb0c55e3
comparison
equal deleted inserted replaced
4950:4c7acc3a4ae1 4956:f46a07c11324
1 package de.intevation.flys.client.client.ui.stationinfo;
2
3 import java.util.Date;
4
5 import com.google.gwt.core.client.GWT;
6 import com.smartgwt.client.widgets.grid.ListGridRecord;
7
8 import de.intevation.flys.client.client.FLYSConstants;
9 import de.intevation.flys.client.shared.model.MeasurementStation;
10
11 /**
12 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
13 */
14 public class MeasurementStationRecord
15 extends ListGridRecord
16 implements MeasurementStation {
17
18 /** The message class that provides i18n strings.*/
19 private FLYSConstants MSG = GWT.create(FLYSConstants.class);
20
21 public MeasurementStationRecord(MeasurementStation station) {
22 this.setCanExpand(true);
23
24 Integer number = station.getID();
25 String link = number != null ?
26 MSG.measurement_station_url() + number :
27 MSG.measurement_station_url();
28 this.setLink(link);
29 this.setLinkText(MSG.measurement_station_info_link());
30 this.setID(number);
31 this.setName(station.getName());
32 if (station.isKmUp()) {
33 this.setKmEnd(station.getKmStart());
34 this.setKmStart(station.getKmEnd());
35 }
36 else {
37 this.setKmEnd(station.getKmEnd());
38 this.setKmStart(station.getKmStart());
39 }
40 this.setKmUp(station.isKmUp());
41 this.setRiverName(station.getRiverName());
42 this.setStation(station.getStation());
43 this.setGaugeName(station.getGaugeName());
44 this.setMeasurementType(station.getMeasurementType());
45 this.setOperator(station.getOperator());
46 this.setRiverSide(station.getRiverSide());
47 this.setStartTime(station.getStartTime());
48 this.setStopTime(station.getStopTime());
49 }
50
51 @Override
52 public Integer getID() {
53 return this.getAttributeAsInt("stationid");
54 }
55
56 private void setID(Integer value) {
57 this.setAttribute("stationid", value);
58 }
59
60 @Override
61 public String getName() {
62 return this.getAttributeAsString("name");
63 }
64
65 private void setName(String value) {
66 this.setAttribute("name", value);
67 }
68
69 @Override
70 public Double getKmStart() {
71 return this.getAttributeAsDouble("kmstart");
72 }
73
74 private void setKmStart(Double value) {
75 this.setAttribute("kmstart", value);
76 }
77
78 @Override
79 public Double getKmEnd() {
80 return this.getAttributeAsDouble("kmend");
81 }
82
83 private void setKmEnd(Double value) {
84 this.setAttribute("kmend", value);
85 }
86
87 @Override
88 public boolean isKmUp() {
89 return this.getAttributeAsBoolean("kmup");
90 }
91
92 private void setKmUp(boolean value) {
93 this.setAttribute("kmup", value);
94 }
95
96 @Override
97 public Double getStation() {
98 return this.getAttributeAsDouble("station");
99 }
100
101 private void setStation(Double station) {
102 this.setAttribute("station", station);
103 }
104
105 @Override
106 public String getRiverName() {
107 return this.getAttributeAsString("rivername");
108 }
109
110 private void setRiverName(String rivername) {
111 this.setAttribute("rivername", rivername);
112 }
113
114 @Override
115 public String getRiverSide() {
116 return this.getAttributeAsString("riverside");
117 }
118
119 private void setRiverSide(String riverside) {
120 this.setAttribute("riverside", riverside);
121 }
122
123 @Override
124 public String getMeasurementType() {
125 return this.getAttributeAsString("measurementtype");
126 }
127
128 private void setMeasurementType(String value) {
129 this.setAttribute("measurementtype", value);
130 }
131
132 @Override
133 public String getOperator() {
134 return this.getAttributeAsString("operator");
135 }
136
137 private void setOperator(String value) {
138 this.setAttribute("operator", value);
139 }
140
141 @Override
142 public Date getStartTime() {
143 return this.getAttributeAsDate("starttime");
144 }
145
146 private void setStartTime(Date value) {
147 this.setAttribute("starttime", value);
148 }
149
150 @Override
151 public Date getStopTime() {
152 return this.getAttributeAsDate("stoptime");
153 }
154
155 private void setStopTime(Date value) {
156 this.setAttribute("stoptime", value);
157 }
158
159 @Override
160 public String getGaugeName() {
161 return this.getAttributeAsString("gaugename");
162 }
163
164 private void setGaugeName(String value) {
165 this.setAttribute("gaugename", value);
166 }
167
168 public String getLink() {
169 return this.getAttributeAsString("link");
170 }
171
172 public void setLink(String link) {
173 this.setAttribute("link", link);
174 }
175 }

http://dive4elements.wald.intevation.org