annotate flys-artifacts/src/main/java/de/intevation/flys/exports/AxisSection.java @ 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. flys-artifacts/trunk@3550 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 27 Dec 2011 11:37:23 +0000
parents f9a972d375ba
children ca8997aa683e
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 import de.intevation.artifactdatabase.state.DefaultSection;
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 /**
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 * @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
14 */
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
15 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
16
1991
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
17 public static final String IDENTIFIER_ATTR = "id";
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
18 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
19 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
20 public static final String FIXATION_ATTR = "fixation";
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
21 public static final String UPPERRANGE_ATTR = "upper";
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
22 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
23
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
24
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
25 public AxisSection() {
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
26 super("axis");
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
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
30 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
31 setStringValue(IDENTIFIER_ATTR, identifier);
1991
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
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
34
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
35 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
36 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
37 }
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
38
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
39
1991
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
40 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
41 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
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
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
2051
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
45 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
46 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
47 }
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
48
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2050
diff changeset
49
1992
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
50 public void setFontSize(int fontSize) {
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
51 if (fontSize <= 0) {
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
52 return;
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
53 }
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
54
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
55 setIntegerValue(FONTSIZE_ATTR, fontSize);
1992
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
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
58
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
59 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
60 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
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
f9a972d375ba Use the user defined font size to set Y axes label fonts sizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2051
diff changeset
63
1992
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
64 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
65 setBooleanValue(FIXATION_ATTR, fixed);
1992
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
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
68
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
69 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
70 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
71 }
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
72
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
73
1992
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
74 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
75 setDoubleValue(UPPERRANGE_ATTR, upperRange);
1992
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
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
78
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
79 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
80 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
81 }
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
82
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
83
1992
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
84 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
85 setDoubleValue(LOWERRANGE_ATTR, lowerRange);
1992
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
e1c9f28e2675 Added more attributes to ChartSettings AxisSection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1991
diff changeset
88
2050
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
89 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
90 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
91 }
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
92
c4e0e433f825 Use axes ranges specified in ChartSettings for zooming in charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1992
diff changeset
93
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
94 @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
95 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
96 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
97 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
98
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 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
100
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 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
102 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
103 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
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 }
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
107 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org