[PATCH] Added alignment rules for diagrams
Wald Commits
scm-commit at wald.intevation.org
Thu Sep 19 11:08:48 CEST 2013
# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1379581723 -7200
# Branch generator-refactoring
# Node ID 165ea04b15450b1d8075a4f60b41288ce7d96d70
# Parent a43137dfdcac931d7de6cc74273b1b409d76ac59
Added alignment rules for diagrams.
diff -r a43137dfdcac -r 165ea04b1545 artifacts/src/main/java/org/dive4elements/river/exports/DiagramAttributes.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DiagramAttributes.java Thu Sep 19 10:57:47 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DiagramAttributes.java Thu Sep 19 11:08:43 2013 +0200
@@ -28,19 +28,34 @@
private static Logger log = Logger.getLogger(DiagramAttributes.class);
public static class AxisAttributes {
- // TODO: More Attributes
- private String name;
+ private String name;
+ private boolean isLeftAlign;
+ private boolean forceAlign;
public AxisAttributes() {
}
- public AxisAttributes(String name) {
- this.name = name;
+ public AxisAttributes(
+ String name,
+ boolean isLeftAlign,
+ boolean forceAlign
+ ) {
+ this.name = name;
+ this.isLeftAlign = isLeftAlign;
+ this.forceAlign = forceAlign;
}
public String getName() {
return name;
}
+
+ public boolean isLeftAlign() {
+ return isLeftAlign;
+ }
+
+ public boolean forceAlign() {
+ return forceAlign;
+ }
} // class AxisAttributes
public static class AxisProcessor {
@@ -160,6 +175,7 @@
parseAxis(config);
parseProcessors(config);
parseTitle(config);
+ parseSubtitle(config);
}
private void parseAxis(Element config) {
@@ -168,9 +184,19 @@
for (int i = 0, N = axisNodes.getLength(); i < N; ++i) {
Element axisElement = (Element)axisNodes.item(i);
String name = axisElement.getAttribute("name").trim();
- if (!name.isEmpty()) {
- axesAttrs.add(new AxisAttributes(name));
+ String align = axisElement.getAttribute("align").trim();
+ if (name.isEmpty()) {
+ continue;
}
+ boolean isleftAlign = false;
+ boolean forceAlign = false;
+ for (String part: align.split("[\\s,]")) {
+ part = part.trim();
+ if ("left" .equals(part)) isleftAlign = true;
+ else if ("right".equals(part)) isleftAlign = false;
+ else if ("force".equals(part)) forceAlign = true;
+ }
+ axesAttrs.add(new AxisAttributes(name, isleftAlign, forceAlign));
}
}
More information about the Dive4elements-commits
mailing list