comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeInfoPanel.java @ 4962:6f6461e07854

Move classes to its own java file
author Björn Ricks <bjoern.ricks@intevation.de>
date Mon, 04 Feb 2013 14:56:41 +0100
parents
children 0e6e44e6725f
comparison
equal deleted inserted replaced
4961:27b4d5d20dc8 4962:6f6461e07854
1 package de.intevation.flys.client.client.ui.stationinfo;
2
3 import com.google.gwt.core.client.GWT;
4 import com.google.gwt.i18n.client.NumberFormat;
5 import com.google.gwt.user.client.ui.Grid;
6 import com.smartgwt.client.widgets.layout.VLayout;
7
8 import de.intevation.flys.client.client.FLYSConstants;
9 import de.intevation.flys.client.shared.model.GaugeInfo;
10
11 public class GaugeInfoPanel extends VLayout {
12
13 /** The message class that provides i18n strings.*/
14 private FLYSConstants MSG = GWT.create(FLYSConstants.class);
15
16 public GaugeInfoPanel(GaugeInfo gauge) {
17 setStyleName("gaugeinfopanel");
18 setWidth100();
19
20 Grid grid = new Grid(4, 2);
21
22 NumberFormat nf = NumberFormat.getDecimalFormat();
23
24 Double minw = gauge.getMinW();
25 Double maxw = gauge.getMaxW();
26 if (minw != null && maxw != null) {
27 grid.setText(0, 0, MSG.wq_value_q());
28 grid.setText(0, 1, nf.format(minw) +
29 " - " + nf.format(maxw));
30 }
31
32 Double minq = gauge.getMinQ();
33 Double maxq = gauge.getMaxQ();
34 if (minq != null && maxq != null) {
35 grid.setText(1, 0, MSG.wq_value_w());
36 grid.setText(1, 1, nf.format(minq) +
37 " - " + nf.format(maxq));
38 }
39
40 Double aeo = gauge.getAeo();
41 if (aeo != null) {
42 grid.setText(2, 0, "AEO [kmĀ²]");
43 grid.setText(2, 1, nf.format(aeo));
44 }
45
46 Double datum = gauge.getDatum();
47 if (datum != null) {
48 grid.setText(3, 0, MSG.gauge_zero() + " [" +
49 gauge.getWstUnit() + "]");
50 grid.setText(3, 1, nf.format(datum));
51 }
52
53 addMember(grid);
54 }
55 }

http://dive4elements.wald.intevation.org