displayedMonth = new Date(value.getYear(), value.getMonth(), 1);
}
- // Re-render calendar if month or year of focused date has changed
- if (oldDisplayedMonth == null || value == null
+ // Re-render calendar if the displayed month is changed,
+ // or if a time selector is needed but does not exist.
+ if ((isTimeSelectorNeeded() && time == null)
+ || oldDisplayedMonth == null || value == null
|| oldDisplayedMonth.getYear() != value.getYear()
|| oldDisplayedMonth.getMonth() != value.getMonth()) {
renderCalendar();
} else {
focusDay(focusedDate);
selectFocused();
+ if (isTimeSelectorNeeded()) {
+ time.updateTimes();
+ }
}
if (!hasFocus) {
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8888/" />
+<title>PopupDateFieldPopup</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">PopupDateFieldPopup</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.datefield.PopupDateFieldPopup?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldPopup::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#field</td>
+ <td>74,9</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldPopup::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#field</td>
+ <td>right</td>
+</tr>
+<tr>
+ <td>enterCharacter</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldPopup::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#field</td>
+ <td>1/1/00 01:10:01 AM</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldPopup::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#field</td>
+ <td>enter</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldPopup::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton</td>
+ <td>11,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldPopup::/VVerticalLayout[0]/domChild[0]/domChild[1]</td>
+ <td>85,81</td>
+</tr>
+<tr>
+ <td>enterCharacter</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldPopup::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#field</td>
+ <td>1/1/00 01:20:01 AM</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldPopup::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#field</td>
+ <td>enter</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldPopup::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton</td>
+ <td>16,14</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldPopup::Root/VOverlay[0]/VCalendarPanel[0]#m</td>
+ <td>20</td>
+</tr>
+</tbody></table>
+</body>
+</html>
--- /dev/null
+package com.vaadin.tests.components.datefield;
+
+import java.util.Calendar;
+import java.util.Locale;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.PopupDateField;
+
+public class PopupDateFieldPopup extends TestBase {
+
+ @Override
+ protected void setup() {
+ // Set a specific time for the PopupDateField
+ Calendar cal = Calendar.getInstance();
+ cal.set(Calendar.YEAR, 2000);
+ cal.set(Calendar.DAY_OF_YEAR, 1);
+ cal.set(Calendar.HOUR_OF_DAY, 1);
+ cal.set(Calendar.MINUTE, 1);
+ cal.set(Calendar.SECOND, 1);
+ cal.set(Calendar.MILLISECOND, 1);
+
+ PopupDateField pdf = new PopupDateField();
+ pdf.setLocale(Locale.US);
+ pdf.setValue(cal.getTime());
+ pdf.setImmediate(true);
+ pdf.setResolution(DateField.RESOLUTION_SEC);
+ addComponent(pdf);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Changing the minute, second and millisecond parts should also result in an update of the PopupDateField popup contents.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8391;
+ }
+
+}
\ No newline at end of file