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 voidaddEventChangeListener(CalendarEvent.EventChangeListener listener)Add a listener to listen for EventChangeEvents.protected voidfireEventChange()Fires an event change event to the listeners.StringgetCaption()Gets caption of event.StringgetDescription()Gets description of event.DategetEnd()Get end date of event.DategetStart()Gets start date of event.StringgetStyleName()Gets style name of event.booleanisAllDay()An all-day event typically does not occur at a specific time but targets a whole day or days.voidremoveEventChangeListener(CalendarEvent.EventChangeListener listener)Remove a listener from the event provider.voidsetAllDay(boolean isAllDay)Does the event span the whole day.voidsetCaption(String caption)Set the visible text in the calendar for the event.voidsetDescription(String description)Set the description of the event.voidsetEnd(Date end)Set the end date of the event.voidsetStart(Date start)Set the start date for the event.voidsetStyleName(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:CalendarEventGets caption of event.- Specified by:
getCaptionin interfaceCalendarEvent- Returns:
- Caption text
-
getDescription
public String getDescription()
Description copied from interface:CalendarEventGets description of event. Shown as a tooltip over the event.- Specified by:
getDescriptionin interfaceCalendarEvent- Returns:
- Description text.
-
getEnd
public Date getEnd()
Description copied from interface:CalendarEventGet end date of event.- Specified by:
getEndin interfaceCalendarEvent- Returns:
- End date;
-
getStart
public Date getStart()
Description copied from interface:CalendarEventGets start date of event.- Specified by:
getStartin interfaceCalendarEvent- Returns:
- Start date.
-
getStyleName
public String getStyleName()
Description copied from interface:CalendarEventGets 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:
getStyleNamein interfaceCalendarEvent- Returns:
- Style name.
-
isAllDay
public boolean isAllDay()
Description copied from interface:CalendarEventAn 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:
isAllDayin interfaceCalendarEvent- Returns:
- true if this event is an all-day event, false otherwise
-
setCaption
public void setCaption(String caption)
Description copied from interface:EditableCalendarEventSet the visible text in the calendar for the event.- Specified by:
setCaptionin interfaceEditableCalendarEvent- Parameters:
caption- The text to show in the calendar
-
setDescription
public void setDescription(String description)
Description copied from interface:EditableCalendarEventSet the description of the event. This is shown in the calendar when hoovering over the event.- Specified by:
setDescriptionin interfaceEditableCalendarEvent- Parameters:
description- The text which describes the event
-
setEnd
public void setEnd(Date end)
Description copied from interface:EditableCalendarEventSet the end date of the event. Must be after the start date.- Specified by:
setEndin interfaceEditableCalendarEvent- Parameters:
end- The end date to set
-
setStart
public void setStart(Date start)
Description copied from interface:EditableCalendarEventSet the start date for the event. Must be before the end date- Specified by:
setStartin interfaceEditableCalendarEvent- Parameters:
start- The start date of the event
-
setStyleName
public void setStyleName(String styleName)
Description copied from interface:EditableCalendarEventSet the style name for the event used for styling the event cells- Specified by:
setStyleNamein interfaceEditableCalendarEvent- Parameters:
styleName- The stylename to use
-
setAllDay
public void setAllDay(boolean isAllDay)
Description copied from interface:EditableCalendarEventDoes the event span the whole day. If so then set this to true- Specified by:
setAllDayin 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.EventChangeNotifierAdd a listener to listen for EventChangeEvents. These events are fired when a events properties are changed.- Specified by:
addEventChangeListenerin interfaceCalendarEvent.EventChangeNotifier- Parameters:
listener- The listener to add
-
removeEventChangeListener
public void removeEventChangeListener(CalendarEvent.EventChangeListener listener)
Description copied from interface:CalendarEvent.EventChangeNotifierRemove a listener from the event provider.- Specified by:
removeEventChangeListenerin 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.
-
-