annotate flys-artifacts/src/main/java/de/intevation/flys/exports/AxisSection.java @ 1991:0bd7c3cf0af1

Added axis sections into charts Settings. flys-artifacts/trunk@3427 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 15 Dec 2011 17:10:42 +0000
parents 3632150dbe0b
children e1c9f28e2675
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 */
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 public class AxisSection extends 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
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";
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
19
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
20
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
21 public AxisSection() {
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
22 super("axis");
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
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
26 public void setIdentifier(String identifier) {
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
27 if (identifier == null || identifier.length() == 0) {
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
28 return;
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
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
31 Attribute attr = getAttribute(IDENTIFIER_ATTR);
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
32 if (attr == null) {
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
33 attr = new StringAttribute(IDENTIFIER_ATTR, identifier, false);
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
34 addAttribute(IDENTIFIER_ATTR, attr);
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
35 }
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
36 else {
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
37 attr.setValue(identifier);
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
38 }
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
39 }
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
40
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
41
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
42 public void setLabel(String label) {
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
43 if (label == null) {
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
44 return;
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
45 }
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
46
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
47 Attribute attr = getAttribute(LABEL_ATTR);
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
48 if (attr == null) {
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
49 attr = new StringAttribute(LABEL_ATTR, label, true);
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
50 addAttribute(LABEL_ATTR, attr);
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
51 }
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
52 else {
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
53 attr.setValue(label);
0bd7c3cf0af1 Added axis sections into charts Settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1986
diff changeset
54 }
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
55 }
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
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 @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
59 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
60 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
61 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
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 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
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 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
66 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
67 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
68 }
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
69 }
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 }
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org