com.vaadin.ui.components.calendar.event
Class BasicEvent

java.lang.Object
  extended by com.vaadin.ui.components.calendar.event.BasicEvent
All Implemented Interfaces:
CalendarEvent, CalendarEvent.EventChangeNotifier, EditableCalendarEvent, java.io.Serializable

public class BasicEvent
extends java.lang.Object
implements EditableCalendarEvent, CalendarEvent.EventChangeNotifier

Simple implementation of CalendarEvent. Has setters for all required fields and fires events when this event is changed.

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.CalendarEvent
CalendarEvent.EventChangeEvent, CalendarEvent.EventChangeListener, CalendarEvent.EventChangeNotifier
 
Constructor Summary
BasicEvent()
          Default constructor
BasicEvent(java.lang.String caption, java.lang.String description, java.util.Date date)
          Constructor for creating an event with the same start and end date
BasicEvent(java.lang.String caption, java.lang.String description, java.util.Date startDate, java.util.Date endDate)
          Constructor for creating an event with a start date and an end date.
 
Method Summary
 void addEventChangeListener(CalendarEvent.EventChangeListener listener)
          Add a listener to listen for EventChangeEvents.
protected  void fireEventChange()
          Fires an event change event to the listeners.
 java.lang.String getCaption()
          Gets caption of event.
 java.lang.String getDescription()
          Gets description of event.
 java.util.Date getEnd()
          Get end date of event.
 java.util.Date getStart()
          Gets start date of event.
 java.lang.String getStyleName()
           Gets style name of event.
 boolean isAllDay()
          An all-day event typically does not occur at a specific time but targets a whole day or days.
 void removeEventChangeListener(CalendarEvent.EventChangeListener listener)
          Remove a listener from the event provider.
 void setAllDay(boolean isAllDay)
          Does the event span the whole day.
 void setCaption(java.lang.String caption)
          Set the visible text in the calendar for the event.
 void setDescription(java.lang.String description)
          Set the description of the event.
 void setEnd(java.util.Date end)
          Set the end date of the event.
 void setStart(java.util.Date start)
          Set the start date for the event.
 void setStyleName(java.lang.String styleName)
          Set the style name for the event used for styling the event cells
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicEvent

public BasicEvent()
Default constructor


BasicEvent

public BasicEvent(java.lang.String caption,
                  java.lang.String description,
                  java.util.Date date)
Constructor for creating an event with the same start and end date

Parameters:
caption - The caption for the event
description - The description for the event
date - The date the event occurred

BasicEvent

public BasicEvent(java.lang.String caption,
                  java.lang.String description,
                  java.util.Date startDate,
                  java.util.Date endDate)
Constructor for creating an event with a start date and an end date. Start date should be before the end date

Parameters:
caption - The caption for the event
description - The description for the event
startDate - The start date of the event
endDate - The end date of the event
Method Detail

getCaption

public java.lang.String getCaption()
Description copied from interface: CalendarEvent
Gets caption of event.

Specified by:
getCaption in interface CalendarEvent
Returns:
Caption text

getDescription

public java.lang.String getDescription()
Description copied from interface: CalendarEvent
Gets description of event. Shown as a tooltip over the event.

Specified by:
getDescription in interface CalendarEvent
Returns:
Description text.

getEnd

public java.util.Date getEnd()
Description copied from interface: CalendarEvent
Get end date of event.

Specified by:
getEnd in interface CalendarEvent
Returns:
End date;

getStart

public java.util.Date getStart()
Description copied from interface: CalendarEvent
Gets start date of event.

Specified by:
getStart in interface CalendarEvent
Returns:
Start date.

getStyleName

public java.lang.String getStyleName()
Description copied from interface: CalendarEvent

Gets style name of event. In the client, style name will be set to the event's element class name and can be styled by CSS

Styling example:
Java code:
event.setStyleName("color1");

CSS:
.v-calendar-event-color1 {
   background-color: #9effae;
}

Specified by:
getStyleName in interface CalendarEvent
Returns:
Style name.

isAllDay

public boolean isAllDay()
Description copied from interface: CalendarEvent
An all-day event typically does not occur at a specific time but targets a whole day or days. The rendering of all-day events differs from normal events.

Specified by:
isAllDay in interface CalendarEvent
Returns:
true if this event is an all-day event, false otherwise

setCaption

public void setCaption(java.lang.String caption)
Description copied from interface: EditableCalendarEvent
Set the visible text in the calendar for the event.

Specified by:
setCaption in interface EditableCalendarEvent
Parameters:
caption - The text to show in the calendar

setDescription

public void setDescription(java.lang.String description)
Description copied from interface: EditableCalendarEvent
Set the description of the event. This is shown in the calendar when hoovering over the event.

Specified by:
setDescription in interface EditableCalendarEvent
Parameters:
description - The text which describes the event

setEnd

public void setEnd(java.util.Date end)
Description copied from interface: EditableCalendarEvent
Set the end date of the event. Must be after the start date.

Specified by:
setEnd in interface EditableCalendarEvent
Parameters:
end - The end date to set

setStart

public void setStart(java.util.Date start)
Description copied from interface: EditableCalendarEvent
Set the start date for the event. Must be before the end date

Specified by:
setStart in interface EditableCalendarEvent
Parameters:
start - The start date of the event

setStyleName

public void setStyleName(java.lang.String styleName)
Description copied from interface: EditableCalendarEvent
Set the style name for the event used for styling the event cells

Specified by:
setStyleName in interface EditableCalendarEvent
Parameters:
styleName - The stylename to use

setAllDay

public void setAllDay(boolean isAllDay)
Description copied from interface: EditableCalendarEvent
Does the event span the whole day. If so then set this to true

Specified by:
setAllDay in interface EditableCalendarEvent
Parameters:
isAllDay - True if the event spans the whole day. In this case the start and end times are ignored.

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

fireEventChange

protected void fireEventChange()
Fires an event change event to the listeners. Should be triggered when some property of the event changes.



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