List of usage examples for org.joda.time YearMonth YearMonth
YearMonth(YearMonth partial, Chronology chrono)
From source file:org.vaadin.addons.tuningdatefield.TuningDateField.java
License:Apache License
private YearMonth getSelectedMonth(int monthOfYear) { return new YearMonth(yearDisplayed, monthOfYear); }
From source file:org.vaadin.addons.tuningdatefield.TuningDateField.java
License:Apache License
/** * Called when user clicked on cell item * /* w ww . ja va2s . c o m*/ * @param itemIndex * the item index * @param relativeDateIndex * is dayOfMonth in day resolution, monthOfYear in month resolution, year in year resolution * @param mouseDetails * the mouse details info */ protected void onCalendarItemClicked(int itemIndex, int relativeDateIndex, MouseEventDetails mouseDetails) { if (calendarResolution.equals(CalendarResolution.DAY)) { if (isDateEnabled(getSelectedDate(relativeDateIndex))) { // We check the date is not disabled LocalDate selectedDate = getSelectedDate(relativeDateIndex); fireEvent(new DayClickEvent(this, mouseDetails, selectedDate)); setConvertedValue(selectedDate); // Should now close the calendar calendarOpen = false; } } else if (calendarResolution.equals(CalendarResolution.MONTH)) { if (isMonthEnabled(getSelectedMonth(relativeDateIndex))) { YearMonth selectedMonth = getSelectedMonth(relativeDateIndex); setYearMonthDisplayed(selectedMonth); setCalendarResolution(CalendarResolution.DAY); fireEvent(new ResolutionChangeEvent(this, Resolution.DAY)); fireEvent(new MonthChangeEvent(this, selectedMonth)); } } else if (calendarResolution.equals(CalendarResolution.YEAR)) { if (isYearEnabled(relativeDateIndex)) { setYearMonthDisplayed(new YearMonth(relativeDateIndex, getYearMonthDisplayed().getMonthOfYear())); setCalendarResolution(CalendarResolution.MONTH); fireEvent(new ResolutionChangeEvent(this, Resolution.MONTH)); } } }