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

项目:platform-sample-timesheets    文件:CalendarScreen.java   
@Override
public Action[] getActions(Object target, Object sender) {
    // The target should be a CalendarDateRage for the
    // entire day from midnight to midnight.
    if (!(target instanceof CalendarDateRange))
        return null;
    CalendarDateRange dateRange = (CalendarDateRange) target;

    // The sender is the Calendar object
    if (!(sender instanceof Calendar))
        return null;
    Calendar calendar = (Calendar) sender;

    // List all the events on the requested day
    List<CalendarEvent> events = calendar.getEvents(dateRange.getStart(), dateRange.getEnd());

    if (events.size() == 0)
        return new Action[]{addEventAction};
    else
        return new Action[]{addEventAction, copyEventAction, deleteEventAction};
}
项目:imotSpot    文件:ScheduleView.java   
@Override
public List<CalendarEvent> getEvents(final Date startDate,
        final Date endDate) {
    // Transactions are dynamically fetched from the backend service
    // when needed.
    Collection<Transaction> transactions = DashboardUI
            .getDataProvider().getTransactionsBetween(startDate,
                    endDate);
    List<CalendarEvent> result = new ArrayList<CalendarEvent>();
    for (Transaction transaction : transactions) {
        Movie movie = DashboardUI.getDataProvider().getMovie(
                transaction.getMovieId());
        Date end = new Date(transaction.getTime().getTime()
                + movie.getDuration() * 60 * 1000);
        result.add(new MovieEvent(transaction.getTime(), end, movie));
    }
    return result;
}
项目:vaadin-vertx-samples    文件:ScheduleView.java   
@Override
public List<CalendarEvent> getEvents(final Date startDate,
        final Date endDate) {
    // Transactions are dynamically fetched from the backend service
    // when needed.
    Collection<Transaction> transactions = DashboardUI
            .getDataProvider().getTransactionsBetween(startDate,
                    endDate);
    List<CalendarEvent> result = new ArrayList<CalendarEvent>();
    for (Transaction transaction : transactions) {
        Movie movie = DashboardUI.getDataProvider().getMovie(
                transaction.getMovieId());
        Date end = new Date(transaction.getTime().getTime()
                + movie.getDuration() * 60 * 1000);
        result.add(new MovieEvent(transaction.getTime(), end, movie));
    }
    return result;
}
项目:sample-timesheets    文件:CalendarScreen.java   
@Override
public Action[] getActions(Object target, Object sender) {
    // The target should be a CalendarDateRage for the
    // entire day from midnight to midnight.
    if (!(target instanceof CalendarDateRange))
        return null;
    CalendarDateRange dateRange = (CalendarDateRange) target;

    // The sender is the Calendar object
    if (!(sender instanceof Calendar))
        return null;
    Calendar calendar = (Calendar) sender;

    // List all the events on the requested day
    List<CalendarEvent> events = calendar.getEvents(dateRange.getStart(), dateRange.getEnd());

    if (events.size() == 0)
        return new Action[]{addEventAction};
    else
        return new Action[]{addEventAction, copyEventAction, deleteEventAction};
}
项目:sample-timesheets    文件:TimeSheetsCalendarEventProvider.java   
@Nullable
protected TimeEntryCalendarEventAdapter findEventWithTimeEntry(TimeEntry timeEntry) {
    for (CalendarEvent event : eventList) {
        if (event instanceof TimeEntryCalendarEventAdapter) {
            TimeEntryCalendarEventAdapter adapter = (TimeEntryCalendarEventAdapter) event;
            if (timeEntry.getId().equals(adapter.getTimeEntry().getId())) {
                return adapter;
            }
        }
    }
    return null;
}
项目:sample-timesheets    文件:TimeSheetsCalendarEventProvider.java   
@Nullable
protected HolidayCalendarEventAdapter findEventWithHoliday(Holiday holiday) {
    for (CalendarEvent event : eventList) {
        if (event instanceof HolidayCalendarEventAdapter) {
            HolidayCalendarEventAdapter adapter = (HolidayCalendarEventAdapter) event;
            if (holiday.getId().equals(adapter.getHoliday().getId())) {
                return adapter;
            }
        }
    }
    return null;
}
项目:sample-timesheets    文件:TimeSheetsCalendarEventProvider.java   
public void addEvents(Collection<CalendarEvent> events) {
    eventList.addAll(events);
    for (CalendarEvent event : events) {
        if (event instanceof BasicEvent) {
            ((BasicEvent) event).addEventChangeListener(this);
        }
    }
    fireEventSetChange();
}
项目:cuba    文件:CalendarEventProviderWrapper.java   
@Override
public List<CalendarEvent> getEvents(Date startDate, Date endDate) {
    if (itemsCache.isEmpty()) {
        for (com.haulmont.cuba.gui.components.calendar.CalendarEvent calendarEvent : calendarEventProvider.getEvents()) {
            CalendarEventWrapper calendarEventWrapper = new CalendarEventWrapper(calendarEvent);
            itemsCache.add(calendarEventWrapper);
        }

        return itemsCache;
    } else {
        return itemsCache;
    }
}
项目:platform-sample-timesheets    文件:TimeSheetsCalendarEventProvider.java   
@Nullable
protected TimeEntryCalendarEventAdapter findEventWithTimeEntry(TimeEntry timeEntry) {
    for (CalendarEvent event : eventList) {
        if (event instanceof TimeEntryCalendarEventAdapter) {
            TimeEntryCalendarEventAdapter adapter = (TimeEntryCalendarEventAdapter) event;
            if (timeEntry.getId().equals(adapter.getTimeEntry().getId())) {
                return adapter;
            }
        }
    }
    return null;
}
项目:platform-sample-timesheets    文件:TimeSheetsCalendarEventProvider.java   
@Nullable
protected HolidayCalendarEventAdapter findEventWithHoliday(Holiday holiday) {
    for (CalendarEvent event : eventList) {
        if (event instanceof HolidayCalendarEventAdapter) {
            HolidayCalendarEventAdapter adapter = (HolidayCalendarEventAdapter) event;
            if (holiday.getId().equals(adapter.getHoliday().getId())) {
                return adapter;
            }
        }
    }
    return null;
}
项目:platform-sample-timesheets    文件:TimeSheetsCalendarEventProvider.java   
public void addEvents(Collection<CalendarEvent> events) {
    eventList.addAll(events);
    for (CalendarEvent event : events) {
        if (event instanceof BasicEvent) {
            ((BasicEvent) event).addEventChangeListener(this);
        }
    }
    fireEventSetChange();
}
项目:scoutmaster    文件:ScoutsContainerEventProvider.java   
@Override
public void addEvent(final CalendarEvent event)
{
    final au.org.scoutmaster.domain.Event entity = new au.org.scoutmaster.domain.Event(event.getCaption(),
            event.getDescription(), event.getStart(), event.getEnd(), event.getStyleName());
    this.container.addEntity(entity);
}
项目:scoutmaster    文件:ScoutsContainerEventProvider.java   
@Override
public List<CalendarEvent> getEvents(final Date startDate, final Date endDate)
{
    final EventDao daoEvent = new DaoFactory().getDao(EventDao.class);
    final List<Event> entries = daoEvent.findBetween(startDate, endDate);

    // Wrap Events as CalendarEvents for the view
    final ArrayList<CalendarEvent> arrayList = new ArrayList<CalendarEvent>();
    for (final Event event : entries)
    {
        final ScoutCalEvent scoutEvent = new ScoutCalEvent(event);
        scoutEvent.addEventChangeListener(this);
        arrayList.add(scoutEvent);

        if (event.getColor() != null)
        {
            // Inject the color style required by each event into the page
            final Styles styles = Page.getCurrent().getStyles();

            // Inject the style. We Use the colour name as the css name
            // (sans
            // the leading #
            styles.add(".v-calendar-event-" + event.getColor().getCSS().substring(1) + " { background-color:"
                    + event.getColor().getCSS() + "; }");
        }
    }

    return arrayList;
}
项目:cuba    文件:CalendarEventProviderWrapper.java   
@Override
public void addEvent(CalendarEvent event) {
    throw new UnsupportedOperationException("Wrapper does not support direct access");
}
项目:cuba    文件:CalendarEventProviderWrapper.java   
@Override
public void removeEvent(CalendarEvent event) {
    throw new UnsupportedOperationException("Wrapper does not support direct access");
}
项目:mycollab    文件:ActivityEventProvider.java   
@SuppressWarnings("unchecked")
@Override
public List<CalendarEvent> getEvents(Date startDate, Date endDate) {
    List<CalendarEvent> events = new ArrayList<>();

    MeetingSearchCriteria searchCriteria = new MeetingSearchCriteria();
    searchCriteria.setStartDate(new DateTimeSearchField(SearchField.AND, DateTimeSearchField.GREATER_THAN_EQUAL, startDate, null));
    searchCriteria.setEndDate(new DateTimeSearchField(SearchField.AND, DateTimeSearchField.LESS_THAN_EQUAL, endDate, null));

    LOG.debug("Get event from: " + startDate + " to " + endDate);
    List<SimpleMeeting> crmEvents = (List<SimpleMeeting>) meetingService.findPageableListByCriteria(new BasicSearchRequest<>(
            searchCriteria, 0, Integer.MAX_VALUE));
    LOG.debug("There are " + crmEvents.size() + " event from " + startDate + " to " + endDate);

    filterListEventRecurringActivity(crmEvents, startDate, endDate);

    if (!CollectionUtils.isEmpty(crmEvents)) {
        for (SimpleMeeting crmEvent : crmEvents) {
            if (crmEvent.getStartdate() == null || crmEvent.getEnddate() == null) {
            } else {
                CrmEvent event = new CrmEvent();
                event.setCaption(crmEvent.getSubject());

                StringBuffer statusStr = new StringBuffer("");
                statusStr.append("<span>");
                event.setStart(crmEvent.getStartdate());
                event.setEnd(crmEvent.getEnddate());
                event.setSource(crmEvent);
                if (crmEvent.getStatus() != null) {
                    if ("Held".equals(crmEvent.getStatus())) {
                        event.setStyleName("eventcomplete");
                    } else if ("Planned".equals(crmEvent.getStatus())) {
                        event.setStyleName("eventfuture");
                    } else if ("Not Held".equals(crmEvent.getStatus())) {
                        if (crmEvent.getEnddate() != null) {
                            if (crmEvent.getEnddate().compareTo(new Date()) == 0) {
                                event.setStyleName("eventoverdue");
                            } else if (crmEvent.getEnddate().compareTo(new Date()) > 0) {
                                event.setStyleName("eventfuture");
                            } else {
                                event.setStyleName("eventoverdue");
                            }
                        }
                    }

                } else {
                    event.setStyleName("eventfuture");
                }
                if (crmEvent.getStatus() != null) {
                    statusStr.append(crmEvent.getStatus());
                } else {
                    statusStr.append("");
                }
                statusStr.append("</span>");
                String crmEventDes = (crmEvent.getDescription() != null) ? crmEvent.getDescription() : "";
                String desTooltip = String
                        .format("<h3>%s</h3><table style=\"padding-left:10px; width:350px; color: #5a5a5a;\"<tr><td style=\"font-weight:bold; width:70px;\">Start Date:</td><td>%s</td></tr><td style=\"font-weight:bold; width:70px;\">End Date: </td><td>%s</td><tr><tr><td style=\"font-weight:bold; width:70px;\">Status:</td><td>%s</td></tr><tr><td style=\"text-align: right; vertical-align: top; font-weight:bold; width:70px;\">Description:</td><td style=\"word-wrap: break-word; white-space: normal;\">%s</td></tr></table>",
                                crmEvent.getSubject(), UserUIContext.formatDateTime(crmEvent.getStartdate()),
                                UserUIContext.formatDateTime(crmEvent.getEnddate()), statusStr.toString(), crmEventDes);
                event.setDescription(desTooltip);
                events.add(event);
            }
        }
    }

    return events;
}