Java 类com.google.gwt.event.logical.shared.ShowRangeEvent 实例源码

项目:touchkit    文件:CalendarOverlay.java   
@Override
public void onShowRange(ShowRangeEvent<Date> event) {

    // Verify min and max values
    Date startDay = justDay(event.getStart());
    Date endDay = justDay(event.getEnd());
    Date currentMonth = justMonth(calendarWidget.getCurrentMonth());
    if (min != null) {
        if (currentMonth.before(justMonth(min))) {
            calendarWidget.setCurrentMonth(min);
            return;
        }
        Date minDay = justDay(min);
        if (endDay.before(minDay)) {
            calendarWidget.setCurrentMonth(minDay);
            return;
        }
    }
    if (max != null) {
        if (currentMonth.after(justMonth(max))) {
            calendarWidget.setCurrentMonth(max);
            return;
        }
        Date maxDay = justDay(max);
        if (startDay.after(maxDay)) {
            calendarWidget.setCurrentMonth(maxDay);
            return;
        }
    }

    // Disable all dates that are in current view but are out of scope
    disableDaysNotInCurrentMonth(startDay, endDay);

    // Now update browsing button enable state
    updatePrevNextButtons();
}