diff artifacts/src/main/java/org/dive4elements/river/exports/AxisSection.java @ 8455:6dfc3a1fc70d

(issue1764) Set upper-time and lower-time for time series axes This introduces new optional chart settings. Upper-time and lower-time. If they are present the client can show a date selection and they can be used for the domain axis in timeseries diagrams.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 29 Oct 2014 19:51:39 +0100
parents fca46ce8e4f5
children 1cc7653ca84f
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/AxisSection.java	Wed Oct 29 19:49:18 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/AxisSection.java	Wed Oct 29 19:51:39 2014 +0100
@@ -28,6 +28,8 @@
     public static final String FIXATION_ATTR             = "fixation";
     public static final String UPPERRANGE_ATTR           = "upper";
     public static final String LOWERRANGE_ATTR           = "lower";
+    public static final String UPPERRANGE_TIME_ATTR      = "upper-time";
+    public static final String LOWERRANGE_TIME_ATTR      = "lower-time";
 
 
     public AxisSection() {
@@ -107,6 +109,34 @@
         return getDoubleValue(LOWERRANGE_ATTR);
     }
 
+    public void setUpperTimeRange(long upperRange) {
+        setStringValue(UPPERRANGE_TIME_ATTR, Long.toString(upperRange));
+    }
+
+    /* return the upper time rang limit as a long value that can be converted
+     * to a date. If none is set null is returned. */
+    public Long getUpperTimeRange() {
+        try {
+            return Long.valueOf(getStringValue(UPPERRANGE_TIME_ATTR));
+        } catch (NumberFormatException e) {
+            return null;
+        }
+    }
+
+    public void setLowerTimeRange(long lowerRange) {
+        setStringValue(LOWERRANGE_TIME_ATTR, Long.toString(lowerRange));
+    }
+
+    /* See getUpperTimeRange */
+    public Long getLowerTimeRange() {
+        try {
+            return Long.valueOf(getStringValue(LOWERRANGE_TIME_ATTR));
+        } catch (NumberFormatException e) {
+            return null;
+        }
+    }
+
+
 
     @Override
     public void toXML(Node parent) {

http://dive4elements.wald.intevation.org