annotate flys-artifacts/src/main/java/de/intevation/flys/exports/AxisSection.java @ 3634:001e35349203

Fix issue829, wst col indices start with 0. flys-artifacts/trunk@5342 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Sat, 01 Sep 2012 15:44:38 +0000
parents ca8997aa683e
children
rev   line source
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
1 package de.intevation.flys.exports;
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
2
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
3
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
4 import org.w3c.dom.Document;
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
5 import org.w3c.dom.Element;
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
6 import org.w3c.dom.Node;
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
7
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
8 import de.intevation.artifactdatabase.state.Attribute;
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
9
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
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
11 /**
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
12 * @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
13 */
2058
f97cf2e350c9 Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
14 public class AxisSection extends TypeSection {
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
15
1991
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
16 public static final String IDENTIFIER_ATTR = "id";
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
17 public static final String LABEL_ATTR = "label";
1992
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
18 public static final String FONTSIZE_ATTR = "font-size";
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
19 public static final String FIXATION_ATTR = "fixation";
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
20 public static final String UPPERRANGE_ATTR = "upper";
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
21 public static final String LOWERRANGE_ATTR = "lower";
1991
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
22
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
23
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
24 public AxisSection() {
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
25 super("axis");
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
26 }
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
27
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
28
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
29 public void setIdentifier(String identifier) {
2058
f97cf2e350c9 Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
30 setStringValue(IDENTIFIER_ATTR, identifier);
1991
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
31 }
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
32
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
33
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
34 public String getIdentifier() {
2058
f97cf2e350c9 Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
35 return getStringValue(IDENTIFIER_ATTR);
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
36 }
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
37
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
38
1991
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
39 public void setLabel(String label) {
2058
f97cf2e350c9 Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
40 setStringValue(LABEL_ATTR, label);
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
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
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
2051
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
44 public String getLabel() {
2058
f97cf2e350c9 Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
45 return getStringValue(LABEL_ATTR);
2051
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
46 }
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
47
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
48
1992
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
49 public void setFontSize(int fontSize) {
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
50 if (fontSize <= 0) {
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
51 return;
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
52 }
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
53
2058
f97cf2e350c9 Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
54 setIntegerValue(FONTSIZE_ATTR, fontSize);
1992
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
55 }
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
56
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
57
2053
f9a972d375ba Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2051
diff changeset
58 public Integer getFontSize() {
2058
f97cf2e350c9 Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
59 return getIntegerValue(FONTSIZE_ATTR);
2053
f9a972d375ba Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2051
diff changeset
60 }
f9a972d375ba Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2051
diff changeset
61
f9a972d375ba Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2051
diff changeset
62
1992
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
63 public void setFixed(boolean fixed) {
2058
f97cf2e350c9 Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
64 setBooleanValue(FIXATION_ATTR, fixed);
1992
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
65 }
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
66
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
67
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
68 public Boolean isFixed() {
2058
f97cf2e350c9 Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
69 return getBooleanValue(FIXATION_ATTR);
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
70 }
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
71
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
72
1992
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
73 public void setUpperRange(double upperRange) {
2058
f97cf2e350c9 Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
74 setDoubleValue(UPPERRANGE_ATTR, upperRange);
1992
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
75 }
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
76
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
77
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
78 public Double getUpperRange() {
2058
f97cf2e350c9 Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
79 return getDoubleValue(UPPERRANGE_ATTR);
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
80 }
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
81
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
82
1992
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
83 public void setLowerRange(double lowerRange) {
2058
f97cf2e350c9 Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
84 setDoubleValue(LOWERRANGE_ATTR, lowerRange);
1992
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
85 }
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
86
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
87
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
88 public Double getLowerRange() {
2058
f97cf2e350c9 Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2053
diff changeset
89 return getDoubleValue(LOWERRANGE_ATTR);
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
90 }
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
91
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
92
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
93 @Override
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
94 public void toXML(Node parent) {
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
95 Document owner = parent.getOwnerDocument();
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
96 Element axis = owner.createElement("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
97
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
98 parent.appendChild(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
99
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
100 for (String key: getKeys()) {
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
101 Attribute attr = getAttribute(key);
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
102 attr.toXML(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
103 }
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
104 }
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
105 }
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
106 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org