Class BasicEvent
- java.lang.Object
-
- com.vaadin.ui.components.calendar.event.BasicEvent
-
- All Implemented Interfaces:
CalendarEvent
,CalendarEvent.EventChangeNotifier
,EditableCalendarEvent
,Serializable
public class BasicEvent extends Object implements EditableCalendarEvent, CalendarEvent.EventChangeNotifier
Simple implementation ofCalendarEvent
. 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
Constructors Constructor Description BasicEvent()
Default constructorBasicEvent(String caption, String description, Date date)
Constructor for creating an event with the same start and end dateBasicEvent(String caption, String description, Date startDate, Date endDate)
Constructor for creating an event with a start date and an end date.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEventChangeListener(CalendarEvent.EventChangeListener listener)
Add a listener to listen for EventChangeEvents.protected void
fireEventChange()
Fires an event change event to the listeners.String
getCaption()
Gets caption of event.String
getDescription()
Gets description of event.Date
getEnd()
Get end date of event.Date
getStart()
Gets start date of event.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(String caption)
Set the visible text in the calendar for the event.void
setDescription(String description)
Set the description of the event.void
setEnd(Date end)
Set the end date of the event.void
setStart(Date start)
Set the start date for the event.void
setStyleName(String styleName)
Set the style name for the event used for styling the event cells
-
-
-
Constructor Detail
-
BasicEvent
public BasicEvent()
Default constructor
-
BasicEvent
public BasicEvent(String caption, String description, Date date)
Constructor for creating an event with the same start and end date- Parameters:
caption
- The caption for the eventdescription
- The description for the eventdate
- The date the event occurred
-
BasicEvent
public BasicEvent(String caption, String description, Date startDate, 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 eventdescription
- The description for the eventstartDate
- The start date of the eventendDate
- The end date of the event
-
-
Method Detail
-
getCaption
public String getCaption()
Description copied from interface:CalendarEvent
Gets caption of event.- Specified by:
getCaption
in interfaceCalendarEvent
- Returns:
- Caption text
-
getDescription
public String getDescription()
Description copied from interface:CalendarEvent
Gets description of event. Shown as a tooltip over the event.- Specified by:
getDescription
in interfaceCalendarEvent
- Returns:
- Description text.
-
getEnd
public Date getEnd()
Description copied from interface:CalendarEvent
Get end date of event.- Specified by:
getEnd
in interfaceCalendarEvent
- Returns:
- End date;
-
getStart
public Date getStart()
Description copied from interface:CalendarEvent
Gets start date of event.- Specified by:
getStart
in interfaceCalendarEvent
- Returns:
- Start date.
-
getStyleName
public 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 interfaceCalendarEvent
- 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 interfaceCalendarEvent
- Returns:
- true if this event is an all-day event, false otherwise
-
setCaption
public void setCaption(String caption)
Description copied from interface:EditableCalendarEvent
Set the visible text in the calendar for the event.- Specified by:
setCaption
in interfaceEditableCalendarEvent
- Parameters:
caption
- The text to show in the calendar
-
setDescription
public void setDescription(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 interfaceEditableCalendarEvent
- Parameters:
description
- The text which describes the event
-
setEnd
public void setEnd(Date end)
Description copied from interface:EditableCalendarEvent
Set the end date of the event. Must be after the start date.- Specified by:
setEnd
in interfaceEditableCalendarEvent
- Parameters:
end
- The end date to set
-
setStart
public void setStart(Date start)
Description copied from interface:EditableCalendarEvent
Set the start date for the event. Must be before the end date- Specified by:
setStart
in interfaceEditableCalendarEvent
- Parameters:
start
- The start date of the event
-
setStyleName
public void setStyleName(String styleName)
Description copied from interface:EditableCalendarEvent
Set the style name for the event used for styling the event cells- Specified by:
setStyleName
in interfaceEditableCalendarEvent
- 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 interfaceEditableCalendarEvent
- 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 interfaceCalendarEvent.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 interfaceCalendarEvent.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.
-
-