Top Description Fields Constructors Methods
com.calendarfx.model

public final Class LoadEvent

extends Event
Class Inheritance
Imports
javafx.event.Event, .EventType, java.time.LocalDate, .LocalTime, .ZoneId, .ZonedDateTime, java.util.List

An event fired by the framework to inform the application that data will be required for the time interval defined by the given start and end date. This type of event can be used to implement a lazy loading strategy.

Code Example

The following code snippet was taken from the Google calendar application included in the distribution.
CalendarView calendarView = ...
calendarView.addEventFilter(LoadEvent.LOAD, evt -> {
   for (CalendarSource source : evt.getCalendarSources()) {
     if (source instanceof GoogleAccount) {
        GoogleAccount account = (GoogleAccount) source;

        Thread loadThread = new Thread() {
           public void run() {
              for (Calendar calendar : account.getCalendars()) {
                 GoogleCalendar googleCalendar = (GoogleCalendar) calendar;
                 googleCalendar.load(evt.getStartDate(), evt.getEndDate(), evt.getZoneId());
              }
           }
        };

        loadThread.setDaemon(true);
        loadThread.start();

        break;
     }
  }
});

Field Summary

Modifier and TypeField and Description
private final List<CalendarSource>
private final LocalDate
public static final EventType<LoadEvent>
LOAD

Gets fired frequently by the framework to indicate that data for the given date range is required to be present in the calendars.

private static final long
private final String
private final LocalDate
private final ZoneId
Inherited from javafx.event.Event:
ANYconsumedeventTypeNULL_SOURCE_TARGETtarget

Constructor Summary

AccessConstructor and Description
public
LoadEvent(EventType<LoadEvent>
the type of the load event
eventType
,
String
the name of the source where the event originated, e.g. "DayView"
sourceName
,
List<CalendarSource>
the affected calendar sources
calendarSources
,
LocalDate
the start date of the time interval
startDate
,
LocalDate
the end date of the time interval
endDate
,
ZoneId
the time zone
zoneId
)

Constructs a new load event.

Method Summary

Modifier and TypeMethod and Description
public List<CalendarSource>

Returns:

the calendar sources
getCalendarSources
()

The calendar sources that are affected by the load event.

public LocalDate

Returns:

the end date
getEndDate
()

The end of the loaded time interval.

public ZonedDateTime

Returns:

the start time defined by this event
getEndTime
()

Convenience method to return a zoned date time based on the given end date and time zone.

public String

Returns:

the name of the control requesting the data
getSourceName
()

A human readable name of the control that triggered the load event, e.g. "Day View" or "Month View".

public LocalDate

Returns:

the start date
getStartDate
()

The start of the loaded time interval.

public ZonedDateTime

Returns:

the start time defined by this event
getStartTime
()

Convenience method to return a zoned date time based on the given start date and time zone.

public ZoneId

Returns:

the time zone
getZoneId
()

The time zone used for the load.

public String
toString()

Overrides java.util.EventObject.toString.

Returns a String representation of this EventObject.

Inherited from javafx.event.Event:
cloneconsumecopyForfireEventgetEventTypegetTargetisConsumed

Field Detail

calendarSourcesback to summary
private final List<CalendarSource> calendarSources
endDateback to summary
private final LocalDate endDate
LOADback to summary
public static final EventType<LoadEvent> LOAD

Gets fired frequently by the framework to indicate that data for the given date range is required to be present in the calendars.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides javafx.event.Event.serialVersionUID.

sourceNameback to summary
private final String sourceName
startDateback to summary
private final LocalDate startDate
zoneIdback to summary
private final ZoneId zoneId

Constructor Detail

LoadEventback to summary
public LoadEvent(EventType<LoadEvent> eventType, String sourceName, List<CalendarSource> calendarSources, LocalDate startDate, LocalDate endDate, ZoneId zoneId)

Constructs a new load event.

Parameters
eventType:EventType<LoadEvent>

the type of the load event

sourceName:String

the name of the source where the event originated, e.g. "DayView"

calendarSources:List<CalendarSource>

the affected calendar sources

startDate:LocalDate

the start date of the time interval

endDate:LocalDate

the end date of the time interval

zoneId:ZoneId

the time zone

Method Detail

getCalendarSourcesback to summary
public List<CalendarSource> getCalendarSources()

The calendar sources that are affected by the load event.

Returns:List<CalendarSource>

the calendar sources

getEndDateback to summary
public LocalDate getEndDate()

The end of the loaded time interval.

Returns:LocalDate

the end date

getEndTimeback to summary
public ZonedDateTime getEndTime()

Convenience method to return a zoned date time based on the given end date and time zone. Uses LocalTime#MAX as time.

Returns:ZonedDateTime

the start time defined by this event

getSourceNameback to summary
public String getSourceName()

A human readable name of the control that triggered the load event, e.g. "Day View" or "Month View". Mainly used for debugging purposes.

Returns:String

the name of the control requesting the data

getStartDateback to summary
public LocalDate getStartDate()

The start of the loaded time interval.

Returns:LocalDate

the start date

getStartTimeback to summary
public ZonedDateTime getStartTime()

Convenience method to return a zoned date time based on the given start date and time zone. Uses LocalTime#MIN as time.

Returns:ZonedDateTime

the start time defined by this event

getZoneIdback to summary
public ZoneId getZoneId()

The time zone used for the load.

Returns:ZoneId

the time zone

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