Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/ChartSettings.java @ 8202:e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 12:58:17 +0200 |
parents | fca46ce8e4f5 |
children | 6dfc3a1fc70d |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
25 /** | 25 /** |
26 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 26 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
27 */ | 27 */ |
28 public class ChartSettings extends DefaultSettings { | 28 public class ChartSettings extends DefaultSettings { |
29 | 29 |
30 private static final Logger logger = Logger.getLogger(ChartSettings.class); | 30 private static final Logger log = Logger.getLogger(ChartSettings.class); |
31 | 31 |
32 protected ChartSection chartSection; | 32 protected ChartSection chartSection; |
33 protected LegendSection legendSection; | 33 protected LegendSection legendSection; |
34 protected ExportSection exportSection; | 34 protected ExportSection exportSection; |
35 protected Section axesSection; | 35 protected Section axesSection; |
168 * | 168 * |
169 * @return a new <i>ChartSettings</i> instance. | 169 * @return a new <i>ChartSettings</i> instance. |
170 */ | 170 */ |
171 public static ChartSettings parse(Node settings) { | 171 public static ChartSettings parse(Node settings) { |
172 if (settings == null) { | 172 if (settings == null) { |
173 logger.warn("Tried to parse ChartSettings from empty Node!"); | 173 log.warn("Tried to parse ChartSettings from empty Node!"); |
174 return null; | 174 return null; |
175 } | 175 } |
176 | 176 |
177 ChartSettings chartSettings = new ChartSettings(); | 177 ChartSettings chartSettings = new ChartSettings(); |
178 | 178 |
190 settings, "axes/axis", XPathConstants.NODESET, null); | 190 settings, "axes/axis", XPathConstants.NODESET, null); |
191 | 191 |
192 int num = axesList != null ? axesList.getLength() : 0; | 192 int num = axesList != null ? axesList.getLength() : 0; |
193 | 193 |
194 if (num <= 0) { | 194 if (num <= 0) { |
195 logger.debug("No axis sections found."); | 195 log.debug("No axis sections found."); |
196 return; | 196 return; |
197 } | 197 } |
198 | 198 |
199 for (int i = 0; i < num; i++) { | 199 for (int i = 0; i < num; i++) { |
200 parseAxis(target, axesList.item(i)); | 200 parseAxis(target, axesList.item(i)); |
211 String fixation = XMLUtils.xpathString(axis, "fixation", null); | 211 String fixation = XMLUtils.xpathString(axis, "fixation", null); |
212 String low = XMLUtils.xpathString(axis, "lower", null); | 212 String low = XMLUtils.xpathString(axis, "lower", null); |
213 String up = XMLUtils.xpathString(axis, "upper", null); | 213 String up = XMLUtils.xpathString(axis, "upper", null); |
214 String sugLabel = XMLUtils.xpathString(axis, "suggested-label", null); | 214 String sugLabel = XMLUtils.xpathString(axis, "suggested-label", null); |
215 | 215 |
216 if (logger.isDebugEnabled()) { | 216 if (log.isDebugEnabled()) { |
217 logger.debug("Found axis id: '" + id + "'"); | 217 log.debug("Found axis id: '" + id + "'"); |
218 logger.debug("Found axis label: '" + label + "'"); | 218 log.debug("Found axis label: '" + label + "'"); |
219 logger.debug("Found axis font size: '" + fSize + "'"); | 219 log.debug("Found axis font size: '" + fSize + "'"); |
220 logger.debug("Found axis fixation: '" + fixation + "'"); | 220 log.debug("Found axis fixation: '" + fixation + "'"); |
221 logger.debug("Found axis lower: '" + low + "'"); | 221 log.debug("Found axis lower: '" + low + "'"); |
222 logger.debug("Found axis upper: '" + up + "'"); | 222 log.debug("Found axis upper: '" + up + "'"); |
223 logger.debug("Found axis sug. label:'" + sugLabel + "'"); | 223 log.debug("Found axis sug. label:'" + sugLabel + "'"); |
224 } | 224 } |
225 | 225 |
226 section.setIdentifier(id); | 226 section.setIdentifier(id); |
227 section.setLabel(label); | 227 section.setLabel(label); |
228 section.setFontSize(Integer.parseInt(fSize.length() > 0 ? fSize : "-1")); | 228 section.setFontSize(Integer.parseInt(fSize.length() > 0 ? fSize : "-1")); |
247 String grid = XMLUtils.xpathString(chart, "chart/display-grid", null); | 247 String grid = XMLUtils.xpathString(chart, "chart/display-grid", null); |
248 String logo = XMLUtils.xpathString(chart, "chart/display-logo", null); | 248 String logo = XMLUtils.xpathString(chart, "chart/display-logo", null); |
249 String placeh = XMLUtils.xpathString(chart, "chart/logo-placeh", null); | 249 String placeh = XMLUtils.xpathString(chart, "chart/logo-placeh", null); |
250 String placev = XMLUtils.xpathString(chart, "chart/logo-placev", null); | 250 String placev = XMLUtils.xpathString(chart, "chart/logo-placev", null); |
251 | 251 |
252 if (logger.isDebugEnabled()) { | 252 if (log.isDebugEnabled()) { |
253 logger.debug("Found chart title: '" + title + "'"); | 253 log.debug("Found chart title: '" + title + "'"); |
254 logger.debug("Found chart subtitle: '" + sub + "'"); | 254 log.debug("Found chart subtitle: '" + sub + "'"); |
255 logger.debug("Found chart grid: '" + grid + "'"); | 255 log.debug("Found chart grid: '" + grid + "'"); |
256 logger.debug("Found chart logo: '" + logo + "'"); | 256 log.debug("Found chart logo: '" + logo + "'"); |
257 logger.debug("Found chart logo placeh: '" + placeh + "'"); | 257 log.debug("Found chart logo placeh: '" + placeh + "'"); |
258 logger.debug("Found chart logo placev: '" + placev + "'"); | 258 log.debug("Found chart logo placev: '" + placev + "'"); |
259 } | 259 } |
260 | 260 |
261 chartSection.setTitle(title); | 261 chartSection.setTitle(title); |
262 chartSection.setSubtitle(sub); | 262 chartSection.setSubtitle(sub); |
263 chartSection.setDisplayGrid(Boolean.valueOf(grid)); | 263 chartSection.setDisplayGrid(Boolean.valueOf(grid)); |
274 | 274 |
275 String vis = XMLUtils.xpathString(legend, "legend/visibility", null); | 275 String vis = XMLUtils.xpathString(legend, "legend/visibility", null); |
276 String fSize = XMLUtils.xpathString(legend, "legend/font-size", null); | 276 String fSize = XMLUtils.xpathString(legend, "legend/font-size", null); |
277 String lthre = XMLUtils.xpathString(legend, "legend/aggregation-threshold", null); | 277 String lthre = XMLUtils.xpathString(legend, "legend/aggregation-threshold", null); |
278 | 278 |
279 if (logger.isDebugEnabled()) { | 279 if (log.isDebugEnabled()) { |
280 logger.debug("Found legend visibility: '" + vis + "'"); | 280 log.debug("Found legend visibility: '" + vis + "'"); |
281 logger.debug("Found legend font size : '" + fSize + "'"); | 281 log.debug("Found legend font size : '" + fSize + "'"); |
282 logger.debug("Found legend aggregation threshold : '" + lthre + "'"); | 282 log.debug("Found legend aggregation threshold : '" + lthre + "'"); |
283 } | 283 } |
284 | 284 |
285 section.setVisibility(Boolean.valueOf(vis)); | 285 section.setVisibility(Boolean.valueOf(vis)); |
286 section.setFontSize(Integer.valueOf(fSize.length() > 0 ? fSize : "-1")); | 286 section.setFontSize(Integer.valueOf(fSize.length() > 0 ? fSize : "-1")); |
287 section.setAggregationThreshold(Integer.valueOf(lthre.length() >0 ? lthre : "-1")); | 287 section.setAggregationThreshold(Integer.valueOf(lthre.length() >0 ? lthre : "-1")); |
294 ExportSection section = new ExportSection(); | 294 ExportSection section = new ExportSection(); |
295 | 295 |
296 String width = XMLUtils.xpathString(export, "export/width", null); | 296 String width = XMLUtils.xpathString(export, "export/width", null); |
297 String height = XMLUtils.xpathString(export, "export/height", null); | 297 String height = XMLUtils.xpathString(export, "export/height", null); |
298 | 298 |
299 if (logger.isDebugEnabled()) { | 299 if (log.isDebugEnabled()) { |
300 logger.debug("Found export width : '" + width + "'"); | 300 log.debug("Found export width : '" + width + "'"); |
301 logger.debug("Found export height: '" + height + "'"); | 301 log.debug("Found export height: '" + height + "'"); |
302 } | 302 } |
303 | 303 |
304 section.setWidth(Integer.valueOf(width.length() > 0 ? width : "-1")); | 304 section.setWidth(Integer.valueOf(width.length() > 0 ? width : "-1")); |
305 section.setHeight(Integer.valueOf(height.length() > 0 ? height : "-1")); | 305 section.setHeight(Integer.valueOf(height.length() > 0 ? height : "-1")); |
306 | 306 |