Hi Sebastien, thanks for asking, no I dont have any filter on the calendar, but the ‘costumization’ of the calendar is on the DB there I save a ‘type’ of calendar ( 1 for Monday to Friday, 2 for Monday to Saturday and 3 for Monday to Sunday ) but this was given me some problems so for now I left that out, also on the db is the start time and end time for each calendar the ‘getCalendarStartTime()’ and ‘getCalendarEndTime()’ that right now is start at 7 (am) and ends at 23 (11:00 pm).
The component follows this steps:
- From a combobox select the calendar ( I manage diferents calendars)
- get the ‘costumization’ of the calendar from the db and load the calendar. (first part of the code)
- get the events for that calendar from the db.
- load those events on the calendar. (btw the old events also show correctly on the day view, the problem is when is a new event.)
ArrayList<OKCalendarEvent> events = new ArrayList<>();
container.removeAllItems();
events.addAll(
OKCalendarEventData.listAllEventsByCalendarBetween(getInnerCalendar().getCalendar_id(),
new Timestamp(from.getTimeInMillis()),
new Timestamp(to.getTimeInMillis()),
CurrentUser.getCurrentToken().getDataSource()));
for (OKCalendarEvent e : events) {
OklexBasicEvent event = new OklexBasicEvent(e.getName(),
e.getDescription(),
e.getStart(),
e.getEnd(),
false);
container.addBean(event);
}
if(currentNewEvent != null){
container.addBean(currentNewEvent);
if(!isEventValid(currentNewEvent)){
currentNewEvent.setStyleName("error");
}
this.btnSave.setVisible(true); }
vaadinCalendar.markAsDirtyRecursive();
- Add the new event on the calendar.
OklexBasicEvent is an extension of BasicEvent, I only added a boolean field to check if is new or already on the db.
public OklexBasicEvent(String name, String description, Date start, Date end, boolean newEvent ){
super(name, description, start, end);
setNewEvent(newEvent);
}