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

Added an ExportSection to ChartSettings which provides attributes for chart 'width' and 'height'. flys-artifacts/trunk@3547 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 27 Dec 2011 10:12:14 +0000
parents
children f84854eba0b3
comparison
equal deleted inserted replaced
2055:3cec0575d655 2056:76eeb3b4358e
1 package de.intevation.flys.exports;
2
3 import de.intevation.artifactdatabase.state.Attribute;
4 import de.intevation.artifactdatabase.state.DefaultSection;
5
6
7 /**
8 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
9 */
10 public class TypeSection extends DefaultSection {
11
12 public TypeSection(String key) {
13 super(key);
14 }
15
16
17 public void setStringValue(String key, String value) {
18 if (value == null || value.length() == 0) {
19 return;
20 }
21
22 Attribute attr = getAttribute(key);
23 if (attr == null) {
24 attr = new StringAttribute(key, value, true);
25 addAttribute(key, attr);
26 }
27 else {
28 attr.setValue(value);
29 }
30 }
31
32
33 public String getStringValue(String key) {
34 Attribute attr = getAttribute(key);
35
36 if (attr instanceof StringAttribute) {
37 return (String) attr.getValue();
38 }
39
40 return null;
41 }
42
43
44 public void setIntegerValue(String key, int value) {
45 Attribute attr = getAttribute(key);
46 if (attr == null) {
47 attr = new IntegerAttribute(key, value, true);
48 addAttribute(key, attr);
49 }
50 else {
51 attr.setValue(value);
52 }
53 }
54
55
56 public Integer getIntegerValue(String key) {
57 Attribute attr = getAttribute(key);
58
59 if (attr instanceof IntegerAttribute) {
60 return (Integer) attr.getValue();
61 }
62
63 return null;
64 }
65
66
67
68 public void setDoubleValue(String key, double value) {
69 Attribute attr = getAttribute(key);
70 if (attr == null) {
71 attr = new DoubleAttribute(key, value, true);
72 addAttribute(key, attr);
73 }
74 else {
75 attr.setValue(value);
76 }
77 }
78
79
80 public Double getDoubleValue(String key) {
81 Attribute attr = getAttribute(key);
82
83 if (attr instanceof DoubleAttribute) {
84 return (Double) attr.getValue();
85 }
86
87 return null;
88 }
89
90
91 public void setBooleanValue(String key, boolean value) {
92 Attribute attr = getAttribute(key);
93 if (attr == null) {
94 attr = new BooleanAttribute(key, value, true);
95 addAttribute(key, attr);
96 }
97 else {
98 attr.setValue(value);
99 }
100 }
101
102
103 public Boolean getBooleanValue(String key) {
104 Attribute attr = getAttribute(key);
105
106 if (attr instanceof BooleanAttribute) {
107 return (Boolean) attr.getValue();
108 }
109
110 return null;
111 }
112 }
113 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org