# HG changeset patch # User Sascha L. Teichmann # Date 1407425178 -7200 # Node ID 1cae4fc6bdd7e00937a054f79b332f73214dcd2c # Parent bd0dfa57b1fe92673bf6a550d3b8a5b8983d0c0c# Parent dee3b3b0417e3d2be65582a6bbeb966b7273a621 Merged diff -r dee3b3b0417e -r 1cae4fc6bdd7 artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java Thu Aug 07 13:05:35 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java Thu Aug 07 17:26:18 2014 +0200 @@ -131,6 +131,8 @@ 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; @@ -672,6 +674,20 @@ return getDefaultChartTitle(); } + protected String interpolateVariables(String s) { + + Object radius = context.getContextValue("radius"); + if (radius instanceof Double) { + String txt = Resources.getMsg( + context.getMeta(), + I18N_SUBTITLE_RADIUS, + new Object[] { radius }); + + return s.replace("$RADIUS", txt); + + } + return s; + } /** * Returns the subtitle of a chart. The return value depends on the @@ -689,9 +705,13 @@ if (subTitle == null) { return getDefaultChartSubtitle(); } - else { - return subTitle; + String defSubTitle = getDefaultChartSubtitle(); + if (defSubTitle != null + && !defSubTitle.isEmpty() + && !subTitle.equals(defSubTitle)) { + return interpolateVariables(defSubTitle); } + return subTitle; } return getDefaultChartSubtitle(); diff -r dee3b3b0417e -r 1cae4fc6bdd7 artifacts/src/main/java/org/dive4elements/river/exports/process/WDiffProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/process/WDiffProcessor.java Thu Aug 07 13:05:35 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/WDiffProcessor.java Thu Aug 07 17:26:18 2014 +0200 @@ -45,8 +45,9 @@ ZoomScale scales = (ZoomScale)fc.get("zoomscale"); RiverAccess access = new RiverAccess((D4EArtifact)artifact); String river = access.getRiverName(); + double radius = scales.getRadius(river, start, end); + context.putContextValue("radius", radius); - double radius = scales.getRadius(river, start, end); generator.addSubtitle(Resources.getMsg( context.getMeta(), I18N_SUBTITLE_RADIUS,