•Drag and drop events to calendar
•Support for localization and timezones
The data source of the calendar can be practically anything, as its events are queried dynamically by the component. You can bind the calendar to a Vaadin container, or to any other data source by implementing an event provider.
Monthly and Weekly Views
The Vaadin Calendar has two types of views that are shown depending on the date range of the calendar. The weekly view displays a week by default. It can show anything between one to seven days a week, and is also used as a single-day view. The view mode is determined from the date range of the calendar, defined by a start and an end date. Calendar will be shown in a monthly view when the date range is over than one week (seven days) long. The date range is always calculated in an accuracy of one millisecond.
The monthly view, shown in Figure 18.1, “Monthly view with All-Day and Normal Events”, can easily be used to control all types of events, but it is best suited for events that last for one or more days. You can drag the events to move them. In the figure, you can see two longer events that are highlighted with a blue and green background color. Other markings are shorter day events that last less than a 24 hours. These events can not be moved by dragging in the monthly view.
In Figure 18.2, “Weekly View”, you can see four normal day events and also all-day events at the top of the time line grid.
Calendar Events
All occurrences in a calendar are represented as events. You have three ways to manage the calendar events: add them to the calendar and manage them by its API, from a Vaadin
Container, or with an event provider.
Events are handled though the CalendarEvent interface. The concrete class of the event depends on the specific CalendarEventProvider used in the calendar. By default, Calendar uses a BasicEventProvider to provide events, which uses BasicEvent instances.
Vaadin Calendar does not depend on any particular data source implementation. Events are queried by the Calendar from the provider that just has to implement the CalendarEventProvider interface. It is up to the event provider that Calendar gets the correct events.
You can bind any Vaadin Container to a calendar, in which case a ContainerEventProvider is used transparently. The container must be ordered by start date and time of the events. See Section 9.5, “Collecting Items in Containers” for basic information about containers.
A calendar event requires a start time and an end time.These are the only mandatory properties. In addition, an event can also be set as an all-day event by setting the all-day property of the event.You can also set the description of an event, which is displayed as a tooltip in the user interface.
If the all-day field of the event is true, then the event is always rendered as an all-day event. In the monthly view, this means that no start time is displayed in the user interface and the event has an colored background. In the weekly view, all-day events are displayed in the upper part of