From 3c3e5f92dc7aa41e70055e3a241b29ea41537521 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Tue, 4 Sep 2012 13:06:15 +0000 Subject: Bugfix: year change when navigating a DateField calendar with arrow keys left the calendar in inconsistent state (#8931) svn changeset:24303/svn branch:6.8 --- src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java index fc73443bb9..b5a4ee2477 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java @@ -119,7 +119,8 @@ public class VCalendarPanel extends FocusableFlexTable implements */ public void onClick(ClickEvent event) { Date newDate = ((Day) event.getSource()).getDate(); - if (newDate.getMonth() != displayedMonth.getMonth()) { + if (newDate.getMonth() != displayedMonth.getMonth() + || newDate.getYear() != displayedMonth.getYear()) { // If an off-month date was clicked, we must change the // displayed month and re-render the calendar (#8931) displayedMonth.setMonth(newDate.getMonth()); @@ -595,14 +596,17 @@ public class VCalendarPanel extends FocusableFlexTable implements */ private void focusNextDay(int days) { int oldMonth = focusedDate.getMonth(); + int oldYear = focusedDate.getYear(); focusedDate.setDate(focusedDate.getDate() + days); - if (focusedDate.getMonth() == oldMonth) { + if (focusedDate.getMonth() == oldMonth + && focusedDate.getYear() == oldYear) { // Month did not change, only move the selection focusDay(focusedDate); } else { // If the month changed we need to re-render the calendar displayedMonth.setMonth(focusedDate.getMonth()); + displayedMonth.setYear(focusedDate.getYear()); renderCalendar(); } } -- cgit v1.2.3