changeset 8075:1cae4fc6bdd7

Merged
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 07 Aug 2014 17:26:18 +0200
parents bd0dfa57b1fe (diff) dee3b3b0417e (current diff)
children e1b49fc9d2b5
files
diffstat 2 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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();
--- 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,

http://dive4elements.wald.intevation.org