[PATCH] Add comment to measurement stations info

Wald Commits scm-commit at wald.intevation.org
Thu Oct 16 13:39:40 CEST 2014


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1413459562 -7200
# Node ID 71144e25a6c99b0929b447266da32ca1f47164c4
# Parent  6399ebc6fce9d137e6c5a12e502967fb33ef5e88
Add comment to measurement stations info.

diff -r 6399ebc6fce9 -r 71144e25a6c9 artifacts/src/main/java/org/dive4elements/river/artifacts/services/MeasurementStationInfoService.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/MeasurementStationInfoService.java	Thu Oct 16 11:15:09 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/MeasurementStationInfoService.java	Thu Oct 16 13:39:22 2014 +0200
@@ -114,6 +114,11 @@
                 }
             }
 
+            String comment = mstation.getComment();
+            if (comment != null) {
+                ec.addAttr(eg, "comment", comment, true);
+            }
+
             String gaugename = mstation.getGaugeName();
             if (gaugename != null) {
                 Element egauge = ec.create("gauge");
@@ -121,13 +126,6 @@
                 eg.appendChild(egauge);
             }
 
-            String comment = mstation.getComment();
-            if (comment != null) {
-                Element ecomment = ec.create("comment");
-                ec.addAttr(ecomment, "comment", comment, true);
-                eg.appendChild(ecomment);
-            }
-
             egs.appendChild(eg);
         }
 
diff -r 6399ebc6fce9 -r 71144e25a6c9 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java	Thu Oct 16 11:15:09 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java	Thu Oct 16 13:39:22 2014 +0200
@@ -1248,6 +1248,8 @@
 
     String measurement_station_operator();
 
+    String measurement_station_comment();
+
     String measurement_station_start_time();
 
     String measurement_station_url();
diff -r 6399ebc6fce9 -r 71144e25a6c9 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties	Thu Oct 16 11:15:09 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties	Thu Oct 16 13:39:22 2014 +0200
@@ -692,6 +692,7 @@
 measurement_station_url = https://flys-intern.intevation.de/MessstellenInfo/
 measurement_station_info_link = Measurement Station Info
 measurement_station_gauge_name = Reference Gauge
+measurement_station_comment = Comment
 
 # The prefix is used to classify them and will be stripped
 # If the payload part sarts with a number it will be sorted
diff -r 6399ebc6fce9 -r 71144e25a6c9 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Thu Oct 16 11:15:09 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Thu Oct 16 13:39:22 2014 +0200
@@ -691,6 +691,7 @@
 measurement_station_url = /MessstellenInfo/
 measurement_station_info_link = Messstelleninfo
 measurement_station_gauge_name = hydrologischer Bezugspegel
+measurement_station_comment = Hinweis
 
 # The prefix is used to classify them and will be stripped
 # If the payload part sarts with a number it will be sorted
diff -r 6399ebc6fce9 -r 71144e25a6c9 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties	Thu Oct 16 11:15:09 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties	Thu Oct 16 13:39:22 2014 +0200
@@ -666,6 +666,7 @@
 measurement_station_url = /MessstellenInfo/
 measurement_station_info_link = Measurement Station Info
 measurement_station_gauge_name = Reference Gauge
+measurement_station_comment = Comment
 
 # Get Feature Info Window
 PATH = Path
diff -r 6399ebc6fce9 -r 71144e25a6c9 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationInfoPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationInfoPanel.java	Thu Oct 16 11:15:09 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationInfoPanel.java	Thu Oct 16 13:39:22 2014 +0200
@@ -25,6 +25,8 @@
     /** The message class that provides i18n strings.*/
     private FLYSConstants MSG = GWT.create(FLYSConstants.class);
 
+    private static final int KEY_WIDTH = 150;
+
     public MeasurementStationInfoPanel(MeasurementStation station) {
         setStyleName("infopanel");
         setWidth100();
@@ -36,7 +38,7 @@
         if (type != null) {
             Label key = new Label(MSG.measurement_station_type());
             Label value = new Label(type);
-            key.setWidth(150);
+            key.setWidth(KEY_WIDTH);
             line1.addMember(key);
             line1.addMember(value);
             grid.addMember(line1);
@@ -47,7 +49,7 @@
         if (riverside != null) {
             Label key = new Label(MSG.riverside());
             Label value = new Label(riverside);
-            key.setWidth(150);
+            key.setWidth(KEY_WIDTH);
             line2.addMember(key);
             line2.addMember(value);
             grid.addMember(line2);
@@ -58,7 +60,7 @@
         if (gaugename != null) {
             Label key = new Label(MSG.measurement_station_gauge_name());
             Label value = new Label(gaugename);
-            key.setWidth(150);
+            key.setWidth(KEY_WIDTH);
             line3.addMember(key);
             line3.addMember(value);
             grid.addMember(line3);
@@ -72,7 +74,7 @@
         if (starttime != null) {
             Label key = new Label(MSG.measurement_station_start_time());
             Label value = new Label(df.format(starttime));
-            key.setWidth(150);
+            key.setWidth(KEY_WIDTH);
             line4.addMember(key);
             line4.addMember(value);
             grid.addMember(line4);
@@ -83,12 +85,24 @@
         if (moperator != null) {
             Label key = new Label(MSG.measurement_station_operator());
             Label value = new Label(moperator);
-            key.setWidth(150);
+            key.setWidth(KEY_WIDTH);
             line5.addMember(key);
             line5.addMember(value);
             grid.addMember(line5);
         }
 
+        HLayout line6 = new HLayout();
+        String mcomment = station.getComment();
+        if (mcomment != null) {
+            Label key = new Label(MSG.measurement_station_comment());
+            Label value = new Label(mcomment);
+            key.setWidth(KEY_WIDTH);
+            value.setWidth(300);
+            line6.addMember(key);
+            line6.addMember(value);
+            grid.addMember(line6);
+        }
+
         addMember(grid);
     }
 }
diff -r 6399ebc6fce9 -r 71144e25a6c9 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationRecord.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationRecord.java	Thu Oct 16 11:15:09 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationRecord.java	Thu Oct 16 13:39:22 2014 +0200
@@ -52,6 +52,7 @@
         this.setRiverSide(station.getRiverSide());
         this.setStartTime(station.getStartTime());
         this.setStopTime(station.getStopTime());
+        this.setComment(station.getComment());
     }
 
     @Override
@@ -153,6 +154,15 @@
         this.setAttribute("gaugename", value);
     }
 
+    @Override
+    public String getComment() {
+        return this.getAttributeAsString("comment");
+    }
+
+    private void setComment(String value) {
+        this.setAttribute("comment", value);
+    }
+
     public String getLink() {
         return this.getAttributeAsString("link");
     }
diff -r 6399ebc6fce9 -r 71144e25a6c9 gwt-client/src/main/java/org/dive4elements/river/client/server/RiverInfoServiceImpl.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/RiverInfoServiceImpl.java	Thu Oct 16 11:15:09 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/RiverInfoServiceImpl.java	Thu Oct 16 13:39:22 2014 +0200
@@ -240,6 +240,8 @@
                         ArtifactNamespaceContext.NAMESPACE_URI, "starttime");
                 String mstoptime = stationele.getAttributeNS(
                         ArtifactNamespaceContext.NAMESPACE_URI, "stoptime");
+                String mcomment = stationele.getAttributeNS(
+                        ArtifactNamespaceContext.NAMESPACE_URI, "comment");
 
                 String gaugename = null;
 
@@ -263,7 +265,8 @@
                         moperator,
                         parseDate(mstarttime),
                         parseDate(mstoptime),
-                        gaugename
+                        gaugename,
+                        mcomment
                         );
 
                 mstations.add(station);
diff -r 6399ebc6fce9 -r 71144e25a6c9 gwt-client/src/main/java/org/dive4elements/river/client/shared/model/DefaultMeasurementStation.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/DefaultMeasurementStation.java	Thu Oct 16 11:15:09 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/DefaultMeasurementStation.java	Thu Oct 16 13:39:22 2014 +0200
@@ -26,6 +26,7 @@
     private Date    starttime;
     private Date    stoptime;
     private String  gaugename;
+    private String  comment;
 
     public DefaultMeasurementStation() {
     }
@@ -41,8 +42,9 @@
             String  moperator,
             Date    starttime,
             Date    stoptime,
-            String  gaugename)
-    {
+            String  gaugename,
+            String  comment
+    ) {
         this.rivername       = rivername;
         this.name            = name;
         this.start           = start;
@@ -54,6 +56,7 @@
         this.starttime       = starttime;
         this.stoptime        = stoptime;
         this.gaugename       = gaugename;
+        this.comment         = comment;
     }
 
     /**
@@ -144,4 +147,11 @@
         return this.gaugename;
     }
 
+    /**
+     * Returns the comment to this measurement station
+     */
+    @Override
+    public String getComment() {
+        return this.comment;
+    }
 }
diff -r 6399ebc6fce9 -r 71144e25a6c9 gwt-client/src/main/java/org/dive4elements/river/client/shared/model/MeasurementStation.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/MeasurementStation.java	Thu Oct 16 11:15:09 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/MeasurementStation.java	Thu Oct 16 13:39:22 2014 +0200
@@ -70,4 +70,9 @@
      * Returns the name of the gauge in reference to this measurement station
      */
     String getGaugeName();
+
+    /**
+     * Returns the comment to this measurement station
+     */
+    String getComment();
 }


More information about the Dive4Elements-commits mailing list