private void buildLayout() {
    this.setSizeFull();

    provider = new DetailEventProvider(calendarEvents);
    calendar = new Calendar(provider);
    calendar.setSizeFull();
    calendar.setWidth(100, Unit.PERCENTAGE);
    calendar.setHeight(100, Unit.PERCENTAGE);
    calendar.setFirstVisibleHourOfDay(8);
    calendar.setLastVisibleHourOfDay(20);
  }
示例#2
0
  @Override
  public void eventMove(MoveEvent event) {
    MyEvent calendarEvent = (MyEvent) event.getCalendarEvent();
    Calendar cal = event.getComponent();
    cal.removeEvent(calendarEvent);
    Date oldStart = calendarEvent.getStart();
    Date oldEnd = calendarEvent.getEnd();
    long duration = oldEnd.getTime() - oldStart.getTime();

    Date newStart = event.getNewStart();
    calendarEvent.setStart(newStart);
    Date newEnd = new Date(newStart.getTime() + duration);
    calendarEvent.setEnd(newEnd);
    cal.addEvent(calendarEvent);
  }
 private void initDummyHandlers() {
   calendar.setHandler(
       new DateClickHandler() {
         @Override
         public void dateClick(DateClickEvent event) {}
       });
 }
 @Override
 public void updateTranslations() {
   calendar.setLocale(UI.getCurrent().getLocale());
 }
 @Override
 public void setEventClickHandler(EventClickHandler eventClickHandler) {
   calendar.setHandler(eventClickHandler);
 }