summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-09-03 15:13:11 +0000
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-09-03 15:13:11 +0000
commitffb36a03ad29fc947fd65e50eda75fcba5a88517 (patch)
tree86a723e44aa9b945c98f11ace95e5d8d8c4b966e
parentc75cf3956abddcf71ec72e0743eae1cdd52aa661 (diff)
downloadvaadin-framework-ffb36a03ad29fc947fd65e50eda75fcba5a88517.tar.gz
vaadin-framework-ffb36a03ad29fc947fd65e50eda75fcba5a88517.zip
Make clicking off-month days work correctly with an InlineDateField (#8931)
svn changeset:24290/svn branch:6.8
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java
index 845ac837f6..fc73443bb9 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java
@@ -118,8 +118,15 @@ public class VCalendarPanel extends FocusableFlexTable implements
* .event.dom.client.ClickEvent)
*/
public void onClick(ClickEvent event) {
- Day day = (Day) event.getSource();
- focusDay(day.getDate());
+ Date newDate = ((Day) event.getSource()).getDate();
+ if (newDate.getMonth() != displayedMonth.getMonth()) {
+ // If an off-month date was clicked, we must change the
+ // displayed month and re-render the calendar (#8931)
+ displayedMonth.setMonth(newDate.getMonth());
+ displayedMonth.setYear(newDate.getYear());
+ renderCalendar();
+ }
+ focusDay(newDate);
selectFocused();
onSubmit();
}
@@ -386,8 +393,8 @@ public class VCalendarPanel extends FocusableFlexTable implements
}
final String monthName = needsMonth ? getDateTimeService().getMonth(
- focusedDate.getMonth()) : "";
- final int year = focusedDate.getYear() + 1900;
+ displayedMonth.getMonth()) : "";
+ final int year = displayedMonth.getYear() + 1900;
getFlexCellFormatter().setStyleName(0, 2,
VDateField.CLASSNAME + "-calendarpanel-month");
setHTML(0, 2, "<span class=\"" + VDateField.CLASSNAME