private void disableDaysNotInCurrentMonth(Date startDay, Date endDay) { List<Date> disableDates = new LinkedList<Date>(); Date firstDayOfMonth = firstDayOfMonth(calendarWidget .getCurrentMonth()); Date lastDayOfMonth = lastDayOfMonth(calendarWidget .getCurrentMonth()); Date dayAfterEnd = (Date) endDay.clone(); CalendarUtil.addDaysToDate(dayAfterEnd, 1); for (Date day = startDay; day.before(dayAfterEnd); CalendarUtil .addDaysToDate(day, 1)) { if (day.before(firstDayOfMonth) || day.after(lastDayOfMonth)) { disableDates.add((Date) day.clone()); } } if (!disableDates.isEmpty()) { calendarWidget.setTransientEnabledOnDates(false, disableDates); } }
/*************************************** * Returns the date of the month that is currently displayed by the date * picker of this instance. * * @return The date of the selected month */ public Date getMonth() { return getDateWidget().getDatePicker().getCurrentMonth(); }
private void updatePrevNextButtons() { Date currentMonth; currentMonth = justMonth(calendarWidget.getCurrentMonth()); if (min != null) { setPrevButtonEnabled(currentMonth.after(min)); } else { setPrevButtonEnabled(true); } if (max != null) { setNextButtonEnabled(currentMonth.before(max)); } else { setNextButtonEnabled(true); } }
@Override public void onClick(ClickEvent event) { if (event.getSource() == okButton) { Date value = calendarWidget.getValue(); if (resolution == Resolution.MONTH) { value = calendarWidget.getCurrentMonth(); } else if (resolution == Resolution.TIME) { value = trySetTimeFromTimeBoxText(value); } ValueChangeEvent.fire(CalendarOverlay.this, value); this.hide(); } else if (event.getSource() == cancelButton) { this.hide(false); } }
Date currentMonth = justMonth(calendarWidget.getCurrentMonth()); if (min != null) { if (currentMonth.before(justMonth(min))) {