Java 类com.vaadin.ui.components.calendar.CalendarComponentEvents 实例源码

项目:cuba    文件:WebCalendar.java   
@Override
public void addDateClickListener(CalendarDateClickListener listener) {
    getEventRouter().addListener(CalendarDateClickListener.class, listener);

    component.setHandler(new CalendarComponentEvents.DateClickHandler() {
        @Override
        public void dateClick(CalendarComponentEvents.DateClickEvent event) {
            CalendarDateClickEvent calendarDateClickEvent =
                    new CalendarDateClickEvent(WebCalendar.this, event.getDate());
            getEventRouter().fireEvent(
                    CalendarDateClickListener.class,
                    CalendarDateClickListener::dateClick,
                    calendarDateClickEvent);
        }
    });
}
项目:cuba    文件:WebCalendar.java   
@Override
public void addEventMoveListener(CalendarEventMoveListener listener) {
    getEventRouter().addListener(CalendarEventMoveListener.class, listener);

    component.setHandler(new CalendarComponentEvents.EventMoveHandler() {
        @Override
        public void eventMove(CalendarComponentEvents.MoveEvent event) {
            com.vaadin.ui.components.calendar.event.CalendarEvent calendarEvent = event.getCalendarEvent();
            CalendarEvent calendarEventWrapper = ((CalendarEventWrapper) calendarEvent).getCalendarEvent();

            CalendarEventMoveEvent calendarEventMoveEvent = new CalendarEventMoveEvent(
                    WebCalendar.this,
                    calendarEventWrapper,
                    event.getNewStart());
            getEventRouter().fireEvent(
                    CalendarEventMoveListener.class,
                    CalendarEventMoveListener::eventMove,
                    calendarEventMoveEvent);
        }
    });
}
项目:cuba    文件:WebCalendar.java   
@Override
public void addWeekClickListener(CalendarWeekClickListener listener) {
    getEventRouter().addListener(CalendarWeekClickListener.class, listener);

    component.setHandler(new CalendarComponentEvents.WeekClickHandler() {
        @Override
        public void weekClick(CalendarComponentEvents.WeekClick event) {
            CalendarWeekClickEvent calendarWeekClickEvent = new CalendarWeekClickEvent(
                    WebCalendar.this,
                    event.getWeek(),
                    event.getYear());
            getEventRouter().fireEvent(
                    CalendarWeekClickListener.class,
                    CalendarWeekClickListener::weekClick,
                    calendarWeekClickEvent);
        }
    });
}
项目:cuba    文件:WebCalendar.java   
@Override
public void addForwardClickListener(CalendarForwardClickListener listener) {
    getEventRouter().addListener(CalendarForwardClickListener.class, listener);

    component.setHandler(new CalendarComponentEvents.ForwardHandler() {
        @Override
        public void forward(CalendarComponentEvents.ForwardEvent event) {
            CalendarForwardClickEvent calendarForwardClickEvent =
                    new CalendarForwardClickEvent(WebCalendar.this);
            getEventRouter().fireEvent(
                    CalendarForwardClickListener.class,
                    CalendarForwardClickListener::forwardClick,
                    calendarForwardClickEvent);
        }
    });
}
项目:cuba    文件:WebCalendar.java   
@Override
public void addBackwardClickListener(CalendarBackwardClickListener listener) {
    getEventRouter().addListener(CalendarBackwardClickListener.class, listener);

    component.setHandler(new CalendarComponentEvents.BackwardHandler() {
        @Override
        public void backward(CalendarComponentEvents.BackwardEvent event) {
            CalendarBackwardClickEvent calendarBackwardClickEvent =
                    new CalendarBackwardClickEvent(WebCalendar.this);
            getEventRouter().fireEvent(
                    CalendarBackwardClickListener.class,
                    CalendarBackwardClickListener::backwardClick,
                    calendarBackwardClickEvent);
        }
    });
}
项目:cuba    文件:WebCalendar.java   
@Override
public void addRangeSelectListener(CalendarRangeSelectListener listener) {
    getEventRouter().addListener(CalendarRangeSelectListener.class, listener);

    component.setHandler(new CalendarComponentEvents.RangeSelectHandler() {
        @Override
        public void rangeSelect(CalendarComponentEvents.RangeSelectEvent event) {
            CalendarRangeSelectEvent calendarRangeSelectEvent = new CalendarRangeSelectEvent(
                    WebCalendar.this,
                    event.getStart(),
                    event.getEnd());
            getEventRouter().fireEvent(
                    CalendarRangeSelectListener.class,
                    CalendarRangeSelectListener::rangeSelect,
                    calendarRangeSelectEvent);
        }
    });
}
项目:cuba    文件:WebCalendar.java   
@Override
public void removeDateClickListener(CalendarDateClickListener listener) {
    getEventRouter().removeListener(CalendarDateClickListener.class, listener);

    if (!getEventRouter().hasListeners(CalendarDateClickListener.class)) {
        component.setHandler((CalendarComponentEvents.DateClickHandler) null);
    }
}
项目:cuba    文件:WebCalendar.java   
@Override
public void addEventClickListener(CalendarEventClickListener listener) {
    getEventRouter().addListener(CalendarEventClickListener.class, listener);

    component.setHandler(new CalendarComponentEvents.EventClickHandler() {
        @Override
        public void eventClick(CalendarComponentEvents.EventClick event) {
            com.vaadin.ui.components.calendar.event.CalendarEvent calendarEvent = event.getCalendarEvent();
            if (calendarEvent instanceof CalendarEventWrapper) {
                CalendarEvent calendarEventWrapper = ((CalendarEventWrapper) calendarEvent).getCalendarEvent();
                Entity entity = null;
                if (calendarEventWrapper instanceof EntityCalendarEvent) {
                    entity = ((EntityCalendarEvent) ((CalendarEventWrapper) calendarEvent)
                            .getCalendarEvent())
                            .getEntity();
                }

                CalendarEventClickEvent calendarEventClickEvent = new CalendarEventClickEvent(
                        WebCalendar.this,
                        calendarEventWrapper,
                        entity);
                getEventRouter().fireEvent(
                        CalendarEventClickListener.class,
                        CalendarEventClickListener::eventClick,
                        calendarEventClickEvent);
            }
        }
    });
}
项目:cuba    文件:WebCalendar.java   
@Override
public void removeEventClickListener(CalendarEventClickListener listener) {
    getEventRouter().removeListener(CalendarEventClickListener.class, listener);

    if (!getEventRouter().hasListeners(CalendarEventClickListener.class)) {
        component.setHandler((CalendarComponentEvents.EventClickHandler) null);
    }
}
项目:cuba    文件:WebCalendar.java   
@Override
public void addEventResizeListener(CalendarEventResizeListener listener) {
    getEventRouter().addListener(CalendarEventResizeListener.class, listener);

    component.setHandler(new CalendarComponentEvents.EventResizeHandler() {
        @Override
        public void eventResize(CalendarComponentEvents.EventResize event) {
            com.vaadin.ui.components.calendar.event.CalendarEvent calendarEvent = event.getCalendarEvent();
            if (calendarEvent instanceof CalendarEventWrapper) {
                CalendarEvent calendarEventWrapper = ((CalendarEventWrapper) calendarEvent).getCalendarEvent();
                Entity entity = null;
                if (calendarEventWrapper instanceof EntityCalendarEvent) {
                    entity = ((EntityCalendarEvent) ((CalendarEventWrapper) calendarEvent)
                            .getCalendarEvent())
                            .getEntity();
                }

                CalendarEventResizeEvent calendarEventResizeEvent = new CalendarEventResizeEvent(
                        WebCalendar.this,
                        ((CalendarEventWrapper) calendarEvent).getCalendarEvent(),
                        event.getNewStart(),
                        event.getNewEnd(),
                        entity);
                getEventRouter().fireEvent(
                        CalendarEventResizeListener.class,
                        CalendarEventResizeListener::eventResize,
                        calendarEventResizeEvent);
            }
        }
    });
}
项目:cuba    文件:WebCalendar.java   
@Override
public void removeEventResizeListener(CalendarEventResizeListener listener) {
    getEventRouter().removeListener(CalendarEventResizeListener.class, listener);

    if (!getEventRouter().hasListeners(CalendarEventResizeListener.class)) {
        component.setHandler((CalendarComponentEvents.EventResizeHandler) null);
    }
}
项目:cuba    文件:WebCalendar.java   
@Override
public void removeEventMoveListener(CalendarEventMoveListener listener) {
    getEventRouter().removeListener(CalendarEventMoveListener.class, listener);

    if (!getEventRouter().hasListeners(CalendarEventMoveListener.class)) {
        component.setHandler((CalendarComponentEvents.EventMoveHandler) null);
    }
}
项目:cuba    文件:WebCalendar.java   
@Override
public void removeWeekClickListener(CalendarWeekClickListener listener) {
    getEventRouter().removeListener(CalendarWeekClickListener.class, listener);

    if (!getEventRouter().hasListeners(CalendarWeekClickListener.class)) {
        component.setHandler((CalendarComponentEvents.WeekClickHandler) null);
    }
}
项目:cuba    文件:WebCalendar.java   
@Override
public void removeForwardClickListener(CalendarForwardClickListener listener) {
    getEventRouter().removeListener(CalendarForwardClickListener.class, listener);

    if (!getEventRouter().hasListeners(CalendarForwardClickListener.class)) {
        component.setHandler((CalendarComponentEvents.ForwardHandler) null);
    }
}
项目:cuba    文件:WebCalendar.java   
@Override
public void removeBackwardClickListener(CalendarBackwardClickListener listener) {
    getEventRouter().removeListener(CalendarBackwardClickListener.class, listener);

    if (!getEventRouter().hasListeners(CalendarBackwardClickListener.class)) {
        component.setHandler((CalendarComponentEvents.BackwardHandler) null);
    }
}
项目:cuba    文件:WebCalendar.java   
@Override
public void removeRangeSelectListener(CalendarRangeSelectListener listener) {
    getEventRouter().removeListener(CalendarRangeSelectListener.class, listener);

    if (!getEventRouter().hasListeners(CalendarRangeSelectListener.class)) {
        component.setHandler((CalendarComponentEvents.RangeSelectHandler) null);
    }
}