summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-09-04 13:06:15 +0000
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-09-04 13:06:15 +0000
commit3c3e5f92dc7aa41e70055e3a241b29ea41537521 (patch)
tree85c753cd5f8341d5279f27b4d02e714f2f055207
parent5745d1e805aa6d44dd685769344c8b92b64bcd63 (diff)
downloadvaadin-framework-3c3e5f92dc7aa41e70055e3a241b29ea41537521.tar.gz
vaadin-framework-3c3e5f92dc7aa41e70055e3a241b29ea41537521.zip
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
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java8
1 files 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();
}
}