com.vaadin.ui.components.calendar
Class ContainerEventProvider

java.lang.Object
  extended by com.vaadin.ui.components.calendar.ContainerEventProvider
All Implemented Interfaces:
Container.ItemSetChangeListener, Property.ValueChangeListener, CalendarComponentEvents.EventMoveHandler, CalendarComponentEvents.EventResizeHandler, CalendarEditableEventProvider, CalendarEvent.EventChangeNotifier, CalendarEventProvider, CalendarEventProvider.EventSetChangeNotifier, java.io.Serializable, java.util.EventListener

public class ContainerEventProvider
extends java.lang.Object
implements CalendarEditableEventProvider, CalendarEventProvider.EventSetChangeNotifier, CalendarEvent.EventChangeNotifier, CalendarComponentEvents.EventMoveHandler, CalendarComponentEvents.EventResizeHandler, Container.ItemSetChangeListener, Property.ValueChangeListener

A event provider which uses a Container as a datasource. Container used as data source. NOTE: The data source must be sorted by date!

Since:
7.1.0
Author:
Vaadin Ltd.
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.vaadin.ui.components.calendar.event.CalendarEventProvider
CalendarEventProvider.EventSetChangeEvent, CalendarEventProvider.EventSetChangeListener, CalendarEventProvider.EventSetChangeNotifier
 
Field Summary
static java.lang.String CAPTION_PROPERTY
           
static java.lang.String DESCRIPTION_PROPERTY
           
static java.lang.String ENDDATE_PROPERTY
           
static java.lang.String STARTDATE_PROPERTY
           
static java.lang.String STYLENAME_PROPERTY
           
 
Fields inherited from interface com.vaadin.ui.components.calendar.CalendarComponentEvents.EventMoveHandler
eventMoveMethod
 
Fields inherited from interface com.vaadin.ui.components.calendar.CalendarComponentEvents.EventResizeHandler
eventResizeMethod
 
Constructor Summary
ContainerEventProvider(Container.Indexed container)
          Constructor
 
Method Summary
 void addEvent(CalendarEvent event)
          Adds an event to the event provider
 void addEventChangeListener(CalendarEvent.EventChangeListener listener)
          Add a listener to listen for EventChangeEvents.
 void addEventSetChangeListener(CalendarEventProvider.EventSetChangeListener listener)
          Add a listener for listening to when new events are adding or removed from the event provider.
 void containerItemSetChange(Container.ItemSetChangeEvent event)
          Lets the listener know a Containers visible (filtered and/or sorted, if applicable) Item set has changed.
 void detachContainerDataSource()
          If you are reusing the container which previously have been attached to this ContainerEventProvider call this method to remove this event providers container listeners before attaching it to an other ContainerEventProvider
 void eventMove(CalendarComponentEvents.MoveEvent event)
          This method will be called when event has been moved to a new position.
 void eventResize(CalendarComponentEvents.EventResize event)
           
 java.lang.Object getCaptionProperty()
          Get the property which provides the caption of the event
 Container.Indexed getContainerDataSource()
          Returns the container used as data source
 java.lang.Object getDescriptionProperty()
          Get the property which provides the description of the event
 java.lang.Object getEndDateProperty()
          Get the property which provides the ending date and time of the event
 java.util.List<CalendarEvent> getEvents(java.util.Date startDate, java.util.Date endDate)
           Gets all available events in the target date range between startDate and endDate.
 java.lang.Object getStartDateProperty()
          Get the property which provides the starting date and time of the event
 java.lang.Object getStyleNameProperty()
          Get the property which provides the style name for the event
 void removeEvent(CalendarEvent event)
          Removes an event from the event provider
 void removeEventChangeListener(CalendarEvent.EventChangeListener listener)
          Remove a listener from the event provider.
 void removeEventSetChangeListener(CalendarEventProvider.EventSetChangeListener listener)
          Remove a listener which listens to CalendarEventProvider.EventSetChangeEvent-events
 void setCaptionProperty(java.lang.Object captionProperty)
          Set the property which provides the caption of the event
 void setContainerDataSource(Container.Indexed container)
          Set the container data source
 void setDescriptionProperty(java.lang.Object descriptionProperty)
          Set the property which provides the description of the event
 void setEndDateProperty(java.lang.Object endDateProperty)
          Set the property which provides the ending date and time of the event
 void setStartDateProperty(java.lang.Object startDateProperty)
          Set the property which provides the starting date and time of the event
 void setStyleNameProperty(java.lang.Object styleNameProperty)
          Set the property which provides the style name for the event
 void valueChange(Property.ValueChangeEvent event)
          Notifies this listener that the Property's value has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CAPTION_PROPERTY

public static final java.lang.String CAPTION_PROPERTY
See Also:
Constant Field Values

DESCRIPTION_PROPERTY

public static final java.lang.String DESCRIPTION_PROPERTY
See Also:
Constant Field Values

STARTDATE_PROPERTY

public static final java.lang.String STARTDATE_PROPERTY
See Also:
Constant Field Values

ENDDATE_PROPERTY

public static final java.lang.String ENDDATE_PROPERTY
See Also:
Constant Field Values

STYLENAME_PROPERTY

public static final java.lang.String STYLENAME_PROPERTY
See Also:
Constant Field Values
Constructor Detail

ContainerEventProvider

public ContainerEventProvider(Container.Indexed container)
Constructor

Parameters:
container - Container to use as a data source.
Method Detail

setContainerDataSource

public void setContainerDataSource(Container.Indexed container)
Set the container data source

Parameters:
container - The container to use as datasource

getContainerDataSource

public Container.Indexed getContainerDataSource()
Returns the container used as data source


getEvents

public java.util.List<CalendarEvent> getEvents(java.util.Date startDate,
                                               java.util.Date endDate)
Description copied from interface: CalendarEventProvider

Gets all available events in the target date range between startDate and endDate. The Vaadin Calendar queries the events from the range that is shown, which is not guaranteed to be the same as the date range that is set.

For example, if you set the date range to be monday 22.2.2010 - wednesday 24.2.2000, the used Event Provider will be queried for events between monday 22.2.2010 00:00 and sunday 28.2.2010 23:59. Generally you can expect the date range to be expanded to whole days and whole weeks.

Specified by:
getEvents in interface CalendarEventProvider
Parameters:
startDate - Start date
endDate - End date
Returns:
List of events

addEventSetChangeListener

public void addEventSetChangeListener(CalendarEventProvider.EventSetChangeListener listener)
Description copied from interface: CalendarEventProvider.EventSetChangeNotifier
Add a listener for listening to when new events are adding or removed from the event provider.

Specified by:
addEventSetChangeListener in interface CalendarEventProvider.EventSetChangeNotifier
Parameters:
listener - The listener to add

removeEventSetChangeListener

public void removeEventSetChangeListener(CalendarEventProvider.EventSetChangeListener listener)
Description copied from interface: CalendarEventProvider.EventSetChangeNotifier
Remove a listener which listens to CalendarEventProvider.EventSetChangeEvent-events

Specified by:
removeEventSetChangeListener in interface CalendarEventProvider.EventSetChangeNotifier
Parameters:
listener - The listener to remove

addEventChangeListener

public void addEventChangeListener(CalendarEvent.EventChangeListener listener)
Description copied from interface: CalendarEvent.EventChangeNotifier
Add a listener to listen for EventChangeEvents. These events are fired when a events properties are changed.

Specified by:
addEventChangeListener in interface CalendarEvent.EventChangeNotifier
Parameters:
listener - The listener to add

removeEventChangeListener

public void removeEventChangeListener(CalendarEvent.EventChangeListener listener)
Description copied from interface: CalendarEvent.EventChangeNotifier
Remove a listener from the event provider.

Specified by:
removeEventChangeListener in interface CalendarEvent.EventChangeNotifier
Parameters:
listener - The listener to remove

getCaptionProperty

public java.lang.Object getCaptionProperty()
Get the property which provides the caption of the event


setCaptionProperty

public void setCaptionProperty(java.lang.Object captionProperty)
Set the property which provides the caption of the event


getDescriptionProperty

public java.lang.Object getDescriptionProperty()
Get the property which provides the description of the event


setDescriptionProperty

public void setDescriptionProperty(java.lang.Object descriptionProperty)
Set the property which provides the description of the event


getStartDateProperty

public java.lang.Object getStartDateProperty()
Get the property which provides the starting date and time of the event


setStartDateProperty

public void setStartDateProperty(java.lang.Object startDateProperty)
Set the property which provides the starting date and time of the event


getEndDateProperty

public java.lang.Object getEndDateProperty()
Get the property which provides the ending date and time of the event


setEndDateProperty

public void setEndDateProperty(java.lang.Object endDateProperty)
Set the property which provides the ending date and time of the event


getStyleNameProperty

public java.lang.Object getStyleNameProperty()
Get the property which provides the style name for the event


setStyleNameProperty

public void setStyleNameProperty(java.lang.Object styleNameProperty)
Set the property which provides the style name for the event


containerItemSetChange

public void containerItemSetChange(Container.ItemSetChangeEvent event)
Description copied from interface: Container.ItemSetChangeListener
Lets the listener know a Containers visible (filtered and/or sorted, if applicable) Item set has changed.

Specified by:
containerItemSetChange in interface Container.ItemSetChangeListener
Parameters:
event - change event text

valueChange

public void valueChange(Property.ValueChangeEvent event)
Description copied from interface: Property.ValueChangeListener
Notifies this listener that the Property's value has changed.

Specified by:
valueChange in interface Property.ValueChangeListener
Parameters:
event - value change event object

eventMove

public void eventMove(CalendarComponentEvents.MoveEvent event)
Description copied from interface: CalendarComponentEvents.EventMoveHandler
This method will be called when event has been moved to a new position.

Specified by:
eventMove in interface CalendarComponentEvents.EventMoveHandler
Parameters:
event - MoveEvent containing specific information of the new position and target event.

eventResize

public void eventResize(CalendarComponentEvents.EventResize event)
Specified by:
eventResize in interface CalendarComponentEvents.EventResizeHandler

detachContainerDataSource

public void detachContainerDataSource()
If you are reusing the container which previously have been attached to this ContainerEventProvider call this method to remove this event providers container listeners before attaching it to an other ContainerEventProvider


addEvent

public void addEvent(CalendarEvent event)
Description copied from interface: CalendarEditableEventProvider
Adds an event to the event provider

Specified by:
addEvent in interface CalendarEditableEventProvider
Parameters:
event - The event to add

removeEvent

public void removeEvent(CalendarEvent event)
Description copied from interface: CalendarEditableEventProvider
Removes an event from the event provider

Specified by:
removeEvent in interface CalendarEditableEventProvider
Parameters:
event - The event


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.