Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/DiagramAttributes.java @ 7061:4f6b3ba542de generator-refactoring
Added domain axis title to diagram attributes.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 20 Sep 2013 12:28:15 +0200 |
parents | 78ded33f5f5b |
children | 4310c612a986 |
comparison
equal
deleted
inserted
replaced
7060:78ded33f5f5b | 7061:4f6b3ba542de |
---|---|
141 private List<AxisAttributes> axesAttrs; | 141 private List<AxisAttributes> axesAttrs; |
142 private List<Processor> processors; | 142 private List<Processor> processors; |
143 | 143 |
144 private Title title; | 144 private Title title; |
145 private Title subtitle; | 145 private Title subtitle; |
146 private Title domainAxisTitle; | |
146 | 147 |
147 public DiagramAttributes() { | 148 public DiagramAttributes() { |
148 axesAttrs = new ArrayList<AxisAttributes>(5); | 149 axesAttrs = new ArrayList<AxisAttributes>(5); |
149 processors = new ArrayList<Processor>(5); | 150 processors = new ArrayList<Processor>(5); |
150 } | 151 } |
153 this(); | 154 this(); |
154 parseAxis(config); | 155 parseAxis(config); |
155 parseProcessors(config); | 156 parseProcessors(config); |
156 parseTitle(config); | 157 parseTitle(config); |
157 parseSubtitle(config); | 158 parseSubtitle(config); |
159 parseDomainAxisTitle(config); | |
158 } | 160 } |
159 | 161 |
160 public List<AxisAttributes> getAxesAttributes() { | 162 public List<AxisAttributes> getAxesAttributes() { |
161 return axesAttrs; | 163 return axesAttrs; |
162 } | 164 } |
193 | 195 |
194 public Title getSubtitle() { | 196 public Title getSubtitle() { |
195 return subtitle; | 197 return subtitle; |
196 } | 198 } |
197 | 199 |
200 public Title getDomainAxisTitle() { | |
201 return domainAxisTitle; | |
202 } | |
203 | |
198 private void parseProcessors(Element config) { | 204 private void parseProcessors(Element config) { |
199 NodeList processorNodes = config.getElementsByTagName("processor"); | 205 NodeList processorNodes = config.getElementsByTagName("processor"); |
200 | 206 |
201 for (int i = 0, N = processorNodes.getLength(); i < N; ++i) { | 207 for (int i = 0, N = processorNodes.getLength(); i < N; ++i) { |
202 Element processorElement = (Element)processorNodes.item(i); | 208 Element processorElement = (Element)processorNodes.item(i); |
231 title = extractTitle(config, "title"); | 237 title = extractTitle(config, "title"); |
232 } | 238 } |
233 | 239 |
234 private void parseSubtitle(Element config) { | 240 private void parseSubtitle(Element config) { |
235 subtitle = extractTitle(config, "subtitle"); | 241 subtitle = extractTitle(config, "subtitle"); |
242 } | |
243 | |
244 private void parseDomainAxisTitle(Element config) { | |
245 domainAxisTitle = extractTitle(config, "domain-axis"); | |
236 } | 246 } |
237 | 247 |
238 private static Title extractTitle(Element config, String tagName) { | 248 private static Title extractTitle(Element config, String tagName) { |
239 NodeList titleNodes = config.getElementsByTagName(tagName); | 249 NodeList titleNodes = config.getElementsByTagName(tagName); |
240 if (titleNodes.getLength() < 1) { | 250 if (titleNodes.getLength() < 1) { |
253 } | 263 } |
254 return title; | 264 return title; |
255 } | 265 } |
256 | 266 |
257 public int getAxisIndex(String axisName) { | 267 public int getAxisIndex(String axisName) { |
258 for (int i=0; i < axesAttrs.size(); i++) { | 268 for (int i = axesAttrs.size()-1; i >= 0; --i) { |
259 if (axesAttrs.get(i).getName().equals(axisName)) { | 269 if (axesAttrs.get(i).getName().equals(axisName)) { |
260 return i; | 270 return i; |
261 } | 271 } |
262 } | 272 } |
263 return -1; | 273 return -1; |