Im already ask this before, but didnt get any answer, and need to realese the application this Monday, but I have the next problem:
Sometimes when I add a new event, the event is not show on the calendar component when Im on view mode Day, but if I click on the Week mode there it is, and only on some days of the week, mainly with Fridays, or Mondays.
For what Im suspecting is because the locale on the component is not right, event if I set the component widgetCalendar.setLocale(new Locale(“en”,“US”)), is mixing the first day of week and last day of the week. Im already check my server configuration, my aplication configuration, I dont know what is wrong:
Still dont have an answer for this, I dont know if the problem is with the Vaadin Calendar or is something I did wrong, somebody else have this issue? I have checked the documentation twice and the forum and found nothing…
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);
}
Still no answer? or any ideas?? I’m getting in problems with my client here… :S Im thinking on doing my own component, very very simple way to suply this component.
Well if somebody has the same problem, I think I just fixed, but I still dont see the problem of why…
So, the problem was that I was using the BeanItemContainer, to add the events to the calendar, instead of a BasicEventProvider, just changed that part, so my new question is; why the beanItemContainer.addBean(new MyEvent()) dosen’t work like the basicEventProvider.addEvent(new MyEvent())?, On the documentation I can see that both methods are valid, and didn’t read any warning that this kind of erros could happend. So I hope someone can explain me that.
Hello Alejandro, thanks for answering. Looks like I haven’t try that, I will check it out, but using a BasicEventPovider class solved most of my issues, for now…