using the builder
FullCalendar calendar = FullCalendarBuilder.create().withScheduler().build();
*setSchedulerLicenseKey
// scheduler options
((Scheduler) calendar).setSchedulerLicenseKey(...);
Resource resource = new Resource(null, s, color);
calendar.addResource(resource);
// When we want to link an entry with a resource, we need to use ResourceEntry
// (a subclass of Entry)
ResourceEntry entry = new ResourceEntry(null, title, start.atStartOfDay(), start.plusDays(days).atStartOfDay(), true, true, color, "Some description...");
entry.setResource(resource);
calendar.addEntry(entry);
calendar.addEntryDroppedListener(event -> {
event.applyChangesOnEntry();
Entry entry = event.getEntry();
if(entry instanceof ResourceEntry) {
Set<Resource> resources = ((ResourceEntry) entry).getResources();
if(!resources.isEmpty()) {
// do something with the resource info
}
}
});
calendar.changeView(SchedulerView.TIMELINE_DAY);
calendar.setGroupEntriesBy(GroupEntriesBy.RESOURCE_DATE);
ResourceEntry entry = new ResourceEntry(); // ... setup entry details, including addResource()
entry.setRenderingMode(Entry.RenderingMode.BACKGROUND); calendar.addEntry(entry);
// Create a parent resource. When adding the sub resources first before adding the parent to the calendar,
// the sub resources are registered automatically on client side and server side.
Resource parent = new Resource();
parent.addChildren(new Resource(), new Resource(), new Resource());
calendar.addResource(parent); // will add the resource and also it's children to server and client
// add new resources to already registered parents
Resource child = new Resource()
parent.addChild(child);
calendar.addResource(child); // this will update the client side
// or remove them from already registered ones
calendar.removeResource(child);
parent.removeChild(child);
// activate for the client to have an entry being draggable between resources
resourceEntry.setResourceEditableOnClientSide(true);
// update the entry on the client side, if it is already added to the calendar
calendar.updateEntry(resourceEntry);