changeset 7806:7ac103a49e35 minfo-opt

Added subtitle parts to modify the chart subtitle via the outprocessor.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 07 Mar 2014 11:11:11 +0100
parents 8c20f16ab650
children ad4a3980092f
files artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java
diffstat 1 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java	Fri Mar 07 11:09:46 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java	Fri Mar 07 11:11:11 2014 +0100
@@ -15,6 +15,7 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
@@ -119,12 +120,15 @@
 
     protected DiagramAttributes.Instance diagramAttributes;
 
+    protected HashSet<String> subTitleParts;
+
     public DiagramGenerator() {
         super();
 
         axesLabels = new HashMap<Integer, LinkedHashSet<String>>();
         xBounds  = new HashMap<Integer, Bounds>();
         yBounds  = new HashMap<Integer, Bounds>();
+        subTitleParts = new LinkedHashSet<String>();
     }
 
     @Override
@@ -1041,13 +1045,18 @@
 
     @Override
     public String getDefaultChartSubtitle() {
+        String parts = "";
+        if (subTitleParts != null && !subTitleParts.isEmpty()) {
+             for (String p : subTitleParts) {
+                 parts += ", " + p;
+             }
+        }
         DiagramAttributes.Title dTitle = diagramAttributes.getSubtitle();
         if (dTitle == null) {
             /* Subtitle is optional */
             return null;
         }
-
-        return dTitle.evaluate((D4EArtifact)getMaster(), context);
+        return dTitle.evaluate((D4EArtifact)getMaster(), context) + parts;
     }
 
     /**
@@ -1223,4 +1232,18 @@
         }
         return axis;
     }
+
+    /**
+     * @return the subtitle parts
+     */
+    public HashSet<String> getSubTitleParts() {
+        return subTitleParts;
+    }
+
+    /**
+     * @param part the subtitle part to set
+     */
+    public void addSubtitle(String part) {
+        this.subTitleParts.add(part);
+    }
 }

http://dive4elements.wald.intevation.org