]> source.dussan.org Git - vaadin-framework.git/commitdiff
[Merge from 6.7] #8391 PopupDateField does not update the HH-MM-SS dropdown
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Wed, 14 Mar 2012 12:01:24 +0000 (12:01 +0000)
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Wed, 14 Mar 2012 12:01:24 +0000 (12:01 +0000)
svn changeset:23236/svn branch:6.8

src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java
tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldPopup.html [new file with mode: 0644]
tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldPopup.java [new file with mode: 0644]

index 867e49c18197dbf1980b3b52391906274b17064b..845ac837f65dcd29ded0371aeea7573744ec245b 100644 (file)
@@ -1195,14 +1195,19 @@ public class VCalendarPanel extends FocusableFlexTable implements
             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) {
diff --git a/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldPopup.html b/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldPopup.html
new file mode 100644 (file)
index 0000000..993d053
--- /dev/null
@@ -0,0 +1,71 @@
+<?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>
diff --git a/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldPopup.java b/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldPopup.java
new file mode 100644 (file)
index 0000000..5a6f651
--- /dev/null
@@ -0,0 +1,41 @@
+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