changeset 8435:6ebad936d82b

Unify descriptions of model discharge curve at gauge.
author "Tom Gottfried <tom@intevation.de>"
date Mon, 20 Oct 2014 13:48:51 +0200
parents 48ed9019d8a1
children 17c3aaa17112
files artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeCurveState.java artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeState.java artifacts/src/main/resources/messages.properties artifacts/src/main/resources/messages_de.properties artifacts/src/main/resources/messages_de_DE.properties artifacts/src/main/resources/messages_en.properties gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties
diffstat 7 files changed, 35 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeCurveState.java	Mon Oct 20 12:23:11 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeCurveState.java	Mon Oct 20 13:48:51 2014 +0200
@@ -1,6 +1,7 @@
 package org.dive4elements.river.artifacts.states;
 
 import java.util.List;
+import java.util.Date;
 
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifacts.CallContext;
@@ -9,6 +10,7 @@
 import org.dive4elements.river.artifacts.model.GaugeDischargeCurveFacet;
 import org.dive4elements.river.artifacts.resources.Resources;
 
+import org.dive4elements.river.model.TimeInterval;
 
 public class GaugeDischargeCurveState
 extends DefaultState
@@ -22,12 +24,20 @@
         List<Facet> facets,
         Object old
     ) {
-        RiverAccess access = new RiverAccess(artifact);
-        String description = Resources.format(context.getMeta(),
-                "facet.gauge_discharge_curve.description",
-                "Discharge curve on gauge",
-                access.getRiverName(),
-                artifact.getDataAsString("gauge_name"));
+        String gaugeName = artifact.getDataAsString("gauge_name");
+        TimeInterval validity = new RiverAccess(artifact).getRiver()
+            .determineGaugeByName(gaugeName).fetchMasterDischargeTable()
+            .getTimeInterval();
+        Date stopTime = validity.getStopTime();
+        String description = Resources.getMsg(
+            context.getMeta(),
+            "chart.discharge.curve.model" + (stopTime != null ? "" : ".nostop"),
+            new Object[] {gaugeName,
+                          validity.getStartTime(),
+                          stopTime
+                }
+        );
+
         facets.add(new GaugeDischargeCurveFacet("gauge_discharge_curve", description));
         facets.add(new GaugeDischargeCurveFacet("at", "gauge_discharge_curve"));
         facets.add(new GaugeDischargeCurveFacet("csv", "gauge_discharge_curve"));
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeState.java	Mon Oct 20 12:23:11 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeState.java	Mon Oct 20 13:48:51 2014 +0200
@@ -9,6 +9,7 @@
 package org.dive4elements.river.artifacts.states;
 
 import java.util.List;
+import java.util.Date;
 
 import java.text.DateFormat;
 
@@ -33,7 +34,6 @@
 import org.dive4elements.river.artifacts.resources.Resources;
 
 import org.dive4elements.river.model.Gauge;
-import org.dive4elements.river.model.DischargeTable;
 import org.dive4elements.river.model.TimeInterval;
 
 import org.dive4elements.river.utils.Formatter;
@@ -69,24 +69,17 @@
         }
 
         Gauge gauge = artifact.getGauge();
-        DischargeTable mdt = gauge.fetchMasterDischargeTable();
-        TimeInterval validity = mdt.getTimeInterval();
-        DateFormat df = Formatter.getDateFormatter(meta, "dd.MM.yyyy");
-        String start = validity.getStartTime() != null ?
-                         df.format(validity.getStartTime()) : "Unknown";
-        String stop = validity.getStopTime() != null ?
-                          df.format(validity.getStopTime()) : "";
-
-        Object[] args = new Object[] {
-            gauge.getName(),
-            start,
-            stop
-        };
-
+        TimeInterval validity = gauge.fetchMasterDischargeTable()
+            .getTimeInterval();
+        Date stopTime = validity.getStopTime();
         String name = Resources.getMsg(
             meta,
-            "chart.computed.discharge.curve.gauge",
-            args);
+            "chart.discharge.curve.model" + (stopTime != null ? "" : ".nostop"),
+            new Object[] {gauge.getName(),
+                          validity.getStartTime(),
+                          stopTime
+                }
+        );
 
         return name;
     }
--- a/artifacts/src/main/resources/messages.properties	Mon Oct 20 12:23:11 2014 +0200
+++ b/artifacts/src/main/resources/messages.properties	Mon Oct 20 13:48:51 2014 +0200
@@ -175,9 +175,10 @@
 chart.discharge.curve.curve.valid.range = {0} (valid from {1,date,short} - {2,date,short})
 chart.computed.discharge.curve.title = Discharge Curve
 chart.discharge.curve.subtitle = {0}-km: $KM
+chart.discharge.curve.model = Model discharge curve {0} {1,date,medium} - {2,date,medium}
+chart.discharge.curve.model.nostop = Model discharge curve {0} {1,date,medium} -
 chart.computed.discharge.curve.yaxis.label = W [{0}]
 chart.computed.discharge.curve.curve.label = Discharge Curve {0} km {1}
-chart.computed.discharge.curve.gauge = current DC {0} {1} - {2}
 chart.duration.curve.title = Duration Curve
 chart.duration.curve.subtitle = {0}-km: {1,number,#.###}
 chart.duration.curve.xaxis.label = Duration of Non-Exceedence [Days]
@@ -343,7 +344,6 @@
 facet.bedheight.diff.height2.raw = Original Height Subtrahend {0} (raw)
 facet.bedheight.diff.absolute.raw = Bedheight Difference/Year {0} (raw)
 facet.bedheight.diff.epoch.raw = BedHeight Difference {0} (raw)
-facet.gauge_discharge_curve.description = Discharge Curve on river {0} and gauge {1}
 facet.gauge_discharge_curve.river = Name of the river
 facet.gauge_discharge_curve.reference_gauge = Gauge official number
 facet.gauge_discharge_curve.gauge_name = Name of the gauge
--- a/artifacts/src/main/resources/messages_de.properties	Mon Oct 20 12:23:11 2014 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Mon Oct 20 13:48:51 2014 +0200
@@ -175,9 +175,10 @@
 chart.discharge.curve.curve.valid.range = {0} (g\u00fcltig ab {1,date,medium} - {2,date,medium})
 chart.computed.discharge.curve.title = Abflusskurve
 chart.discharge.curve.subtitle = {0}-km: $KM
+chart.discharge.curve.model = Modell-Abflusskurve {0} {1,date,medium} - {2,date,medium}
+chart.discharge.curve.model.nostop = Modell-Abflusskurve {0} {1,date,medium} -
 chart.computed.discharge.curve.yaxis.label = W [{0}]
 chart.computed.discharge.curve.curve.label = Abflusskurve {0} km {1}
-chart.computed.discharge.curve.gauge = aktuelle AT {0} {1} - {2}
 chart.duration.curve.title = Dauerlinie
 chart.duration.curve.subtitle = {0}-km: {1,number,#.###}
 chart.duration.curve.xaxis.label = Unterschreitungsdauer [Tage]
@@ -344,7 +345,6 @@
 facet.bedheight.diff.height2.raw = H\u00f6he Subtrahend {0} (Rohdaten)
 facet.bedheight.diff.absolute.raw = Sohlh\u00f6hendifferenz/Jahr {0} (Rohdaten)
 facet.bedheight.diff.epoch.raw = Sohlh\u00f6hendifferenz {0} (Rohdaten)
-facet.gauge_discharge_curve.description = Abflusskurve beim Fluss {0} und Pegel {1}
 facet.gauge_discharge_curve.river = Gew\u00e4sser
 facet.gauge_discharge_curve.reference_gauge = Pegelnummer
 facet.gauge_discharge_curve.gauge_name = Pegelname
--- a/artifacts/src/main/resources/messages_de_DE.properties	Mon Oct 20 12:23:11 2014 +0200
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Mon Oct 20 13:48:51 2014 +0200
@@ -174,9 +174,10 @@
 chart.discharge.curve.curve.valid.range = {0} (g\u00fcltig ab {1,date,medium} - {2,date,medium})
 chart.computed.discharge.curve.title = Abflusskurve
 chart.discharge.curve.subtitle = {0}-km: $KM
+chart.discharge.curve.model = Modell-Abflusskurve {0} {1,date,medium} - {2,date,medium}
+chart.discharge.curve.model.nostop = Modell-Abflusskurve {0} {1,date,medium} -
 chart.computed.discharge.curve.yaxis.label = W [{0}]
 chart.computed.discharge.curve.curve.label = Abflusskurve {0} km {1}
-chart.computed.discharge.curve.gauge = aktuelle AT {0} {1} - {2}
 chart.duration.curve.title = Dauerlinie
 chart.duration.curve.subtitle = {0}-km: {1,number,#.###}
 chart.duration.curve.xaxis.label = Unterschreitungsdauer [Tage]
@@ -341,7 +342,6 @@
 facet.bedheight.diff.absolute.raw = Sohlh\u00f6hendifferenz/Jahr {0} (Rohdaten)
 facet.bedheight.diff.epoch = Sohlh\u00f6hendifferenz {0}
 facet.bedheight.diff.epoch.raw = Sohlh\u00f6hendifferenz {0} (Rohdaten)
-facet.gauge_discharge_curve.description = Abflusskurve beim Fluss {0} und Pegel {1}
 facet.gauge_discharge_curve.river = Gew\u00e4sser
 facet.gauge_discharge_curve.reference_gauge = Pegelnummer
 facet.gauge_discharge_curve.gauge_name = Pegelname
--- a/artifacts/src/main/resources/messages_en.properties	Mon Oct 20 12:23:11 2014 +0200
+++ b/artifacts/src/main/resources/messages_en.properties	Mon Oct 20 13:48:51 2014 +0200
@@ -174,9 +174,10 @@
 chart.discharge.curve.curve.valid.range = {0} (valid from {1,date,short} - {2,date,short})
 chart.computed.discharge.curve.title = Discharge Curve
 chart.discharge.curve.subtitle = {0}-km: $KM
+chart.discharge.curve.model = Model discharge curve {0} {1,date,medium} - {2,date,medium}
+chart.discharge.curve.model.nostop = Model discharge curve {0} {1,date,medium} -
 chart.computed.discharge.curve.yaxis.label = W [{0}]
 chart.computed.discharge.curve.curve.label = Discharge Curve {0} km {1}
-chart.computed.discharge.curve.gauge = current DC {0} {1} - {2}
 chart.duration.curve.title = Duration Curve
 chart.duration.curve.subtitle = {0}-km: {1,number,#.###}
 chart.duration.curve.xaxis.label = Duration of Non-Exceedence [Days]
@@ -345,7 +346,6 @@
 facet.bedheight.diff.height2.raw = Original Height Subtrahend {0} (raw)
 facet.bedheight.diff.absolute.raw = Bedheight Difference/Year {0} (raw)
 facet.bedheight.diff.epoch.raw = BedHeight Difference {0} (raw)
-facet.gauge_discharge_curve.description = Discharge Curve on river {0} and gauge {1}
 facet.gauge_discharge_curve.river = Name of the river
 facet.gauge_discharge_curve.reference_gauge = Gauge official number
 facet.gauge_discharge_curve.gauge_name = Name of the gauge
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Mon Oct 20 12:23:11 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Mon Oct 20 13:48:51 2014 +0200
@@ -222,7 +222,7 @@
 discharge_curve = Abflusskurve am Pegel
 discharge_curve_gaugeless = Abflusskurve
 gauge_discharge_curve = Abflusstafel am Pegel
-current_gauge = aktuelle Abflusstafel am Pegel
+current_gauge = Modell-Abflusskurve am Pegel
 computed_discharge_curve = Abflusskurve
 computed_discharge_curves = Abflusskurven
 historical_discharge_curves = Historische Abflusskurven

http://dive4elements.wald.intevation.org