changeset 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 27b4d5d20dc8
children 2b32ae372fc4
files flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeInfoHead.java flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeInfoPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeListGrid.java flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/InfoListGrid.java flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationInfoPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationListGrid.java
diffstat 6 files changed, 217 insertions(+), 187 deletions(-) [+]
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/GaugeInfoHead.java	Mon Feb 04 14:56:41 2013 +0100
@@ -0,0 +1,98 @@
+package de.intevation.flys.client.client.ui.stationinfo;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.i18n.client.NumberFormat;
+import com.google.gwt.user.client.ui.Anchor;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.layout.HLayout;
+
+import de.intevation.flys.client.client.FLYS;
+import de.intevation.flys.client.client.FLYSConstants;
+import de.intevation.flys.client.shared.model.GaugeInfo;
+
+public class GaugeInfoHead extends HLayout {
+
+    /** The message class that provides i18n strings.*/
+    private FLYSConstants MSG = GWT.create(FLYSConstants.class);
+
+    public GaugeInfoHead(FLYS flys, GaugeInfo gauge) {
+        setStyleName("gaugeinfohead");
+        setAutoHeight();
+        setAutoWidth();
+
+        NumberFormat nf = NumberFormat.getDecimalFormat();
+
+        Label label = new Label(gauge.getName());
+        addMember(label);
+
+        Double start;
+        Double end;
+
+        if (!gauge.isKmUp()) {
+            start = gauge.getKmStart();
+            end   = gauge.getKmEnd();
+        }
+        else {
+            start = gauge.getKmEnd();
+            end   = gauge.getKmStart();
+        }
+
+        String kmtext = "";
+        if (start != null) {
+            kmtext += nf.format(start);
+            kmtext += " - ";
+        }
+        if (end != null) {
+            kmtext += nf.format(end);
+        }
+        if (start != null || end != null) {
+            kmtext += " km";
+        }
+
+        label = new Label(kmtext);
+
+        addMember(label);
+
+        Double station = gauge.getStation();
+        if (station != null) {
+            String stext = nf.format(station);
+            stext += " km";
+            label = new Label(stext);
+            addMember(label);
+        }
+
+        Long number = gauge.getOfficialNumber();
+        String url = number != null ?
+                MSG.gauge_url() + number :
+                    MSG.gauge_url();
+        Anchor anchor = new Anchor(MSG.gauge_info_link(), url, "_blank");
+        addMember(anchor);
+
+        addMember(new GaugeCurveAnchor(flys, gauge));
+    }
+
+    class GaugeCurveAnchor extends Anchor implements ClickHandler {
+
+        private FLYS flys;
+        private GaugeInfo gauge;
+
+        public GaugeCurveAnchor(FLYS flys, GaugeInfo gauge) {
+            super(MSG.gauge_curve_link());
+            this.flys = flys;
+            this.gauge = gauge;
+
+            addClickHandler(this);
+        }
+
+        @Override
+        public void onClick(ClickEvent ev) {
+            GWT.log("GaugeCurveAnchor - onClick " + gauge.getRiverName() +
+                    " " + gauge.getOfficialNumber());
+            flys.newGaugeDischargeCurve(gauge.getRiverName(),
+                    gauge.getOfficialNumber());
+        }
+    }
+
+}
--- /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);
+    }
+}
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeListGrid.java	Mon Feb 04 13:49:15 2013 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeListGrid.java	Mon Feb 04 14:56:41 2013 +0100
@@ -4,21 +4,13 @@
 import java.util.List;
 
 import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.i18n.client.NumberFormat;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Grid;
 import com.smartgwt.client.types.ListGridFieldType;
 import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Label;
 import com.smartgwt.client.widgets.WidgetCanvas;
 import com.smartgwt.client.widgets.grid.ListGridField;
 import com.smartgwt.client.widgets.grid.ListGridRecord;
 import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
 import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
-import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.VLayout;
 
 import de.intevation.flys.client.client.FLYS;
 import de.intevation.flys.client.shared.model.Data;
@@ -88,131 +80,6 @@
         this.addData(new GaugeRecord(gauge));
     }
 
-
-    class GaugeInfoHead extends HLayout {
-
-        public GaugeInfoHead(FLYS flys, GaugeInfo gauge) {
-            setStyleName("gaugeinfohead");
-            setAutoHeight();
-            setAutoWidth();
-
-            NumberFormat nf = NumberFormat.getDecimalFormat();
-
-            Label label = new Label(gauge.getName());
-            addMember(label);
-
-            Double start;
-            Double end;
-
-            if (!gauge.isKmUp()) {
-                start = gauge.getKmStart();
-                end   = gauge.getKmEnd();
-            }
-            else {
-                start = gauge.getKmEnd();
-                end   = gauge.getKmStart();
-            }
-
-            String kmtext = "";
-            if (start != null) {
-                kmtext += nf.format(start);
-                kmtext += " - ";
-            }
-            if (end != null) {
-                kmtext += nf.format(end);
-            }
-            if (start != null || end != null) {
-                kmtext += " km";
-            }
-
-            label = new Label(kmtext);
-
-            addMember(label);
-
-            Double station = gauge.getStation();
-            if (station != null) {
-                String stext = nf.format(station);
-                stext += " km";
-                label = new Label(stext);
-                addMember(label);
-            }
-
-            Long number = gauge.getOfficialNumber();
-            String url = number != null ?
-                MSG.gauge_url() + number :
-                MSG.gauge_url();
-            Anchor anchor = new Anchor(MSG.gauge_info_link(), url, "_blank");
-            addMember(anchor);
-
-            addMember(new GaugeCurveAnchor(flys, gauge));
-        }
-    }
-
-    class GaugeCurveAnchor extends Anchor implements ClickHandler {
-
-        private FLYS flys;
-        private GaugeInfo gauge;
-
-        public GaugeCurveAnchor(FLYS flys, GaugeInfo gauge) {
-            super(MSG.gauge_curve_link());
-            this.flys = flys;
-            this.gauge = gauge;
-
-            addClickHandler(this);
-        }
-
-        @Override
-        public void onClick(ClickEvent ev) {
-            GWT.log("GaugeCurveAnchor - onClick " + gauge.getRiverName() +
-                    " " + gauge.getOfficialNumber());
-            flys.newGaugeDischargeCurve(gauge.getRiverName(),
-                    gauge.getOfficialNumber());
-        }
-    }
-
-    class GaugeInfoPanel extends VLayout {
-
-        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);
-        }
-    }
-
     public void open() {
         ArrayList<Double> locations = new ArrayList<Double>();
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/InfoListGrid.java	Mon Feb 04 13:49:15 2013 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/InfoListGrid.java	Mon Feb 04 14:56:41 2013 +0100
@@ -19,6 +19,9 @@
 
     protected FLYS flys;
     protected DataList[] data;
+    /** The message class that provides i18n strings.*/
+    protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
+
 
     public InfoListGrid(FLYS flys) {
         super();
@@ -27,9 +30,6 @@
         this.setCanExpandMultipleRecords(true);
     }
 
-    /** The message class that provides i18n strings.*/
-    protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
-
     public void openAll() {
         GWT.log("InfoListGrid - openAll");
         for (ListGridRecord record: this.getRecords()) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationInfoPanel.java	Mon Feb 04 14:56:41 2013 +0100
@@ -0,0 +1,60 @@
+package de.intevation.flys.client.client.ui.stationinfo;
+
+import java.util.Date;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
+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.MeasurementStation;
+
+public class MeasurementStationInfoPanel extends VLayout {
+
+    /** The message class that provides i18n strings.*/
+    private FLYSConstants MSG = GWT.create(FLYSConstants.class);
+
+    public MeasurementStationInfoPanel(MeasurementStation station) {
+        setStyleName("infopanel");
+        setWidth100();
+
+        Grid grid = new Grid(5, 2);
+
+        String type = station.getMeasurementType();
+        if (type != null) {
+            grid.setText(0, 0, MSG.measurement_station_type());
+            grid.setText(0, 1, type);
+        }
+
+        String riverside = station.getRiverSide();
+        if (riverside != null) {
+            grid.setText(1, 0, MSG.riverside());
+            grid.setText(1, 1, riverside);
+        }
+
+        String gaugename = station.getGaugeName();
+        if (gaugename != null) {
+            grid.setText(2, 0, MSG.measurement_station_gauge_name());
+            grid.setText(2, 1, gaugename);
+        }
+
+        DateTimeFormat df = DateTimeFormat.getFormat(
+                PredefinedFormat.DATE_MEDIUM);
+
+        Date starttime = station.getStartTime();
+        if (starttime != null) {
+            grid.setText(3, 0, MSG.measurement_station_start_time());
+            grid.setText(3, 1, df.format(starttime));
+        }
+
+        String moperator = station.getOperator();
+        if (moperator != null) {
+            grid.setText(4, 0, MSG.measurement_station_operator());
+            grid.setText(4, 1, moperator);
+        }
+
+        addMember(grid);
+    }
+}
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationListGrid.java	Mon Feb 04 13:49:15 2013 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationListGrid.java	Mon Feb 04 14:56:41 2013 +0100
@@ -1,23 +1,18 @@
 package de.intevation.flys.client.client.ui.stationinfo;
 
 import com.google.gwt.core.client.GWT;
-import com.google.gwt.i18n.client.DateTimeFormat;
-import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
-import com.google.gwt.user.client.ui.Grid;
 
 import com.smartgwt.client.types.ListGridFieldType;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.WidgetCanvas;
 import com.smartgwt.client.widgets.grid.ListGridField;
 import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.layout.VLayout;
 
 import de.intevation.flys.client.client.FLYS;
 import de.intevation.flys.client.shared.model.MeasurementStation;
 import de.intevation.flys.client.shared.model.RiverInfo;
 
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 
 /**
@@ -84,51 +79,6 @@
         this.addData(record);
     }
 
-    class MeasurementStationDecoratorPanel extends VLayout {
-
-        public MeasurementStationDecoratorPanel(MeasurementStation station) {
-            setStyleName("infopanel");
-            setWidth100();
-
-            Grid grid = new Grid(5, 2);
-
-            String type = station.getMeasurementType();
-            if (type != null) {
-                grid.setText(0, 0, MSG.measurement_station_type());
-                grid.setText(0, 1, type);
-            }
-
-            String riverside = station.getRiverSide();
-            if (riverside != null) {
-                grid.setText(1, 0, MSG.riverside());
-                grid.setText(1, 1, riverside);
-            }
-
-            String gaugename = station.getGaugeName();
-            if (gaugename != null) {
-               grid.setText(2, 0, MSG.measurement_station_gauge_name());
-               grid.setText(2, 1, gaugename);
-            }
-
-            DateTimeFormat df = DateTimeFormat.getFormat(
-                    PredefinedFormat.DATE_MEDIUM);
-
-            Date starttime = station.getStartTime();
-            if (starttime != null) {
-               grid.setText(3, 0, MSG.measurement_station_start_time());
-               grid.setText(3, 1, df.format(starttime));
-            }
-
-            String moperator = station.getOperator();
-            if (moperator != null) {
-                grid.setText(4, 0, MSG.measurement_station_operator());
-                grid.setText(4, 1, moperator);
-            }
-
-            addMember(grid);
-        }
-    }
-
     @Override
     public void open() {
     }
@@ -136,6 +86,6 @@
     @Override
     protected Canvas getExpandPanel(ListGridRecord record) {
         MeasurementStationRecord station = (MeasurementStationRecord)record;
-        return new WidgetCanvas(new MeasurementStationDecoratorPanel(station));
+        return new WidgetCanvas(new MeasurementStationInfoPanel(station));
     }
 }

http://dive4elements.wald.intevation.org