Calendar Event Provider

I have a dummy web page with a Vaadin Calendar component and a button.
If onButton click this code
Event is added.

If I’m setting the EventProvider, the event is not represented in the Calendar
calendar.setEventProvider(new CalendarEventProvider() {
public List getEvents(Date startDate, Date endDate) {
List events= new ArrayList();
return events;

Should I call some update method of the Calendar after setting the provider?

If the createEvent() creates some random example events, note that the events must be ordered by time, if I remember correctly.

You should try calendar.markAsDirty();

If that does the trick, please file a bug in Vaadin trac. Setting the event provider should should do that internally.


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

BasicEventProvider provider =new BasicEventProvider();
 layout.addComponent(new Button("Add event",e-> {