I have a dummy web page with a Vaadin Calendar component and a button.
If onButton click this code
calendar.addEvent(createEvent());
Event is added.
If I’m setting the EventProvider, the event is not represented in the Calendar
calendar.setEventProvider(new CalendarEventProvider() { @Override
public List getEvents(Date startDate, Date endDate) {
List events= new ArrayList();
events.add(createEvent());
return events;
}
});
Should I call some update method of the Calendar after setting the provider?
The issue is that I was using it wrong. You have to implement EventSetChangeNotifier for your EventProvider.
So the better way is not to use CalendarEventProvider, but to use a BasicEventProvider. BaicicEventProvider class, already implements EventSEtChangeNotifier. So my example code will look like this