comparison 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
comparison
equal deleted inserted replaced
8454:7003cf5c19ed 8455:6dfc3a1fc70d
26 public static final String SUGGESTED_LABEL_ATTR = "suggested-label"; 26 public static final String SUGGESTED_LABEL_ATTR = "suggested-label";
27 public static final String FONTSIZE_ATTR = "font-size"; 27 public static final String FONTSIZE_ATTR = "font-size";
28 public static final String FIXATION_ATTR = "fixation"; 28 public static final String FIXATION_ATTR = "fixation";
29 public static final String UPPERRANGE_ATTR = "upper"; 29 public static final String UPPERRANGE_ATTR = "upper";
30 public static final String LOWERRANGE_ATTR = "lower"; 30 public static final String LOWERRANGE_ATTR = "lower";
31 public static final String UPPERRANGE_TIME_ATTR = "upper-time";
32 public static final String LOWERRANGE_TIME_ATTR = "lower-time";
31 33
32 34
33 public AxisSection() { 35 public AxisSection() {
34 super("axis"); 36 super("axis");
35 } 37 }
105 107
106 public Double getLowerRange() { 108 public Double getLowerRange() {
107 return getDoubleValue(LOWERRANGE_ATTR); 109 return getDoubleValue(LOWERRANGE_ATTR);
108 } 110 }
109 111
112 public void setUpperTimeRange(long upperRange) {
113 setStringValue(UPPERRANGE_TIME_ATTR, Long.toString(upperRange));
114 }
115
116 /* return the upper time rang limit as a long value that can be converted
117 * to a date. If none is set null is returned. */
118 public Long getUpperTimeRange() {
119 try {
120 return Long.valueOf(getStringValue(UPPERRANGE_TIME_ATTR));
121 } catch (NumberFormatException e) {
122 return null;
123 }
124 }
125
126 public void setLowerTimeRange(long lowerRange) {
127 setStringValue(LOWERRANGE_TIME_ATTR, Long.toString(lowerRange));
128 }
129
130 /* See getUpperTimeRange */
131 public Long getLowerTimeRange() {
132 try {
133 return Long.valueOf(getStringValue(LOWERRANGE_TIME_ATTR));
134 } catch (NumberFormatException e) {
135 return null;
136 }
137 }
138
139
110 140
111 @Override 141 @Override
112 public void toXML(Node parent) { 142 public void toXML(Node parent) {
113 Document owner = parent.getOwnerDocument(); 143 Document owner = parent.getOwnerDocument();
114 Element axis = owner.createElement("axis"); 144 Element axis = owner.createElement("axis");

http://dive4elements.wald.intevation.org