annotate artifacts/src/main/java/org/dive4elements/river/exports/ChartSettings.java @ 9801:1d7a72a50183 3.2.x tip

Assume Compose V2, consistently
author Tom Gottfried <tom@intevation.de>
date Thu, 23 Nov 2023 10:14:13 +0100
parents 0a5239a1e46e
children
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3618
diff changeset
9 package org.dive4elements.river.exports;
1986
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
11 import javax.xml.xpath.XPathConstants;
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
12
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
13 import org.w3c.dom.Node;
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
14 import org.w3c.dom.NodeList;
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
15
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
16 import org.apache.logging.log4j.Logger;
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
17 import org.apache.logging.log4j.LogManager;
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
18
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3618
diff changeset
19 import org.dive4elements.artifacts.common.utils.XMLUtils;
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
20
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3618
diff changeset
21 import org.dive4elements.artifactdatabase.state.DefaultSection;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3618
diff changeset
22 import org.dive4elements.artifactdatabase.state.DefaultSettings;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3618
diff changeset
23 import org.dive4elements.artifactdatabase.state.Section;
1986
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 /**
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 */
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 public class ChartSettings extends DefaultSettings {
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
31 private static final Logger log = LogManager.getLogger(ChartSettings.class);
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
32
2046
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1994
diff changeset
33 protected ChartSection chartSection;
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1994
diff changeset
34 protected LegendSection legendSection;
2056
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
35 protected ExportSection exportSection;
2046
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1994
diff changeset
36 protected Section axesSection;
1986
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 public ChartSettings() {
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 super();
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 axesSection = new DefaultSection("axes");
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 addSection(axesSection);
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 }
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 /**
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 * Sets the chart section. Old chart sections are removed.
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 *
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 * @param chartSection A new Section that stores chart specific attributes.
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 */
2046
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1994
diff changeset
52 public void setChartSection(ChartSection chartSection) {
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1994
diff changeset
53 ChartSection oldChartSection = getChartSection();
1986
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 if (oldChartSection != null) {
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 removeSection(oldChartSection);
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 }
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 this.chartSection = chartSection;
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 addSection(chartSection);
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 }
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 /**
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 * Returns the Section that stores chart specific attributes.
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 *
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 * @return the Section that stores chart specific attributes.
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 */
2046
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1994
diff changeset
69 public ChartSection getChartSection() {
1986
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 return chartSection;
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 }
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 /**
1990
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
75 * Sets the legend section. Old legend sections are removed.
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
76 *
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
77 * @param legendSection A new Section that stores legend specific
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
78 * attributes.
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
79 */
2046
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1994
diff changeset
80 public void setLegendSection(LegendSection legendSection) {
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1994
diff changeset
81 LegendSection oldLegendSection = getLegendSection();
1990
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
82
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
83 if (oldLegendSection != null) {
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
84 removeSection(oldLegendSection);
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
85 }
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
86
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
87 this.legendSection = legendSection;
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
88 addSection(legendSection);
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
89 }
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
90
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
91
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
92 /**
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
93 * Returns the Section that stores legend specific attributes.
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
94 *
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
95 * @return the Section that stores legend specific attributes.
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
96 */
2046
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1994
diff changeset
97 public LegendSection getLegendSection() {
1990
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
98 return legendSection;
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
99 }
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
100
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
101
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
102 /**
2056
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
103 * Sets the export section. Old export sections are removed.
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
104 *
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
105 * @param exportSection A new Section that stores export specific
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
106 * attributes.
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
107 */
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
108 public void setExportSection(ExportSection exportSection) {
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
109 ExportSection oldExportSection = getExportSection();
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
110
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
111 if (oldExportSection != null) {
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
112 removeSection(oldExportSection);
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
113 }
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
114
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
115 this.exportSection = exportSection;
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
116 addSection(exportSection);
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
117 }
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
118
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
119
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
120 /**
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
121 * Returns the Section that stores export specific attributes.
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
122 *
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
123 * @return the Section that stores export specific attributes.
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
124 */
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
125 public ExportSection getExportSection() {
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
126 return exportSection;
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
127 }
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
128
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
129
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
130 /**
1986
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 * Adds a Section for a new axis of the chart.
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 *
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 * @param axisSection The Section specific for a chart axis.
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 */
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
135 public void addAxisSection(AxisSection axisSection) {
1986
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 if (axisSection != null) {
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 axesSection.addSubsection(axisSection);
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 }
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 }
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
140
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
141
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
142 /**
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
143 * This method returns an AxisSection specified by <i>axisId</i> or null if
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
144 * no AxisSection is existing with identifier <i>axisId</i>.
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
145 *
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
146 * @param axisId The identifier of the wanted AxisSection.
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
147 *
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
148 * @return the AxisSection specified by <i>axisId</i> or null.
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
149 */
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
150 public AxisSection getAxisSection(String axisId) {
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
151 for (int i = 0, n = axesSection.getSubsectionCount(); i < n; i++) {
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
152 AxisSection as = (AxisSection) axesSection.getSubsection(i);
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
153 String id = as.getIdentifier();
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
154
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
155 if (id != null && id.equals(axisId)) {
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
156 return as;
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
157 }
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
158 }
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
159
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
160 return null;
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
161 }
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
162
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
163
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
164 /**
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
165 * Parses the settings from <i>settings</i>. The result is a new
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
166 * ChartSettings instance.
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
167 *
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
168 * @param settings A <i>settings</i> node.
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
169 *
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
170 * @return a new <i>ChartSettings</i> instance.
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
171 */
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
172 public static ChartSettings parse(Node settings) {
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
173 if (settings == null) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
174 log.warn("Tried to parse ChartSettings from empty Node!");
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
175 return null;
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
176 }
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
177
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
178 ChartSettings chartSettings = new ChartSettings();
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
179
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
180 parseAxes(chartSettings, settings);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
181 parseChart(chartSettings, settings);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
182 parseLegend(chartSettings, settings);
2056
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
183 parseExport(chartSettings, settings);
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
184
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
185 return chartSettings;
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
186 }
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
187
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
188
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
189 protected static void parseAxes(ChartSettings target, Node settings) {
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
190 NodeList axesList = (NodeList) XMLUtils.xpath(
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
191 settings, "axes/axis", XPathConstants.NODESET, null);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
192
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
193 int num = axesList != null ? axesList.getLength() : 0;
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
194
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
195 if (num <= 0) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
196 log.debug("No axis sections found.");
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
197 return;
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
198 }
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
199
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
200 for (int i = 0; i < num; i++) {
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
201 parseAxis(target, axesList.item(i));
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
202 }
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
203 }
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
204
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
205
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
206 protected static void parseAxis(ChartSettings target, Node axis) {
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
207 AxisSection section = new AxisSection();
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
208
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
209 String id = XMLUtils.xpathString(axis, "id", null);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
210 String label = XMLUtils.xpathString(axis, "label", null);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
211 String fSize = XMLUtils.xpathString(axis, "font-size", null);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
212 String fixation = XMLUtils.xpathString(axis, "fixation", null);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
213 String low = XMLUtils.xpathString(axis, "lower", null);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
214 String up = XMLUtils.xpathString(axis, "upper", null);
7597
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
215 String sugLabel = XMLUtils.xpathString(axis, "suggested-label", null);
8455
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
216 String lowTime = XMLUtils.xpathString(axis, "lower-time", null);
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
217 String upTime = XMLUtils.xpathString(axis, "upper-time", null);
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
218
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
219 if (log.isDebugEnabled()) {
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
220 log.debug("Found axis id: '" + id + "'");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
221 log.debug("Found axis label: '" + label + "'");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
222 log.debug("Found axis font size: '" + fSize + "'");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
223 log.debug("Found axis fixation: '" + fixation + "'");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
224 log.debug("Found axis lower: '" + low + "'");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
225 log.debug("Found axis upper: '" + up + "'");
8455
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
226 log.debug("Found axis lower-time:'" + lowTime + "'");
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
227 log.debug("Found axis upper-time:'" + upTime + "'");
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
228 log.debug("Found axis sug. label:'" + sugLabel + "'");
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
229 }
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
230
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
231 section.setIdentifier(id);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
232 section.setLabel(label);
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
233 section.setFontSize(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
234 Integer.parseInt(fSize.length() > 0 ? fSize : "-1"));
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
235 section.setFixed(Boolean.valueOf(fixation));
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
236 if (upTime != null
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
237 && !upTime.isEmpty()
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
238 && lowTime != null
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
239 && !lowTime.isEmpty()
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
240 ) {
8455
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
241 section.setLowerTimeRange(Long.parseLong(lowTime));
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
242 section.setUpperTimeRange(Long.parseLong(upTime));
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
243 } else {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
244 section.setLowerRange(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
245 Double.parseDouble(low.length() > 0 ? low : "0"));
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
246 section.setUpperRange(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
247 Double.parseDouble(up.length() > 0 ? up : "0"));
8455
6dfc3a1fc70d (issue1764) Set upper-time and lower-time for time series axes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
248 }
7597
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
249 section.setSuggestedLabel(sugLabel);
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
250
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
251 target.addAxisSection(section);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
252 }
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
253
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
254
3615
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
255 /**
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
256 * From document chart create ChartSection and populate it with attributes.
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
257 * Give this object to target as chartsection.
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
258 */
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
259 protected static void parseChart(ChartSettings target, Node chart) {
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
260 ChartSection chartSection = new ChartSection();
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
261
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
262 String title = XMLUtils.xpathString(chart, "chart/title", null);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
263 String sub = XMLUtils.xpathString(chart, "chart/subtitle", null);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
264 String grid = XMLUtils.xpathString(chart, "chart/display-grid", null);
3615
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
265 String logo = XMLUtils.xpathString(chart, "chart/display-logo", null);
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
266 String placeh = XMLUtils.xpathString(chart, "chart/logo-placeh", null);
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
267 String placev = XMLUtils.xpathString(chart, "chart/logo-placev", null);
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
268
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
269 if (log.isDebugEnabled()) {
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
270 log.debug("Found chart title: '" + title + "'");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
271 log.debug("Found chart subtitle: '" + sub + "'");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
272 log.debug("Found chart grid: '" + grid + "'");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
273 log.debug("Found chart logo: '" + logo + "'");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
274 log.debug("Found chart logo placeh: '" + placeh + "'");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
275 log.debug("Found chart logo placev: '" + placev + "'");
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
276 }
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
277
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
278 chartSection.setTitle(title);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
279 chartSection.setSubtitle(sub);
3613
dd6e25980c91 Fixed typo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3405
diff changeset
280 chartSection.setDisplayGrid(Boolean.valueOf(grid));
3615
f84854eba0b3 Preparations for logo inclusion in charts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3613
diff changeset
281 chartSection.setDisplayLogo(logo);
3618
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
282 chartSection.setLogoHPlacement(placeh);
b7867c03760a Split logo placement property in two (vertical/horizontal).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3617
diff changeset
283 chartSection.setLogoVPlacement(placev);
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
284
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
285 target.setChartSection(chartSection);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
286 }
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
287
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
288
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
289 protected static void parseLegend(ChartSettings target, Node legend) {
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
290 LegendSection section = new LegendSection();
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
291
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
292 String vis = XMLUtils.xpathString(legend, "legend/visibility", null);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
293 String fSize = XMLUtils.xpathString(legend, "legend/font-size", null);
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
294 String lthre = XMLUtils.xpathString(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
295 legend, "legend/aggregation-threshold", null);
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
296
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
297 if (log.isDebugEnabled()) {
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
298 log.debug("Found legend visibility: '" + vis + "'");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
299 log.debug("Found legend font size : '" + fSize + "'");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
300 log.debug("Found legend aggregation threshold : '" + lthre + "'");
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
301 }
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
302
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
303 section.setVisibility(Boolean.valueOf(vis));
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
304 section.setFontSize(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
305 Integer.valueOf(fSize.length() > 0 ? fSize : "-1"));
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
306 section.setAggregationThreshold(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8455
diff changeset
307 Integer.valueOf(lthre.length() >0 ? lthre : "-1"));
1994
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
308
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
309 target.setLegendSection(section);
3e703d134bbe Parse the Settings of each Output during Collection's describe() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
310 }
2056
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
311
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
312
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
313 protected static void parseExport(ChartSettings target, Node export) {
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
314 ExportSection section = new ExportSection();
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
315
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
316 String width = XMLUtils.xpathString(export, "export/width", null);
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
317 String height = XMLUtils.xpathString(export, "export/height", null);
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
318
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
319 if (log.isDebugEnabled()) {
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
320 log.debug("Found export width : '" + width + "'");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7597
diff changeset
321 log.debug("Found export height: '" + height + "'");
2056
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
322 }
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
323
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
324 section.setWidth(Integer.valueOf(width.length() > 0 ? width : "-1"));
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
325 section.setHeight(Integer.valueOf(height.length() > 0 ? height : "-1"));
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
326
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
327 target.setExportSection(section);
76eeb3b4358e Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
328 }
1986
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
329 }
3632150dbe0b Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
330 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org