diff options
author | Jonatan Kronqvist <jonatan.kronqvist@itmill.com> | 2010-07-07 10:18:34 +0000 |
---|---|---|
committer | Jonatan Kronqvist <jonatan.kronqvist@itmill.com> | 2010-07-07 10:18:34 +0000 |
commit | a08faf0a54bfca4327bb37e1b01da46414dbda18 (patch) | |
tree | 8baa3d32277fe5c732009cff44c022ddde104797 | |
parent | 613c175cc7fe8dd7b8071d7a883587e85e6de4d3 (diff) | |
download | vaadin-framework-a08faf0a54bfca4327bb37e1b01da46414dbda18.tar.gz vaadin-framework-a08faf0a54bfca4327bb37e1b01da46414dbda18.zip |
Fix for #5277
svn changeset:14128/svn branch:6.4
3 files changed, 250 insertions, 124 deletions
diff --git a/src/com/vaadin/ui/DateField.java b/src/com/vaadin/ui/DateField.java index 9957365096..2e61699ac7 100644 --- a/src/com/vaadin/ui/DateField.java +++ b/src/com/vaadin/ui/DateField.java @@ -238,24 +238,35 @@ public class DateField extends AbstractField implements for (int r = resolution; r <= largestModifiable; r++) { switch (r) { case RESOLUTION_MSEC: - target.addVariable(this, "msec", currentDate != null ? calendar - .get(Calendar.MILLISECOND) : -1); + target.addVariable( + this, + "msec", + currentDate != null ? calendar + .get(Calendar.MILLISECOND) : -1); break; case RESOLUTION_SEC: - target.addVariable(this, "sec", currentDate != null ? calendar - .get(Calendar.SECOND) : -1); + target.addVariable(this, "sec", + currentDate != null ? calendar.get(Calendar.SECOND) + : -1); break; case RESOLUTION_MIN: - target.addVariable(this, "min", currentDate != null ? calendar - .get(Calendar.MINUTE) : -1); + target.addVariable(this, "min", + currentDate != null ? calendar.get(Calendar.MINUTE) + : -1); break; case RESOLUTION_HOUR: - target.addVariable(this, "hour", currentDate != null ? calendar - .get(Calendar.HOUR_OF_DAY) : -1); + target.addVariable( + this, + "hour", + currentDate != null ? calendar + .get(Calendar.HOUR_OF_DAY) : -1); break; case RESOLUTION_DAY: - target.addVariable(this, "day", currentDate != null ? calendar - .get(Calendar.DAY_OF_MONTH) : -1); + target.addVariable( + this, + "day", + currentDate != null ? calendar + .get(Calendar.DAY_OF_MONTH) : -1); break; case RESOLUTION_MONTH: target.addVariable(this, "month", @@ -263,8 +274,8 @@ public class DateField extends AbstractField implements : -1); break; case RESOLUTION_YEAR: - target.addVariable(this, "year", currentDate != null ? calendar - .get(Calendar.YEAR) : -1); + target.addVariable(this, "year", + currentDate != null ? calendar.get(Calendar.YEAR) : -1); break; } } @@ -527,6 +538,15 @@ public class DateField extends AbstractField implements } } + @Override + protected void setInternalValue(Object newValue) { + // Also set the internal dateString + if (newValue != null) { + dateString = newValue.toString(); + } + super.setInternalValue(newValue); + } + /** * Gets the resolution. * @@ -684,7 +704,24 @@ public class DateField extends AbstractField implements * Logically isEmpty() should return false also in the case that the * entered value is invalid. */ - return dateString == null || dateString.equals(""); + boolean empty = (dateString == null || dateString.equals("")); + return empty; + } + + @Override + public void valueChange(Property.ValueChangeEvent event) { + /* + * We also need to update the dateString if the value of the property + * data source changes. This has to be done before super fires the value + * change event in case someone checks isEmpty in a value change + * listener. + */ + Object value = getValue(); + if (value != null) { + dateString = value.toString(); + } + + super.valueChange(event); } /* diff --git a/tests/src/com/vaadin/tests/components/datefield/DateFieldEmptyValid.html b/tests/src/com/vaadin/tests/components/datefield/DateFieldEmptyValid.html index 3c09c59645..b180246839 100644 --- a/tests/src/com/vaadin/tests/components/datefield/DateFieldEmptyValid.html +++ b/tests/src/com/vaadin/tests/components/datefield/DateFieldEmptyValid.html @@ -12,186 +12,250 @@ <tr><td rowspan="1" colspan="3">DateFieldEmptyValid</td></tr> </thead><tbody> <tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.datefield.DateFieldEmptyValid?restartApplication</td> - <td></td> + <td>open</td> + <td>/run/com.vaadin.tests.components.datefield.DateFieldEmptyValid?restartApplication</td> + <td></td> </tr> <tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>2. isEmpty: false, isValid: true</td> + <td>waitForVaadin</td> + <td></td> + <td></td> </tr> <tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> - <td>1. DateField value is now 1973-03-03</td> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> + <td>2. isEmpty: false, isValid: true</td> </tr> <tr> - <td>assertValue</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> - <td>3.3.1973</td> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> + <td>1. DateField value is now 1973-03-03</td> </tr> <tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> - <td>62,12</td> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> + <td>3.3.1973</td> </tr> <tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> - <td>down</td> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> + <td>62,12</td> </tr> <tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::Root/VOverlay[0]/VCalendarPanel[0]</td> - <td>down</td> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> + <td>down</td> </tr> <tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::Root/VOverlay[0]/VCalendarPanel[0]</td> - <td>down</td> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::Root/VOverlay[0]/VCalendarPanel[0]</td> + <td>down</td> </tr> <tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::Root/VOverlay[0]/VCalendarPanel[0]</td> - <td>left</td> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::Root/VOverlay[0]/VCalendarPanel[0]</td> + <td>down</td> </tr> <tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::Root/VOverlay[0]/VCalendarPanel[0]</td> - <td>left</td> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::Root/VOverlay[0]/VCalendarPanel[0]</td> + <td>left</td> </tr> <tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::Root/VOverlay[0]/VCalendarPanel[0]</td> - <td>enter</td> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::Root/VOverlay[0]/VCalendarPanel[0]</td> + <td>left</td> </tr> <tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>4. isEmpty: false, isValid: true</td> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::Root/VOverlay[0]/VCalendarPanel[0]</td> + <td>enter</td> </tr> <tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> - <td>3. DateField value is now Thu Mar 15 11:46:40 EET 1973</td> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> + <td>4. isEmpty: false, isValid: true</td> </tr> <tr> - <td>assertValue</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> - <td>15.3.1973</td> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> + <td>3. DateField value is now Thu Mar 15 11:46:40 EET 1973</td> </tr> <tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> - <td>64,13</td> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> + <td>15.3.1973</td> </tr> <tr> - <td>enterCharacter</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> - <td>15.3.1973d</td> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> + <td>64,13</td> </tr> <tr> - <td>screenCapture</td> - <td></td> - <td>InvalidDateIcon</td> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> + <td>15.3.1973d</td> </tr> <tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[2]</td> - <td>208,5</td> + <td>screenCapture</td> + <td></td> + <td>InvalidDateIcon</td> </tr> <tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]</td> - <td></td> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[2]</td> + <td>208,5</td> </tr> <tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>6. isEmpty: false, isValid: false</td> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> </tr> <tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> - <td>5. DateField value is now null</td> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> + <td>6. isEmpty: false, isValid: false</td> </tr> <tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> - <td>64,10</td> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> + <td>5. DateField value is now null</td> </tr> <tr> - <td>enterCharacter</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> - <td>15.3.1973dd</td> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> + <td>64,10</td> </tr> <tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[2]</td> - <td>186,10</td> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> + <td>15.3.1973dd</td> </tr> <tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[2]</td> + <td>186,10</td> </tr> <tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>8. isEmpty: false, isValid: false</td> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> </tr> <tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> - <td>7. DateField value is now null</td> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> + <td>8. isEmpty: false, isValid: false</td> </tr> <tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> + <td>7. DateField value is now null</td> </tr> <tr> - <td>assertValue</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> - <td></td> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> </tr> <tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> + <td></td> </tr> <tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> - <td>9. DateField value is now null</td> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> </tr> <tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>10. isEmpty: true, isValid: false</td> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> + <td>9. DateField value is now null</td> </tr> <tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> + <td>10. isEmpty: true, isValid: false</td> </tr> <tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>12. isEmpty: false, isValid: true</td> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> </tr> <tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> - <td>11. DateField value is now 1990-05-04</td> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> + <td>12. isEmpty: false, isValid: true</td> </tr> <tr> - <td>assertValue</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> - <td>4.5.1990</td> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> + <td>11. DateField value is now 1990-05-04</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]/domChild[0]</td> + <td>4.5.1990</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> + <td>14. isEmpty: false, isValid: true</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> + <td>13. DateField value is now 2000-06-05</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> + <td>16. isEmpty: true, isValid: false</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> + <td>105,12</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> + <td>20. isEmpty: false, isValid: true</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> + <td>19. DateField value is now 2000-06-05</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[6]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> + <td>26. isEmpty: false, isValid: true</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> + <td>25. DateField value is now 2005-08-27</td> </tr> - </tbody></table> </body> </html> diff --git a/tests/src/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java b/tests/src/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java index cf0c4c69aa..05c1056095 100644 --- a/tests/src/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java +++ b/tests/src/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java @@ -5,15 +5,17 @@ import java.util.Locale; import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.util.ObjectProperty;
import com.vaadin.tests.components.TestBase;
import com.vaadin.tests.util.Log;
import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.DateField;
import com.vaadin.ui.Label;
import com.vaadin.ui.PopupDateField;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
+@SuppressWarnings("serial")
public class DateFieldEmptyValid extends TestBase {
private Log log;
@@ -68,6 +70,29 @@ public class DateFieldEmptyValid extends TestBase { });
addComponent(b);
+ b = new Button("Set date to 5.6.2000 using a property data source");
+ b.addListener(new ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ ObjectProperty dfProp = new ObjectProperty(new Date(
+ 2000 - 1900, 6 - 1, 5), Date.class);
+ df.setPropertyDataSource(dfProp);
+ }
+ });
+ addComponent(b);
+
+ b = new Button(
+ "Set date to 27.8.2005 by changing a property data source from null");
+ b.addListener(new ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ ObjectProperty dfProp = new ObjectProperty(null, Date.class);
+ df.setPropertyDataSource(dfProp);
+ dfProp.setValue(new Date(2005 - 1900, 8 - 1, 27));
+ }
+ });
+ addComponent(b);
+
b = new Button("Check value");
b.addListener(new ClickListener() {
|