aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/DateField.java
diff options
context:
space:
mode:
authorJohn Alhroos <john.ahlroos@itmill.com>2010-07-02 08:10:08 +0000
committerJohn Alhroos <john.ahlroos@itmill.com>2010-07-02 08:10:08 +0000
commit3842a191bcff2f0736d2ad9bb458f2828a2d999d (patch)
treef54b8a96bb574b579149918f0c647c82900fe87f /src/com/vaadin/ui/DateField.java
parentfccac310f204dd12a7f23973aaab8b570e446d69 (diff)
downloadvaadin-framework-3842a191bcff2f0736d2ad9bb458f2828a2d999d.tar.gz
vaadin-framework-3842a191bcff2f0736d2ad9bb458f2828a2d999d.zip
Fixes #5277, #5291, #5292
svn changeset:14022/svn branch:6.4
Diffstat (limited to 'src/com/vaadin/ui/DateField.java')
-rw-r--r--src/com/vaadin/ui/DateField.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/com/vaadin/ui/DateField.java b/src/com/vaadin/ui/DateField.java
index 960be359f8..9957365096 100644
--- a/src/com/vaadin/ui/DateField.java
+++ b/src/com/vaadin/ui/DateField.java
@@ -386,7 +386,6 @@ public class DateField extends AbstractField implements
*/
parsingSucceeded = false;
setInternalValue(null);
- fireValueChange(true);
}
} else if (newDate != oldDate
&& (newDate == null || !newDate.equals(oldDate))) {
@@ -469,10 +468,26 @@ public class DateField extends AbstractField implements
public void setValue(Object newValue, boolean repaintIsNotNeeded)
throws Property.ReadOnlyException, Property.ConversionException {
+ dateString = null;
+
// Allows setting dates directly
if (newValue == null || newValue instanceof Date) {
try {
- super.setValue(newValue, repaintIsNotNeeded);
+ dateString = newValue == null ? null : newValue.toString();
+ if (dateString == null && super.getValue() == null) {
+ /*
+ * AbstractField cannot handle invalid changes in client
+ * side so we have to repaint the component manually. No
+ * value change event is also fired.
+ */
+ requestRepaint();
+
+ } else {
+ super.setValue(newValue, repaintIsNotNeeded);
+ }
+
+ setComponentError(null);
+
parsingSucceeded = true;
} catch (InvalidValueException ive) {
// Thrown if validator fails
@@ -487,6 +502,7 @@ public class DateField extends AbstractField implements
final Date val = parser.parse(newValue.toString());
super.setValue(val, repaintIsNotNeeded);
parsingSucceeded = true;
+ dateString = newValue.toString();
} catch (final ParseException e) {
parsingSucceeded = false;
throw new Property.ConversionException(