comparison artifacts/src/main/java/org/dive4elements/river/exports/DiagramAttributes.java @ 7062:4310c612a986 generator-refactoring

Added 'include-zero' attribute to <axis> tag in diagram configuration.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 20 Sep 2013 12:35:14 +0200
parents 4f6b3ba542de
children 726d998dce29
comparison
equal deleted inserted replaced
7061:4f6b3ba542de 7062:4310c612a986
29 29
30 public static class AxisAttributes { 30 public static class AxisAttributes {
31 private String name; 31 private String name;
32 private boolean isLeftAlign; 32 private boolean isLeftAlign;
33 private boolean forceAlign; 33 private boolean forceAlign;
34 private boolean includeZero;
34 35
35 public AxisAttributes() { 36 public AxisAttributes() {
36 } 37 }
37 38
38 public AxisAttributes( 39 public AxisAttributes(
39 String name, 40 String name,
40 boolean isLeftAlign, 41 boolean isLeftAlign,
41 boolean forceAlign 42 boolean forceAlign,
43 boolean includeZero
42 ) { 44 ) {
43 this.name = name; 45 this.name = name;
44 this.isLeftAlign = isLeftAlign; 46 this.isLeftAlign = isLeftAlign;
45 this.forceAlign = forceAlign; 47 this.forceAlign = forceAlign;
48 this.includeZero = includeZero;
46 } 49 }
47 50
48 public String getName() { 51 public String getName() {
49 return name; 52 return name;
50 } 53 }
53 return isLeftAlign; 56 return isLeftAlign;
54 } 57 }
55 58
56 public boolean forceAlign() { 59 public boolean forceAlign() {
57 return forceAlign; 60 return forceAlign;
61 }
62
63 public boolean includeZero() {
64 return includeZero;
58 } 65 }
59 } // class AxisAttributes 66 } // class AxisAttributes
60 67
61 public static class Argument { 68 public static class Argument {
62 private String expression; 69 private String expression;
168 175
169 for (int i = 0, N = axisNodes.getLength(); i < N; ++i) { 176 for (int i = 0, N = axisNodes.getLength(); i < N; ++i) {
170 Element axisElement = (Element)axisNodes.item(i); 177 Element axisElement = (Element)axisNodes.item(i);
171 String name = axisElement.getAttribute("name").trim(); 178 String name = axisElement.getAttribute("name").trim();
172 String align = axisElement.getAttribute("align").trim(); 179 String align = axisElement.getAttribute("align").trim();
180 String includeZero =
181 axisElement.getAttribute("include-zero").trim();
173 if (name.isEmpty()) { 182 if (name.isEmpty()) {
174 continue; 183 continue;
175 } 184 }
176 boolean isleftAlign = false; 185 boolean isleftAlign = false;
177 boolean forceAlign = false; 186 boolean forceAlign = false;
179 part = part.trim(); 188 part = part.trim();
180 if ("left" .equals(part)) isleftAlign = true; 189 if ("left" .equals(part)) isleftAlign = true;
181 else if ("right".equals(part)) isleftAlign = false; 190 else if ("right".equals(part)) isleftAlign = false;
182 else if ("force".equals(part)) forceAlign = true; 191 else if ("force".equals(part)) forceAlign = true;
183 } 192 }
184 axesAttrs.add(new AxisAttributes(name, isleftAlign, forceAlign)); 193
194 axesAttrs.add(new AxisAttributes(
195 name, isleftAlign, forceAlign,
196 includeZero.equals("true")));
185 } 197 }
186 } 198 }
187 199
188 public List<Processor> getProcessors() { 200 public List<Processor> getProcessors() {
189 return processors; 201 return processors;

http://dive4elements.wald.intevation.org