[PATCH] (issue1762) Use getValue to obtain dateRange values
Wald Commits
scm-commit at wald.intevation.org
Wed Oct 22 17:34:18 CEST 2014
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1413992023 -7200
# Node ID df65f24af5bc43c9a5c16da5bfd108385316ff9a
# Parent e65aad00b3a1c8c8e5d7e0b9fdfb08e7e708415b
(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.
diff -r e65aad00b3a1 -r df65f24af5bc gwt-client/src/main/java/org/dive4elements/river/client/client/ui/GaugeTimeRangePanel.java
--- 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();
More information about the Dive4Elements-commits
mailing list