changeset 8417:71144e25a6c9

Add comment to measurement stations info.
author Tom Gottfried <tom@intevation.de>
date Thu, 16 Oct 2014 13:39:22 +0200
parents 6399ebc6fce9
children 536a1c0c8a81
files artifacts/src/main/java/org/dive4elements/river/artifacts/services/MeasurementStationInfoService.java gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationInfoPanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationRecord.java gwt-client/src/main/java/org/dive4elements/river/client/server/RiverInfoServiceImpl.java gwt-client/src/main/java/org/dive4elements/river/client/shared/model/DefaultMeasurementStation.java gwt-client/src/main/java/org/dive4elements/river/client/shared/model/MeasurementStation.java
diffstat 10 files changed, 60 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- 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);
         }
 
--- 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();
--- 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
--- 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
--- 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
--- 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);
     }
 }
--- 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");
     }
--- 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);
--- 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;
+    }
 }
--- 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();
 }

http://dive4elements.wald.intevation.org