Mercurial > dive4elements > river
changeset 3847:f3b821735e39
Calculate the info url via i18n
Don't fetch the info url from the artifact service and use i18n to calculate the
url by using the official gauge and river number.
flys-client/trunk@5582 c6561f87-3c4e-4783-a992-168aeb5c3f6f
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Sat Sep 22 22:26:38 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Mon Sep 24 08:39:22 2012 +0000 @@ -1037,5 +1037,9 @@ String gauge_info_link(); String gauge_river_info_link(); + + String gauge_river_url(); + + String gauge_url(); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Sat Sep 22 22:26:38 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Mon Sep 24 08:39:22 2012 +0000 @@ -539,3 +539,5 @@ 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/
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Sat Sep 22 22:26:38 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Mon Sep 24 08:39:22 2012 +0000 @@ -537,3 +537,5 @@ 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/
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Sat Sep 22 22:26:38 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Mon Sep 24 08:39:22 2012 +0000 @@ -538,3 +538,5 @@ 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/
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java Sat Sep 22 22:26:38 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java Mon Sep 24 08:39:22 2012 +0000 @@ -186,7 +186,11 @@ addLabel(qtext, false); - Anchor anchor = new Anchor(MSG.gauge_river_info_link(), riverinfo.getInfoURL()); + Long number = riverinfo.getOfficialNumber(); + String url = number != null ? + MSG.gauge_river_url() + number : + MSG.gauge_river_url(); + Anchor anchor = new Anchor(MSG.gauge_river_info_link(), url); add(anchor); }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java Sat Sep 22 22:26:38 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java Mon Sep 24 08:39:22 2012 +0000 @@ -384,7 +384,12 @@ addMember(label); } - addMember(new Anchor(MSG.gauge_info_link(), gauge.getInfoURL())); + Long number = gauge.getOfficialNumber(); + String url = number != null ? + MSG.gauge_url() + number : + MSG.gauge_url(); + Anchor anchor = new Anchor(MSG.gauge_info_link(), url); + addMember(anchor); } }
--- a/flys-client/src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java Sat Sep 22 22:26:38 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java Mon Sep 24 08:39:22 2012 +0000 @@ -81,8 +81,8 @@ ArtifactNamespaceContext.NAMESPACE_URI, "minq"); String rmaxq = riverresp.getAttributeNS( ArtifactNamespaceContext.NAMESPACE_URI, "maxq"); - String rinfourl = riverresp.getAttributeNS( - ArtifactNamespaceContext.NAMESPACE_URI, "info-url"); + String rofficial = riverresp.getAttributeNS( + ArtifactNamespaceContext.NAMESPACE_URI, "official"); logger.debug("River is " + rname); @@ -127,9 +127,7 @@ ArtifactNamespaceContext.NAMESPACE_URI, "maxw"); String gstation = gaugeele.getAttributeNS( ArtifactNamespaceContext.NAMESPACE_URI, "station"); - String ginfourl = riverresp.getAttributeNS( - ArtifactNamespaceContext.NAMESPACE_URI, "info-url"); - String gofficial = riverresp.getAttributeNS( + String gofficial = gaugeele.getAttributeNS( ArtifactNamespaceContext.NAMESPACE_URI, "official"); logger.debug("Found gauge with name " + gname); @@ -147,7 +145,6 @@ parseDouble(gminw), parseDouble(gmaxw), rwstunit, - ginfourl, parseLong(gofficial) ); @@ -163,7 +160,7 @@ rwstunit, parseDouble(rminq), parseDouble(rmaxq), - rinfourl, + parseLong(rofficial), gauges); logger.debug("Finished RiverInfoService.");
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java Sat Sep 22 22:26:38 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java Mon Sep 24 08:39:22 2012 +0000 @@ -17,7 +17,6 @@ private boolean kmup; private Double station; private String wstunit; - private String infourl; private Long officialnumber; public DefaultGaugeInfo() { @@ -36,7 +35,6 @@ Double minw, Double maxw, String wstunit, - String infourl, Long official) { this.name = name; @@ -50,7 +48,6 @@ this.minw = minw; this.maxw = maxw; this.wstunit = wstunit; - this.infourl = infourl; this.officialnumber = official; } /** @@ -135,13 +132,6 @@ } /** - * Returns the URL where to find additional information about this gauge - */ - public String getInfoURL() { - return this.infourl; - } - - /** * Returns the official number of this gauge */ public Long getOfficialNumber() {
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultRiverInfo.java Sat Sep 22 22:26:38 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultRiverInfo.java Mon Sep 24 08:39:22 2012 +0000 @@ -15,7 +15,7 @@ private String wstunit; private Double minq; private Double maxq; - private String infourl; + private Long officialnumber; private List<GaugeInfo> gaugeinfo; @@ -30,18 +30,18 @@ String wstunit, Double minq, Double maxq, - String infourl, + Long official, List<GaugeInfo> gaugeinfo) { - this.name = name; - this.kmup = kmup; - this.start = start; - this.end = end; - this.wstunit = wstunit; - this.minq = minq; - this.maxq = maxq; - this.infourl = infourl; - this.gaugeinfo = gaugeinfo; + this.name = name; + this.kmup = kmup; + this.start = start; + this.end = end; + this.wstunit = wstunit; + this.minq = minq; + this.maxq = maxq; + this.officialnumber = official; + this.gaugeinfo = gaugeinfo; } @@ -99,9 +99,9 @@ } /** - * Returns the URL where to find additional information about this river + * Returns the official number of the river */ - public String getInfoURL() { - return this.infourl; + public Long getOfficialNumber() { + return this.officialnumber; } }
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java Sat Sep 22 22:26:38 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java Mon Sep 24 08:39:22 2012 +0000 @@ -65,11 +65,6 @@ String getWstUnit(); /** - * Returns the URL where to find additional information about this gauge - */ - String getInfoURL(); - - /** * Returns the official number of this gauge */ Long getOfficialNumber();
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/RiverInfo.java Sat Sep 22 22:26:38 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/RiverInfo.java Mon Sep 24 08:39:22 2012 +0000 @@ -47,9 +47,9 @@ Double getMaxQ(); /** - * Returns the URL where to find additional information about this river + * Returns the official number of the river */ - String getInfoURL(); + Long getOfficialNumber(); }