Mercurial > dive4elements > river
changeset 7049:165ea04b1545 generator-refactoring
Added alignment rules for diagrams.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 19 Sep 2013 11:08:43 +0200 |
parents | a43137dfdcac |
children | 25a5ce8abfef |
files | artifacts/src/main/java/org/dive4elements/river/exports/DiagramAttributes.java |
diffstat | 1 files changed, 32 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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)); } }