comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ChartSettings.java @ 2056:76eeb3b4358e

Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'. flys-artifacts/trunk@3547 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 27 Dec 2011 10:12:14 +0000
parents c4e0e433f825
children 46b9391b122a
comparison
equal deleted inserted replaced
2055:3cec0575d655 2056:76eeb3b4358e
21 21
22 private static final Logger logger = Logger.getLogger(ChartSettings.class); 22 private static final Logger logger = Logger.getLogger(ChartSettings.class);
23 23
24 protected ChartSection chartSection; 24 protected ChartSection chartSection;
25 protected LegendSection legendSection; 25 protected LegendSection legendSection;
26 protected ExportSection exportSection;
26 protected Section axesSection; 27 protected Section axesSection;
27 28
28 29
29 public ChartSettings() { 30 public ChartSettings() {
30 super(); 31 super();
84 * 85 *
85 * @return the Section that stores legend specific attributes. 86 * @return the Section that stores legend specific attributes.
86 */ 87 */
87 public LegendSection getLegendSection() { 88 public LegendSection getLegendSection() {
88 return legendSection; 89 return legendSection;
90 }
91
92
93 /**
94 * Sets the export section. Old export sections are removed.
95 *
96 * @param exportSection A new Section that stores export specific
97 * attributes.
98 */
99 public void setExportSection(ExportSection exportSection) {
100 ExportSection oldExportSection = getExportSection();
101
102 if (oldExportSection != null) {
103 removeSection(oldExportSection);
104 }
105
106 this.exportSection = exportSection;
107 addSection(exportSection);
108 }
109
110
111 /**
112 * Returns the Section that stores export specific attributes.
113 *
114 * @return the Section that stores export specific attributes.
115 */
116 public ExportSection getExportSection() {
117 return exportSection;
89 } 118 }
90 119
91 120
92 /** 121 /**
93 * Adds a Section for a new axis of the chart. 122 * Adds a Section for a new axis of the chart.
140 ChartSettings chartSettings = new ChartSettings(); 169 ChartSettings chartSettings = new ChartSettings();
141 170
142 parseAxes(chartSettings, settings); 171 parseAxes(chartSettings, settings);
143 parseChart(chartSettings, settings); 172 parseChart(chartSettings, settings);
144 parseLegend(chartSettings, settings); 173 parseLegend(chartSettings, settings);
174 parseExport(chartSettings, settings);
145 175
146 return chartSettings; 176 return chartSettings;
147 } 177 }
148 178
149 179
229 section.setVisibility(Boolean.valueOf(vis)); 259 section.setVisibility(Boolean.valueOf(vis));
230 section.setFontSize(Integer.valueOf(fSize.length() > 0 ? fSize : "-1")); 260 section.setFontSize(Integer.valueOf(fSize.length() > 0 ? fSize : "-1"));
231 261
232 target.setLegendSection(section); 262 target.setLegendSection(section);
233 } 263 }
264
265
266 protected static void parseExport(ChartSettings target, Node export) {
267 ExportSection section = new ExportSection();
268
269 String width = XMLUtils.xpathString(export, "export/width", null);
270 String height = XMLUtils.xpathString(export, "export/height", null);
271
272 if (logger.isDebugEnabled()) {
273 logger.debug("Found export width : '" + width + "'");
274 logger.debug("Found export height: '" + height + "'");
275 }
276
277 section.setWidth(Integer.valueOf(width.length() > 0 ? width : "-1"));
278 section.setHeight(Integer.valueOf(height.length() > 0 ? height : "-1"));
279
280 target.setExportSection(section);
281 }
234 } 282 }
235 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 283 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org