Mercurial > dive4elements > river
changeset 8732:c0c162d7cb0e
(issue1754) Handle the case if no radius is given.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 30 Apr 2015 18:13:15 +0200 |
parents | bccc476e78eb |
children | 8dbb969091c5 |
files | artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.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 |
diffstat | 5 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java Thu Apr 30 17:11:59 2015 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java Thu Apr 30 18:13:15 2015 +0200 @@ -108,9 +108,6 @@ public static final String XPATH_CHART_Y_RANGE = "/art:action/art:attributes/art:yrange"; - public static final String I18N_SUBTITLE_RADIUS = - "chart.subtitle.radius"; - /** The document of the incoming out() request.*/ protected Document request; @@ -660,16 +657,22 @@ } protected String interpolateVariables(String s) { + log.debug("Interpolate variables in string '" + s + "'"); Object radius = context.getContextValue("radius"); if (radius instanceof Double) { NumberFormat f = Formatter.getCSVFormatter(context); - return s.replace("$RADIUS", f.format(radius)); + s = s.replace("$RADIUS", f.format(radius) + " km"); } + else { + s = s.replace("$RADIUS", "-"); + } + Object km = context.getContextValue(CURRENT_KM); if (km instanceof Number && s.contains("$KM")) { NumberFormat f = Formatter.getCalculationKm(context.getMeta()); - return s.replace("$KM", f.format(km)); + s = s.replace("$KM", f.format(km)); } + return s; }
--- a/artifacts/src/main/resources/messages.properties Thu Apr 30 17:11:59 2015 +0200 +++ b/artifacts/src/main/resources/messages.properties Thu Apr 30 18:13:15 2015 +0200 @@ -371,7 +371,7 @@ chart.beddifference.year.title = Bedheight Difference chart.beddifference.yaxis.label.morph = Width [m] chart.beddifference.yaxis.label.heights = Absolute Height [{0}] -chart.subtitle.radius = Width of sample window for moving average: {0} km +chart.subtitle.radius = Width of sample window for moving average: {0} export.csv.header.km = km export.csv.header.year = year
--- a/artifacts/src/main/resources/messages_de.properties Thu Apr 30 17:11:59 2015 +0200 +++ b/artifacts/src/main/resources/messages_de.properties Thu Apr 30 18:13:15 2015 +0200 @@ -372,7 +372,7 @@ chart.beddifference.year.title = Sohlh\u00f6hendifferenz chart.beddifference.yaxis.label.morph = Breite [m] chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [m] -chart.subtitle.radius = Fensterbreite f\u00fcr gleitenden Mittelwert: {0} km +chart.subtitle.radius = Fensterbreite f\u00fcr gleitenden Mittelwert: {0} export.csv.header.km = km export.csv.header.year = Jahr
--- a/artifacts/src/main/resources/messages_de_DE.properties Thu Apr 30 17:11:59 2015 +0200 +++ b/artifacts/src/main/resources/messages_de_DE.properties Thu Apr 30 18:13:15 2015 +0200 @@ -369,7 +369,7 @@ chart.beddifference.year.title = Sohlh\u00f6hendifferenz chart.beddifference.yaxis.label.morph = Breite [m] chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [{0}] -chart.subtitle.radius = Fensterbreite f\u00fcr gleitenden Mittelwert: {0} km +chart.subtitle.radius = Fensterbreite f\u00fcr gleitenden Mittelwert: {0} export.csv.header.km = km export.csv.header.year = Jahr
--- a/artifacts/src/main/resources/messages_en.properties Thu Apr 30 17:11:59 2015 +0200 +++ b/artifacts/src/main/resources/messages_en.properties Thu Apr 30 18:13:15 2015 +0200 @@ -373,7 +373,7 @@ chart.beddifference.year.title = Bedheight Difference chart.beddifference.yaxis.label.morph = Width [m] chart.beddifference.yaxis.label.heights = Absolute Height [m] -chart.subtitle.radius = Radius for weighted Average: {0} km +chart.subtitle.radius = Width of sample window for moving average: {0} export.csv.header.km = km export.csv.header.year = year