changeset 6418:c702bac7f72e

Make wiki url configurable in gwt client (flys/#1197). It's probably better to retrieve that config from the server but this solution is faster ;) (ServerInfoService wip)
author Christian Lins <christian.lins@intevation.de>
date Wed, 26 Jun 2013 10:39:10 +0200
parents 14b5674e57a4
children ab173f37fb40
files gwt-client/src/main/java/org/dive4elements/river/client/client/Config.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/config.xml gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeRecord.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationRecord.java
diffstat 8 files changed, 56 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/Config.java	Tue Jun 25 15:18:43 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/Config.java	Wed Jun 26 10:39:10 2013 +0200
@@ -9,7 +9,6 @@
 package org.dive4elements.river.client.client;
 
 import com.google.gwt.i18n.client.LocaleInfo;
-
 import com.google.gwt.xml.client.Document;
 import com.google.gwt.xml.client.Node;
 
@@ -81,6 +80,17 @@
 
 
     /**
+     * Returns the URL of the FLYS/d4e-Wiki.
+     *
+     * @return wiki base URL
+     */
+    public String getWikiUrl() {
+        Node server = config.getElementsByTagName("wiki").item(0);
+        return server.getFirstChild().getNodeValue();
+    }
+
+
+    /**
      * Returns the name of the current locale.
      *
      * @return the name of the current locale.
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties	Tue Jun 25 15:18:43 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties	Wed Jun 26 10:39:10 2013 +0200
@@ -632,8 +632,8 @@
 gauge_q_unit = m\u00b3/s
 gauge_river_info_link = Riverinfo
 gauge_info_link = Gaugeinfo
-gauge_url = https://flys-intern.intevation.de/PegelInfo/
-gauge_river_url = https://flys-intern.intevation.de/GewaesserInfo/
+gauge_url = /PegelInfo/
+gauge_river_url = /GewaesserInfo/
 gauge_curve_link = Dischargecurve/-table
 discharge_timeranges = DC-Timeranges
 discharge_chart = W/Q-Preview
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Tue Jun 25 15:18:43 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Wed Jun 26 10:39:10 2013 +0200
@@ -631,8 +631,8 @@
 gauge_q_unit = m\u00b3/s
 gauge_river_info_link = Gew\u00e4sserinfo
 gauge_info_link = Pegelinfo
-gauge_url = https://flys-intern.intevation.de/PegelInfo/
-gauge_river_url = https://flys-intern.intevation.de/GewaesserInfo/
+gauge_url = /PegelInfo/
+gauge_river_url = /GewaesserInfo/
 gauge_curve_link = Abflusskurve/-tafel
 discharge_timeranges = AK-Zeitr\u00e4ume
 discharge_chart = W/Q-Vorschau
@@ -640,7 +640,7 @@
 measurement_station_type = Messstellenart
 measurement_station_operator = Betreiber
 measurement_station_start_time = Beginn der Aufzeichnung
-measurement_station_url = https://flys-intern.intevation.de/MessstellenInfo/
+measurement_station_url = /MessstellenInfo/
 measurement_station_info_link = Messstelleninfo
 measurement_station_gauge_name = hydrologischer Bezugspegel
 
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties	Tue Jun 25 15:18:43 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties	Wed Jun 26 10:39:10 2013 +0200
@@ -606,8 +606,8 @@
 gauge_q_unit = m\u00b3/s
 gauge_river_info_link = Riverinfo
 gauge_info_link = Gaugeinfo
-gauge_url = https://flys-intern.intevation.de/PegelInfo/
-gauge_river_url = https://flys-intern.intevation.de/GewaesserInfo/
+gauge_url = /PegelInfo/
+gauge_river_url = /GewaesserInfo/
 gauge_curve_link = Dischargecurve/-table
 discharge_timeranges = DC-Timeranges
 discharge_chart = W/Q-Preview
@@ -615,7 +615,7 @@
 measurement_station_type = Type of Measurement Station
 measurement_station_operator = Operator
 measurement_station_start_time = Observation Start Time
-measurement_station_url = https://flys-intern.intevation.de/MessstellenInfo/
+measurement_station_url = /MessstellenInfo/
 measurement_station_info_link = Measurement Station Info
 measurement_station_gauge_name = Reference Gauge
 
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/config.xml	Tue Jun 25 15:18:43 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/config.xml	Wed Jun 26 10:39:10 2013 +0200
@@ -1,5 +1,7 @@
 <config>
     <server>http://localhost:8181</server>
+    
+    <wiki>https://flys3-devel.bafg.de/wiki</wiki>
 
     <projectlist>
         <!-- The interval to update the user's projects (in ms) -->
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java	Tue Jun 25 15:18:43 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java	Wed Jun 26 10:39:10 2013 +0200
@@ -8,12 +8,6 @@
 
 package org.dive4elements.river.client.client.ui;
 
-import java.util.Iterator;
-
-import org.dive4elements.river.client.client.FLYS;
-import org.dive4elements.river.client.client.FLYSConstants;
-import org.dive4elements.river.client.shared.model.RiverInfo;
-
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.i18n.client.NumberFormat;
 import com.google.gwt.user.client.ui.HorizontalPanel;
@@ -22,6 +16,13 @@
 import com.smartgwt.client.widgets.form.DynamicForm;
 import com.smartgwt.client.widgets.form.fields.LinkItem;
 
+import java.util.Iterator;
+
+import org.dive4elements.river.client.client.Config;
+import org.dive4elements.river.client.client.FLYS;
+import org.dive4elements.river.client.client.FLYSConstants;
+import org.dive4elements.river.client.shared.model.RiverInfo;
+
 /**
  * Panel to display information about a river.
  * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
@@ -97,7 +98,8 @@
         String url = number != null ?
             MSG.gauge_river_url() + number :
             MSG.gauge_river_url();
-        DynamicForm infoLink = WikiLinks.linkHTML(this.flys, url,
+        String wikiBaseUrl = Config.getInstance().getWikiUrl();
+        DynamicForm infoLink = WikiLinks.linkHTML(this.flys, wikiBaseUrl + url,
                                         MSG.gauge_river_info_link());
         infoLink.setTop(5);
         LinkItem item = (LinkItem)infoLink.getField("saml");
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeRecord.java	Tue Jun 25 15:18:43 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeRecord.java	Wed Jun 26 10:39:10 2013 +0200
@@ -11,6 +11,7 @@
 import com.google.gwt.core.client.GWT;
 import com.smartgwt.client.widgets.grid.ListGridRecord;
 
+import org.dive4elements.river.client.client.Config;
 import org.dive4elements.river.client.client.FLYSConstants;
 import org.dive4elements.river.client.shared.model.GaugeInfo;
 
@@ -20,15 +21,17 @@
 public class GaugeRecord extends ListGridRecord implements GaugeInfo {
 
     /** The message class that provides i18n strings.*/
-    private FLYSConstants MSG = GWT.create(FLYSConstants.class);
+    private final FLYSConstants MSG = GWT.create(FLYSConstants.class);
 
     public GaugeRecord(GaugeInfo gauge) {
+        String wikiBaseUrl = Config.getInstance().getWikiUrl();
+
         setCanExpand(true);
         Long number = gauge.getOfficialNumber();
         String url = number != null ?
                 MSG.gauge_url() + number :
                 MSG.gauge_url();
-        setLink(url);
+        setLink(wikiBaseUrl + url);
         setLinkText(MSG.gauge_info_link());
         setName(gauge.getName());
         setKmStart(gauge.getKmStart());
@@ -59,6 +62,7 @@
         return this.getAttributeAsString("link");
     }
 
+    @Override
     public String getName() {
         return this.getAttributeAsString("name");
     }
@@ -67,6 +71,7 @@
         this.setAttribute("name", value);
     }
 
+    @Override
     public Double getKmStart() {
         return this.getAttributeAsDouble("kmstart");
     }
@@ -75,6 +80,7 @@
         this.setAttribute("kmstart", value);
     }
 
+    @Override
     public Double getKmEnd() {
         return this.getAttributeAsDouble("kmend");
     }
@@ -83,6 +89,7 @@
         this.setAttribute("kmend", value);
     }
 
+    @Override
     public Double getMinQ() {
         return this.getAttributeAsDouble("minq");
     }
@@ -91,6 +98,7 @@
         this.setAttribute("minq", value);
     }
 
+    @Override
     public Double getMaxQ() {
         return this.getAttributeAsDouble("maxq");
     }
@@ -99,6 +107,7 @@
         this.setAttribute("maxq", value);
     }
 
+    @Override
     public Double getMinW() {
         return this.getAttributeAsDouble("minw");
     }
@@ -107,6 +116,7 @@
         this.setAttribute("minw", value);
     }
 
+    @Override
     public Double getMaxW() {
         return this.getAttributeAsDouble("maxw");
     }
@@ -115,6 +125,7 @@
         this.setAttribute("maxw", value);
     }
 
+    @Override
     public Double getDatum() {
         return this.getAttributeAsDouble("datum");
     }
@@ -123,6 +134,7 @@
         this.setAttribute("datum", value);
     }
 
+    @Override
     public Double getAeo() {
         return this.getAttributeAsDouble("aeo");
     }
@@ -131,6 +143,7 @@
         this.setAttribute("aeo", value);
     }
 
+    @Override
     public boolean isKmUp() {
         return this.getAttributeAsBoolean("kmup");
     }
@@ -139,6 +152,7 @@
         this.setAttribute("kmup", value);
     }
 
+    @Override
     public Double getStation() {
         return this.getAttributeAsDouble("station");
     }
@@ -147,6 +161,7 @@
         this.setAttribute("station", value);
     }
 
+    @Override
     public String getWstUnit() {
         return this.getAttributeAsString("wstunit");
     }
@@ -155,6 +170,7 @@
         this.setAttribute("wstunit", value);
     }
 
+    @Override
     public Long getOfficialNumber() {
         return this.getAttributeAsLong("officialnumber");
     }
@@ -163,6 +179,7 @@
         this.setAttribute("officialnumber", number);
     }
 
+    @Override
     public String getRiverName() {
         return this.getAttributeAsString("rivername");
     }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationRecord.java	Tue Jun 25 15:18:43 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationRecord.java	Wed Jun 26 10:39:10 2013 +0200
@@ -8,11 +8,12 @@
 
 package org.dive4elements.river.client.client.ui.stationinfo;
 
-import java.util.Date;
-
 import com.google.gwt.core.client.GWT;
 import com.smartgwt.client.widgets.grid.ListGridRecord;
 
+import java.util.Date;
+
+import org.dive4elements.river.client.client.Config;
 import org.dive4elements.river.client.client.FLYSConstants;
 import org.dive4elements.river.client.shared.model.MeasurementStation;
 
@@ -24,16 +25,18 @@
 implements MeasurementStation {
 
     /** The message class that provides i18n strings.*/
-    private FLYSConstants MSG = GWT.create(FLYSConstants.class);
+    private final FLYSConstants MSG = GWT.create(FLYSConstants.class);
 
     public MeasurementStationRecord(MeasurementStation station) {
         this.setCanExpand(true);
 
+        String wikiBaseUrl = Config.getInstance().getWikiUrl();
+
         Integer number = station.getID();
         String stationName = station.getName();
         String stationIdent = stationName.replaceAll("\\W", "");
         String stationType = station.getMeasurementType();
-        String link = MSG.measurement_station_url() +
+        String link = wikiBaseUrl + MSG.measurement_station_url() +
             stationIdent + stationType;
         this.setLink(link);
         this.setLinkText(MSG.measurement_station_info_link());

http://dive4elements.wald.intevation.org