Top Description Fields Constructors Methods
com.calendarfx.model

public Class CalendarEvent

extends Event
Class Inheritance
Imports
javafx.event.Event, .EventType, java.time.ZonedDateTime

An event class used to signal changes done within a calendar or changes done to a calendar entry. Events of this type can be received by adding an event handler to a calendar.

Example

Calendar calendar = new Calendar("Home");
calendar.addEventHandler(CalendarEvent.ENTRY_ADDED, evt -> {...});

See Also
Calendar#addEventHandler(javafx.event.EventHandler)

Field Summary

Modifier and TypeField and Description
public static final EventType<CalendarEvent>
ANY

Hides javafx.event.Event.ANY.

The supertype of all event types in this event class.
private final Calendar<T>
public static final EventType<CalendarEvent>
CALENDAR_CHANGED

An event type used to inform the application that "something" inside the calendar has changed and that the views need to update their visuals accordingly (brute force update).

private Entry<?>
public static final EventType<CalendarEvent>
ENTRY_CALENDAR_CHANGED

An event type used to inform the application that an entry has been moved from one calendar to another.

public static final EventType<CalendarEvent>
ENTRY_CHANGED

The supertype of all events that a related to an entry itself and not the calendar.

public static final EventType<CalendarEvent>
ENTRY_FULL_DAY_CHANGED

An event type used to inform the application that an entry has become a "full day" entry, meaning its start and end time are no longer relevant.

public static final EventType<CalendarEvent>
ENTRY_INTERVAL_CHANGED

An event type used to inform the application that the time bounds of an entry have been changed.

public static final EventType<CalendarEvent>
ENTRY_LOCATION_CHANGED

An event type used to inform the application that an entry has been assigned a new user object.

public static final EventType<CalendarEvent>
ENTRY_RECURRENCE_RULE_CHANGED

An event type used to inform the application that an entry has been assigned a new user object.

public static final EventType<CalendarEvent>
ENTRY_TITLE_CHANGED

An event type used to inform the application that an entry has been assigned a new title.

public static final EventType<CalendarEvent>
ENTRY_USER_OBJECT_CHANGED

An event type used to inform the application that an entry has been assigned a new user object.

private Calendar<T>
private boolean
private Interval
private String
private Object
private static final long
Inherited from javafx.event.Event:
consumedeventTypeNULL_SOURCE_TARGETtarget

Constructor Summary

AccessConstructor and Description
protected
CalendarEvent(EventType<? extends CalendarEvent>
the event type
eventType
,
Calendar<T>
the calendar where the event occurred.
calendar
)

Constructs a new event for subclass.

public
CalendarEvent(EventType<? extends CalendarEvent>
the event type
eventType
,
Calendar<T>
the calendar where the event occured
calendar
,
Entry<?>
the affected entry
entry
)

Constructs a new event.

public
CalendarEvent(EventType<CalendarEvent>
the event type
eventType
,
Calendar<T>
the calendar where the event occured
calendar
,
Entry<?>
the affected entry
entry
,
Calendar<T>
the calendar to which the event belonged before
oldCalendar
)

Constructs a new event used for signalling that an entry was assigned to a new calendar.

public
CalendarEvent(EventType<CalendarEvent>
the event type
eventType
,
Calendar<T>
the calendar where the event occured
calendar
,
Entry<?>
the affected entry
entry
,
Object
the calendar to which the event belonged before
oldUserObject
)

Constructs a new event used for signalling that an entry has been assigned a new user object.

public
CalendarEvent(EventType<CalendarEvent>
the event type
eventType
,
Calendar<T>
the calendar where the event occured
calendar
,
Entry<?>
the affected entry
entry
,
Interval
the previous time interval
oldInterval
)

Constructs a new event used for signalling that an entry was assigned a new start end date / time.

public
CalendarEvent(EventType<CalendarEvent>
the event type
eventType
,
Calendar<T>
the calendar where the event occured
calendar
,
Entry<?>
the affected entry
entry
,
String
the previous value of the text
oldText
)

Constructs a new event used for signalling that an entry was assigned a new text (normally the title).

public
CalendarEvent(EventType<CalendarEvent>
the event type
eventType
,
Calendar<T>
the calendar where the event occured
calendar
,
Entry<?>
the affected entry
entry
,
boolean
the previous value of the full day
oldFullDay
)

Constructs a new event used for signaling that an entry was set to full day.

Method Summary

Modifier and TypeMethod and Description
public final Calendar<T>

Returns:

the affected calendar
getCalendar
()

Returns the calendar for which the event was fired.

public Entry<?>

Returns:

the affected entry
getEntry
()

Returns the entry for which the event was fired.

public final Calendar<T>

Returns:

the old calendar
getOldCalendar
()

Returns the old calendar.

public final boolean

Returns:

the old value of "full day"
getOldFullDay
()

Returns the old value of the "full day" flag.

public Interval

Returns:

the old time interval
getOldInterval
()

Returns the old time interval of the modified entry.

public final String

Returns:

the old text
getOldText
()

Returns the old text.

public Object

Returns:

the old user object
getOldUserObject
()

Returns the old user object of the modified entry.

public final boolean

Returns:

true if the new time interval of the entry touches other days than the old time interval of the entry
isDayChange
()

Determines whether the event will have an impact on different days.

public final boolean

Returns:

true if the event describes the creation of a new entry
isEntryAdded
()

A utility method to determine if the event describes the creation of a new entry.

public final boolean

Returns:

true if the event describes the removal of a new entry
isEntryRemoved
()

A utility method to determine if the event describes the removal of an entry.

public String
toString()

Overrides java.util.EventObject.toString.

Returns a String representation of this EventObject.

Inherited from javafx.event.Event:
cloneconsumecopyForfireEventgetEventTypegetTargetisConsumed

Field Detail

ANYback to summary
public static final EventType<CalendarEvent> ANY

Hides javafx.event.Event.ANY.

The supertype of all event types in this event class.

calendarback to summary
private final Calendar<T> calendar
CALENDAR_CHANGEDback to summary
public static final EventType<CalendarEvent> CALENDAR_CHANGED

An event type used to inform the application that "something" inside the calendar has changed and that the views need to update their visuals accordingly (brute force update).

entryback to summary
private Entry<?> entry
ENTRY_CALENDAR_CHANGEDback to summary
public static final EventType<CalendarEvent> ENTRY_CALENDAR_CHANGED

An event type used to inform the application that an entry has been moved from one calendar to another.

ENTRY_CHANGEDback to summary
public static final EventType<CalendarEvent> ENTRY_CHANGED

The supertype of all events that a related to an entry itself and not the calendar.

ENTRY_FULL_DAY_CHANGEDback to summary
public static final EventType<CalendarEvent> ENTRY_FULL_DAY_CHANGED

An event type used to inform the application that an entry has become a "full day" entry, meaning its start and end time are no longer relevant. The entry should be visualized in a way that signals that the entry will take all day (e.g. a birthday).

ENTRY_INTERVAL_CHANGEDback to summary
public static final EventType<CalendarEvent> ENTRY_INTERVAL_CHANGED

An event type used to inform the application that the time bounds of an entry have been changed. One or several of start / end date, start / end time.

ENTRY_LOCATION_CHANGEDback to summary
public static final EventType<CalendarEvent> ENTRY_LOCATION_CHANGED

An event type used to inform the application that an entry has been assigned a new user object.

ENTRY_RECURRENCE_RULE_CHANGEDback to summary
public static final EventType<CalendarEvent> ENTRY_RECURRENCE_RULE_CHANGED

An event type used to inform the application that an entry has been assigned a new user object.

ENTRY_TITLE_CHANGEDback to summary
public static final EventType<CalendarEvent> ENTRY_TITLE_CHANGED

An event type used to inform the application that an entry has been assigned a new title.

ENTRY_USER_OBJECT_CHANGEDback to summary
public static final EventType<CalendarEvent> ENTRY_USER_OBJECT_CHANGED

An event type used to inform the application that an entry has been assigned a new user object.

oldCalendarback to summary
private Calendar<T> oldCalendar
oldFullDayback to summary
private boolean oldFullDay
oldIntervalback to summary
private Interval oldInterval
oldTextback to summary
private String oldText
oldUserObjectback to summary
private Object oldUserObject
serialVersionUIDback to summary
private static final long serialVersionUID

Hides javafx.event.Event.serialVersionUID.

Constructor Detail

CalendarEventback to summary
protected CalendarEvent(EventType<? extends CalendarEvent> eventType, Calendar<T> calendar)

Constructs a new event for subclass.

Parameters
eventType:EventType<? extends CalendarEvent>

the event type

calendar:Calendar<T>

the calendar where the event occurred.

CalendarEventback to summary
public CalendarEvent(EventType<? extends CalendarEvent> eventType, Calendar<T> calendar, Entry<?> entry)

Constructs a new event.

Parameters
eventType:EventType<? extends CalendarEvent>

the event type

calendar:Calendar<T>

the calendar where the event occured

entry:Entry<?>

the affected entry

CalendarEventback to summary
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar<T> calendar, Entry<?> entry, Calendar<T> oldCalendar)

Constructs a new event used for signalling that an entry was assigned to a new calendar. The entry already carries a reference to new calendar and the event object will know the old calendar.

Parameters
eventType:EventType<CalendarEvent>

the event type

calendar:Calendar<T>

the calendar where the event occured

entry:Entry<?>

the affected entry

oldCalendar:Calendar<T>

the calendar to which the event belonged before

CalendarEventback to summary
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar<T> calendar, Entry<?> entry, Object oldUserObject)

Constructs a new event used for signalling that an entry has been assigned a new user object. The entry already carries a reference to the new user object and the event object will know the old user object.

Parameters
eventType:EventType<CalendarEvent>

the event type

calendar:Calendar<T>

the calendar where the event occured

entry:Entry<?>

the affected entry

oldUserObject:Object

the calendar to which the event belonged before

CalendarEventback to summary
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar<T> calendar, Entry<?> entry, Interval oldInterval)

Constructs a new event used for signalling that an entry was assigned a new start end date / time. The entry already carries the new values, while the old values can be retrieved from the event object.

Parameters
eventType:EventType<CalendarEvent>

the event type

calendar:Calendar<T>

the calendar where the event occured

entry:Entry<?>

the affected entry

oldInterval:Interval

the previous time interval

CalendarEventback to summary
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar<T> calendar, Entry<?> entry, String oldText)

Constructs a new event used for signalling that an entry was assigned a new text (normally the title). The entry already carries a reference to new text and the event object will know the old one.

Parameters
eventType:EventType<CalendarEvent>

the event type

calendar:Calendar<T>

the calendar where the event occured

entry:Entry<?>

the affected entry

oldText:String

the previous value of the text

CalendarEventback to summary
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar<T> calendar, Entry<?> entry, boolean oldFullDay)

Constructs a new event used for signaling that an entry was set to full day. The entry already carries a reference to new full day value and the event object will know the old one.

Parameters
eventType:EventType<CalendarEvent>

the event type

calendar:Calendar<T>

the calendar where the event occured

entry:Entry<?>

the affected entry

oldFullDay:boolean

the previous value of the full day

Method Detail

getCalendarback to summary
public final Calendar<T> getCalendar()

Returns the calendar for which the event was fired.

Returns:Calendar<T>

the affected calendar

getEntryback to summary
public Entry<?> getEntry()

Returns the entry for which the event was fired.

Returns:Entry<?>

the affected entry

getOldCalendarback to summary
public final Calendar<T> getOldCalendar()

Returns the old calendar.

Returns:Calendar<T>

the old calendar

getOldFullDayback to summary
public final boolean getOldFullDay()

Returns the old value of the "full day" flag.

Returns:boolean

the old value of "full day"

getOldIntervalback to summary
public Interval getOldInterval()

Returns the old time interval of the modified entry.

Returns:Interval

the old time interval

getOldTextback to summary
public final String getOldText()

Returns the old text.

Returns:String

the old text

getOldUserObjectback to summary
public Object getOldUserObject()

Returns the old user object of the modified entry.

Returns:Object

the old user object

isDayChangeback to summary
public final boolean isDayChange()

Determines whether the event will have an impact on different days. The method will return false if the user simply changed the start and / or end time of an entry within the current day. However, when the user drags the entry from one day to another then this method will return true.

Returns:boolean

true if the new time interval of the entry touches other days than the old time interval of the entry

isEntryAddedback to summary
public final boolean isEntryAdded()

A utility method to determine if the event describes the creation of a new entry. This is the case when the event type is ENTRY_CALENDAR_CHANGED and the old calendar was null.

Returns:boolean

true if the event describes the creation of a new entry

isEntryRemovedback to summary
public final boolean isEntryRemoved()

A utility method to determine if the event describes the removal of an entry. This is the case when the event type is ENTRY_CALENDAR_CHANGED and the old calendar was not null but the new calendar is null.

Returns:boolean

true if the event describes the removal of a new entry

toStringback to summary
public String toString()

Overrides java.util.EventObject.toString.

Doc from java.util.EventObject.toString.

Returns a String representation of this EventObject.

Returns:String

a String representation of this EventObject

Annotations
@Override