comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/GaugeTimeRangePanel.java @ 8443:df65f24af5bc

(issue1762) Use getValue to obtain dateRange values The getToValue was always the initial value regardless of what has been entered in the form. According to the documentation both getToValue and getFromValue should return the "initial value" of the form field. But wether this means the value before validation corrections or the value the field is initialized with (which is also not true in both cases as the field is set only after creation) It returned the real value for the from date but not for the to date. With an explicit getValue we workaround this issue.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 22 Oct 2014 17:33:43 +0200
parents d1cfd23e35cd
children 5e38e2924c07
comparison
equal deleted inserted replaced
8442:e65aad00b3a1 8443:df65f24af5bc
202 return maxLower; 202 return maxLower;
203 } 203 }
204 204
205 205
206 protected long getLowerAsLong() { 206 protected long getLowerAsLong() {
207 Date d = dateRange.getFromDate(); 207 Date d = dateRange.getValue().getStartDate();
208 return d.getTime(); 208 return d.getTime();
209 } 209 }
210 210
211 211
212 protected long getUpperAsLong() { 212 protected long getUpperAsLong() {
213 Date d = dateRange.getToDate(); 213 Date d = dateRange.getValue().getEndDate();
214 return d.getTime(); 214 return d.getTime();
215 } 215 }
216 216
217 217
218 @Override 218 @Override
219 public Object getMaxUpper() { 219 public Object getMaxUpper() {
220 Date d = dateRange.getToDate(); 220 Date d = dateRange.getValue().getEndDate();
221 return new Long(d.getTime()); 221 return new Long(d.getTime());
222 } 222 }
223 223
224 224
225 @Override 225 @Override
389 /** Return List of error messages, if not validated. */ 389 /** Return List of error messages, if not validated. */
390 @Override 390 @Override
391 public List<String> validate() { 391 public List<String> validate() {
392 List<String> errors = new ArrayList<String>(); 392 List<String> errors = new ArrayList<String>();
393 393
394 Date from = dateRange.getFromDate(); 394 Date from = dateRange.getValue().getStartDate();
395 Date to = dateRange.getToDate(); 395 Date to = dateRange.getValue().getEndDate();
396 396
397 if (from == null || to == null) { 397 if (from == null || to == null) {
398 String msg = MSG.error_validate_date_range(); 398 String msg = MSG.error_validate_date_range();
399 errors.add(msg); 399 errors.add(msg);
400 } 400 }

http://dive4elements.wald.intevation.org