Mercurial > dive4elements > river
changeset 8370:e1ff1263d79a
Fixed W/Q diagram subtitle in fix analysis.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 02 Oct 2014 13:59:20 +0200 |
parents | a5bd0a5b8efd |
children | 676687c3d8f0 |
files | artifacts/doc/conf/generators/discharge-diagrams.xml artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java |
diffstat | 3 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/doc/conf/generators/discharge-diagrams.xml Thu Oct 02 13:57:50 2014 +0200 +++ b/artifacts/doc/conf/generators/discharge-diagrams.xml Thu Oct 02 13:59:20 2014 +0200 @@ -38,9 +38,8 @@ converter="org.dive4elements.river.exports.DiagramAttributes" injectors="org.dive4elements.river.exports.injector.KmFromRequestInjector,org.dive4elements.river.exports.injector.PNPInjector"> <title key="chart.fixings.discharge.curve.title" default="Fixierungsanalyse W/Q"/> - <subtitle key="chart.computed.discharge.curve.subtitle" default="-"> + <subtitle key="chart.fix.discharge.curve.subtitle" default="-"> <arg expr="artifact.river"/> - <arg expr="context.currentkm" type="double"/> </subtitle> &discharge-defaults; </output-generator>
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java Thu Oct 02 13:57:50 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java Thu Oct 02 13:59:20 2014 +0200 @@ -72,6 +72,8 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; +import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM; + /** * Implementation of the OutGenerator interface for charts. * It should provide some basic things that equal in all chart types. @@ -663,6 +665,10 @@ NumberFormat f = Formatter.getCSVFormatter(context); return s.replace("$RADIUS", f.format(radius)); } + Object km = context.getContextValue(CURRENT_KM); + if (km instanceof Number && s.contains("$KM")) { + return s.replace(", $KM", " " + ((Double)km).toString()); + } return s; }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java Thu Oct 02 13:57:50 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java Thu Oct 02 13:59:20 2014 +0200 @@ -49,6 +49,9 @@ private String I18N_AXIS_LABEL = "chart.discharge.curve.yaxis.label"; + public static final String I18N_SUBTITLE_KM = + "chart.subtitle.km"; + public FixWQProcessor() { } @@ -90,6 +93,10 @@ || FIX_WQ_LS.equals(facetType)) { doWQOut(generator, bundle, theme, visible); } + generator.addSubtitle(Resources.getMsg( + generator.getCallContext().getMeta(), + I18N_SUBTITLE_KM, + new Object[] { "$KM" })); } /** Add sector average points to chart. */