Sfoglia il codice sorgente

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
tags/7.0.0.beta1
Johannes Dahlström 11 anni fa
parent
commit
3c3e5f92dc

+ 6
- 2
src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java Vedi File

@@ -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();
}
}

Loading…
Annulla
Salva