diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeInfoPanel.java	Mon Feb 04 14:56:41 2013 +0100
@@ -0,0 +1,55 @@
+package de.intevation.flys.client.client.ui.stationinfo;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.i18n.client.NumberFormat;
+import com.google.gwt.user.client.ui.Grid;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import de.intevation.flys.client.client.FLYSConstants;
+import de.intevation.flys.client.shared.model.GaugeInfo;
+
+public class GaugeInfoPanel extends VLayout {
+
+    /** The message class that provides i18n strings.*/
+    private FLYSConstants MSG = GWT.create(FLYSConstants.class);
+
+    public GaugeInfoPanel(GaugeInfo gauge) {
+        setStyleName("gaugeinfopanel");
+        setWidth100();
+
+        Grid grid = new Grid(4, 2);
+
+        NumberFormat nf = NumberFormat.getDecimalFormat();
+
+        Double minw = gauge.getMinW();
+        Double maxw = gauge.getMaxW();
+        if (minw != null && maxw != null) {
+            grid.setText(0, 0, MSG.wq_value_q());
+            grid.setText(0, 1, nf.format(minw) +
+                    " - " + nf.format(maxw));
+        }
+
+        Double minq = gauge.getMinQ();
+        Double maxq = gauge.getMaxQ();
+        if (minq != null && maxq != null) {
+            grid.setText(1, 0, MSG.wq_value_w());
+            grid.setText(1, 1, nf.format(minq) +
+                    " - " + nf.format(maxq));
+        }
+
+        Double aeo = gauge.getAeo();
+        if (aeo != null) {
+            grid.setText(2, 0, "AEO [kmĀ²]");
+            grid.setText(2, 1, nf.format(aeo));
+        }
+
+        Double datum = gauge.getDatum();
+        if (datum != null) {
+            grid.setText(3, 0, MSG.gauge_zero() + " [" +
+                    gauge.getWstUnit() + "]");
+            grid.setText(3, 1, nf.format(datum));
+        }
+
+        addMember(grid);
+    }
+}

http://dive4elements.wald.intevation.org