[PATCH 2 of 5] Added subtitle parts to modify the chart subtitle via the outprocessor
Wald Commits
scm-commit at wald.intevation.org
Fri Mar 7 11:17:15 CET 2014
# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1394187071 -3600
# Branch minfo-opt
# Node ID 7ac103a49e35c5de775363dd077aa35d50eebd74
# Parent 8c20f16ab6504fdda108ab5877921dae6af56751
Added subtitle parts to modify the chart subtitle via the outprocessor.
diff -r 8c20f16ab650 -r 7ac103a49e35 artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java
--- 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);
+ }
}
More information about the Dive4elements-commits
mailing list