diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/TypeSection.java	Tue Dec 27 10:12:14 2011 +0000
@@ -0,0 +1,113 @@
+package de.intevation.flys.exports;
+
+import de.intevation.artifactdatabase.state.Attribute;
+import de.intevation.artifactdatabase.state.DefaultSection;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class TypeSection extends DefaultSection {
+
+    public TypeSection(String key) {
+        super(key);
+    }
+
+
+    public void setStringValue(String key, String value) {
+        if (value == null || value.length() == 0) {
+            return;
+        }
+
+        Attribute attr = getAttribute(key);
+        if (attr == null) {
+            attr = new StringAttribute(key, value, true);
+            addAttribute(key, attr);
+        }
+        else {
+            attr.setValue(value);
+        }
+    }
+
+
+    public String getStringValue(String key) {
+        Attribute attr = getAttribute(key);
+
+        if (attr instanceof StringAttribute) {
+            return (String) attr.getValue();
+        }
+
+        return null;
+    }
+
+
+    public void setIntegerValue(String key, int value) {
+        Attribute attr = getAttribute(key);
+        if (attr == null) {
+            attr = new IntegerAttribute(key, value, true);
+            addAttribute(key, attr);
+        }
+        else {
+            attr.setValue(value);
+        }
+    }
+
+
+    public Integer getIntegerValue(String key) {
+        Attribute attr = getAttribute(key);
+
+        if (attr instanceof IntegerAttribute) {
+            return (Integer) attr.getValue();
+        }
+
+        return null;
+    }
+
+
+
+    public void setDoubleValue(String key, double value) {
+        Attribute attr = getAttribute(key);
+        if (attr == null) {
+            attr = new DoubleAttribute(key, value, true);
+            addAttribute(key, attr);
+        }
+        else {
+            attr.setValue(value);
+        }
+    }
+
+
+    public Double getDoubleValue(String key) {
+        Attribute attr = getAttribute(key);
+
+        if (attr instanceof DoubleAttribute) {
+            return (Double) attr.getValue();
+        }
+
+        return null;
+    }
+
+
+    public void setBooleanValue(String key, boolean value) {
+        Attribute attr = getAttribute(key);
+        if (attr == null) {
+            attr = new BooleanAttribute(key, value, true);
+            addAttribute(key, attr);
+        }
+        else {
+            attr.setValue(value);
+        }
+    }
+
+
+    public Boolean getBooleanValue(String key) {
+        Attribute attr = getAttribute(key);
+
+        if (attr instanceof BooleanAttribute) {
+            return (Boolean) attr.getValue();
+        }
+
+        return null;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org