changeset 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 e65aad00b3a1
children 666ac28a0256
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/GaugeTimeRangePanel.java
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/GaugeTimeRangePanel.java	Tue Oct 21 12:14:39 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/GaugeTimeRangePanel.java	Wed Oct 22 17:33:43 2014 +0200
@@ -204,20 +204,20 @@
 
 
     protected long getLowerAsLong() {
-        Date d = dateRange.getFromDate();
+        Date d = dateRange.getValue().getStartDate();
         return d.getTime();
     }
 
 
     protected long getUpperAsLong() {
-        Date d = dateRange.getToDate();
+        Date d = dateRange.getValue().getEndDate();
         return d.getTime();
     }
 
 
     @Override
     public Object getMaxUpper() {
-        Date d = dateRange.getToDate();
+        Date d = dateRange.getValue().getEndDate();
         return new Long(d.getTime());
     }
 
@@ -391,8 +391,8 @@
     public List<String> validate() {
         List<String> errors = new ArrayList<String>();
 
-        Date from = dateRange.getFromDate();
-        Date to   = dateRange.getToDate();
+        Date from = dateRange.getValue().getStartDate();
+        Date to   = dateRange.getValue().getEndDate();
 
         if (from == null || to == null) {
             String msg = MSG.error_validate_date_range();

http://dive4elements.wald.intevation.org