public final class LoadEvent extends Event
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; } } });
Modifier and Type | Field and Description |
---|---|
static 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.
|
source
Constructor and Description |
---|
LoadEvent(EventType<LoadEvent> eventType,
String sourceName,
List<CalendarSource> calendarSources,
LocalDate startDate,
LocalDate endDate,
ZoneId zoneId)
Constructs a new load event.
|
Modifier and Type | Method and Description |
---|---|
List<CalendarSource> |
getCalendarSources()
The calendar sources that are affected by the load event.
|
LocalDate |
getEndDate()
The end of the loaded time interval.
|
ZonedDateTime |
getEndTime()
Convenience method to return a zoned date time based on the given end
date and time zone.
|
String |
getSourceName()
A human readable name of the control that triggered the load event, e.g.
|
LocalDate |
getStartDate()
The start of the loaded time interval.
|
ZonedDateTime |
getStartTime()
Convenience method to return a zoned date time based on the given start
date and time zone.
|
ZoneId |
getZoneId()
The time zone used for the load.
|
String |
toString() |
clone, consume, copyFor, fireEvent, getEventType, getTarget, isConsumed
getSource
public LoadEvent(EventType<LoadEvent> eventType, String sourceName, List<CalendarSource> calendarSources, LocalDate startDate, LocalDate endDate, ZoneId zoneId)
eventType
- the type of the load eventsourceName
- the name of the source where the event originated, e.g.
"DayView"calendarSources
- the affected calendar sourcesstartDate
- the start date of the time intervalendDate
- the end date of the time intervalzoneId
- the time zonepublic String getSourceName()
public List<CalendarSource> getCalendarSources()
public LocalDate getStartDate()
public LocalDate getEndDate()
public ZoneId getZoneId()
public ZonedDateTime getStartTime()
LocalTime.MIN
as time.public ZonedDateTime getEndTime()
LocalTime.MAX
as time.public String toString()
toString
in class EventObject
Copyright © 2017 Dirk Lemmermann Software & Consulting. All rights reserved.