use of org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem in project scout.rt by eclipse.
the class AbstractCalendarItemProvider method getItems.
@Override
public Set<ICalendarItem> getItems(Date minDate, Date maxDate) {
ensureItemsLoadedInternal(minDate, maxDate);
Set<ICalendarItem> allItems = propertySupport.getPropertySet(PROP_ITEMS);
if (CollectionUtility.hasElements(allItems)) {
Set<ICalendarItem> list = new HashSet<ICalendarItem>(allItems.size());
for (ICalendarItem item : allItems) {
if (item.isIntersecting(minDate, maxDate)) {
list.add(item);
}
}
return list;
}
return CollectionUtility.hashSet();
}
use of org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem in project scout.rt by eclipse.
the class AbstractCalendar method updateComponentsInternal.
private void updateComponentsInternal(List<ICalendarItemProvider> changedProviders) {
Range<Date> d = getViewRange();
if (d.getFrom() != null && d.getTo() != null) {
for (ICalendarItemProvider p : changedProviders) {
LinkedList<CalendarComponent> components = new LinkedList<CalendarComponent>();
for (ICalendarItem item : p.getItems(d.getFrom(), d.getTo())) {
components.add(new CalendarComponent(this, p, item));
}
m_componentsByProvider.put(p.getClass(), components);
}
// filter and resolve item conflicts
Set<Class<? extends ICalendarItemProvider>> providerTypes = new HashSet<Class<? extends ICalendarItemProvider>>(changedProviders.size());
for (ICalendarItemProvider provider : changedProviders) {
providerTypes.add(provider.getClass());
}
interceptFilterCalendarItems(providerTypes, m_componentsByProvider);
// complete list
TreeMap<CompositeObject, CalendarComponent> sortMap = new TreeMap<CompositeObject, CalendarComponent>();
int index = 0;
for (Collection<CalendarComponent> c : m_componentsByProvider.values()) {
for (CalendarComponent comp : c) {
sortMap.put(new CompositeObject(comp.getFromDate(), index++), comp);
}
}
propertySupport.setPropertySet(PROP_COMPONENTS, CollectionUtility.hashSet(sortMap.values()));
// validate selection
setSelectedComponent(getSelectedComponent());
}
}
Aggregations