Class BaseScheduleXCalendar
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.HtmlContainer
com.vaadin.flow.component.html.Div
org.vaadin.addons.componentfactory.schedulexcalendar.BaseScheduleXCalendar
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.html.Div>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasOrderedComponents,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasText,Serializable
- Direct Known Subclasses:
ScheduleXCalendar,ScheduleXResourceScheduler
@NpmPackage(value="temporal-polyfill",version="0.3.0") @NpmPackage(value="@schedule-x/calendar",version="3.5.1") @NpmPackage(value="@schedule-x/theme-default",version="3.5.1") @NpmPackage(value="@schedule-x/resize",version="3.5.1") @NpmPackage(value="@schedule-x/drag-and-drop",version="3.5.1") @NpmPackage(value="@schedule-x/current-time",version="3.5.1") @NpmPackage(value="@schedule-x/scroll-controller",version="3.5.1") @NpmPackage(value="@schedule-x/calendar-controls",version="3.5.1") @NpmPackage(value="@schedule-x/event-recurrence",version="3.5.1") @NpmPackage(value="@schedule-x/ical",version="3.5.1")
@CssImport("@schedule-x/theme-default/dist/index.css") @CssImport("./styles/vcf-schedule-x-calendar-styles.css")
public abstract class BaseScheduleXCalendar
extends com.vaadin.flow.component.html.Div
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEvent fired when a calendar event is added to the calendar.classEvent fired when a calendar event is clicked.static classEvent fired when a calendar event is removed from the calendar.static classEvent fired when a calendar event is updated.static classEvent fired when the calendar view and selected date are updated on the client side.classEvent fired when an event is updated on resize or drag and drop on client side.classEvent fired when the selected date is updated on client side.Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText
com.vaadin.flow.component.HasText.WhiteSpace -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.vaadin.flow.component.html.DivDiv containing the calendar. -
Constructor Summary
ConstructorsConstructorDescriptionBaseScheduleXCalendar(List<? extends ViewType> views, com.vaadin.flow.data.provider.CallbackDataProvider<Event, EventQueryFilter> dataProvider, Configuration configuration) BaseScheduleXCalendar(List<? extends ViewType> views, com.vaadin.flow.data.provider.CallbackDataProvider<Event, EventQueryFilter> dataProvider, Configuration configuration, Map<String, Calendar> calendars) -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddCalendarEventAddedEventListener(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.CalendarEventAddedEvent> listener) Adds a CalendarEventAddedEvent listener.com.vaadin.flow.shared.RegistrationaddCalendarEventClickEventListener(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.CalendarEventClickEvent> listener) Adds a CalendarEventClickEvent listener.com.vaadin.flow.shared.RegistrationaddCalendarEventRemovedEventListener(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.CalendarEventRemovedEvent> listener) Adds a CalendarEventRemovedEvent listener.com.vaadin.flow.shared.RegistrationaddCalendarEventUpdatedEventListener(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.CalendarEventUpdatedEvent> listener) Adds a CalendarEventUpdatedEvent listener.com.vaadin.flow.shared.RegistrationaddCalendarViewAndDateChangeEvent(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.CalendarViewAndDateChangeEvent> listener) Adds aCalendarViewAndDateChangeEventlistener.voidAdds the given event to the calendar.com.vaadin.flow.shared.RegistrationaddEventUpdateEventListener(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.EventUpdateEvent> listener) Adds aEventUpdateEventlistener.com.vaadin.flow.shared.RegistrationaddSelectedDateUpdateEventListener(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.SelectedDateUpdateEvent> listener) Adds a SelectedDateUpdateEvent listener.protected StringSerialize all calendars as a JSON object.protected Stringprotected StringeventsToJson(LocalDateTime start, LocalDateTime end) Returns the available calendars displayed in the calendar.Returns current calendar configuration.com.vaadin.flow.data.provider.CallbackDataProvider<Event, EventQueryFilter> getDate()Gets the current date set in calendar.Gets the day boundaries of the calendar.Returns the day(number) shown as first day of the week in the calendars.protected abstract StringReturns the current language/locale of the calendar.Sets the max date for the calendar navigation.Gets the min date for the calendar navigation.Gets the month grid options of the calendar.Returns the current time zone of the calendar.getView()Gets the current calendar view in display.getViews()Returns the current views in the calendar.Gets the week options of the calendar.protected abstract voidinitCalendar(boolean refreshView) Initializes calendar with the initial configuration.voidAllows to navigate calendar backwards.voidAllows to navigate calendar forwards.protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) protected voidonDetach(com.vaadin.flow.component.DetachEvent detachEvent) voidRefreshes the calendar by re-initializing it with the most current configuration.voidremoveEvent(String eventId) Removes the event with given id from the calendar.voidsetCalendars(Map<String, Calendar> calendars) Sets the available calendars to be displayed in the calendar.voidsetDarkMode(boolean dark) Programmatically sets the theme of the calendar to either dark or light mode.voidsetDataProvider(com.vaadin.flow.data.provider.CallbackDataProvider<Event, EventQueryFilter> dataProvider) voidSets the calendar date.voidsetDayBoundaries(Configuration.DayBoundaries dayBoundaries) Sets the day boundaries of the calendar.voidsetFirstDayOfWeek(Integer firstDayOfWeek) Set the first day of the week for the calendar.voidSets the language for the calendar.voidsetMaxDate(LocalDate maxDate) Sets the max date for the calendar navigation.voidsetMinDate(LocalDate minDate) Sets the min date for the calendar navigation.voidsetMonthGridOptions(Configuration.MonthGridOptions monthGridOptions) Sets the month grid options of the calendar.voidsetTimeZone(ZoneId timeZone) Sets the time zone of the calendar.voidSets the calendar view.voidSets the available views for the calendar.voidsetWeekOptions(Configuration.WeekOptions weekOptions) Sets the week options of the calendar.protected voidupdateDate(LocalDate selectedDate) protected voidupdateDayBoundaries(Configuration.DayBoundaries dayBoundaries) voidupdateEvent(Event event) Updates the given event.protected voidupdateFirstDayOfWeek(Integer firstDayOfWeek) protected voidupdateLocale(Locale locale) protected voidupdateMaxDate(LocalDate maxDate) protected voidupdateMinDate(LocalDate minDate) protected voidupdateMonthGridOptions(Configuration.MonthGridOptions monthGridOptions) protected voidupdateTimeZone(ZoneId timeZone) protected voidupdateWeekOptions(Configuration.WeekOptions weekOptions) protected StringMethods inherited from class com.vaadin.flow.component.HtmlComponent
getTitle, setTitleMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.ClickNotifier
addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasOrderedComponents
getChildren, getComponentAt, getComponentCount, indexOf, replaceMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasText
getText, getWhiteSpace, setText, setWhiteSpace
-
Field Details
-
container
protected com.vaadin.flow.component.html.Div containerDiv containing the calendar.
-
-
Constructor Details
-
BaseScheduleXCalendar
public BaseScheduleXCalendar(List<? extends ViewType> views, com.vaadin.flow.data.provider.CallbackDataProvider<Event, EventQueryFilter> dataProvider, Configuration configuration) -
BaseScheduleXCalendar
public BaseScheduleXCalendar(List<? extends ViewType> views, com.vaadin.flow.data.provider.CallbackDataProvider<Event, EventQueryFilter> dataProvider, Configuration configuration, Map<String, Calendar> calendars)
-
-
Method Details
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
initCalendar
protected abstract void initCalendar(boolean refreshView) Initializes calendar with the initial configuration. -
refreshCalendar
public void refreshCalendar()Refreshes the calendar by re-initializing it with the most current configuration. This triggers a rebuild of the calendar component on the client side. -
viewsToJson
-
eventsToJson
-
configurationToJson
-
calendarsToJson
Serialize all calendars as a JSON object. Example: { "personal": { ... }, "work": { ... } } -
getDataProvider
-
setDataProvider
public void setDataProvider(com.vaadin.flow.data.provider.CallbackDataProvider<Event, EventQueryFilter> dataProvider) -
getConfiguration
Returns current calendar configuration.- Returns:
- the configuration of the calendar
-
onDetach
protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent) - Overrides:
onDetachin classcom.vaadin.flow.component.Component
-
getJsConnector
-
setView
Sets the calendar view.- Parameters:
view- the view to set
-
getView
Gets the current calendar view in display.- Returns:
- the current view
-
setDate
Sets the calendar date.- Parameters:
selectedDate- the date to set
-
updateDate
-
getDate
Gets the current date set in calendar.- Returns:
- current date
-
setFirstDayOfWeek
Set the first day of the week for the calendar. Value must be between 0 and 6 where 0 is Sunday, 1 is Monday etc.- Parameters:
firstDayOfWeek- day to be shown as first day of the week;
-
updateFirstDayOfWeek
-
getFirstDayOfWeek
Returns the day(number) shown as first day of the week in the calendars.- Returns:
- first day of the week
-
setLocale
Sets the language for the calendar. List of supported languages: https://schedule-x.dev/docs/calendar/language- Parameters:
locale- locale for the calendar
-
updateLocale
-
getLocale
Returns the current language/locale of the calendar.- Overrides:
getLocalein classcom.vaadin.flow.component.Component- Returns:
- the locale use by the calendar
-
setTimeZone
Sets the time zone of the calendar.- Parameters:
timeZone- the time zone of the calendar
-
updateTimeZone
-
getTimeZone
Returns the current time zone of the calendar.- Returns:
- the time zone use by the calendar
-
setViews
Sets the available views for the calendar. The views to be set must include the currently active view name. At least one view must be passed into this function.- Parameters:
views- the views to be shown by the calendar
-
getViews
Returns the current views in the calendar.- Returns:
- the views currently displayed in the calendar
-
setDayBoundaries
Sets the day boundaries of the calendar.- Parameters:
dayBoundaries- the day boundaries of the calendar
-
updateDayBoundaries
-
getDayBoundaries
Gets the day boundaries of the calendar.- Returns:
- the day boundaries of the calendar
-
setWeekOptions
Sets the week options of the calendar.- Parameters:
weekOptions- the week options of the calendar
-
updateWeekOptions
-
getWeekOptions
Gets the week options of the calendar.- Returns:
- the week options of the calendar
-
setCalendars
Sets the available calendars to be displayed in the calendar.- Parameters:
calendars- the calendars to be displayed in the calendar
-
getCalendars
Returns the available calendars displayed in the calendar.- Returns:
- the calendars displayed in the calendar
-
setMinDate
Sets the min date for the calendar navigation.- Parameters:
minDate- the min date for the calendar navigation
-
updateMinDate
-
getMinDate
Gets the min date for the calendar navigation.- Returns:
- the min date for the calendar navigation
-
setMaxDate
Sets the max date for the calendar navigation.- Parameters:
maxDate- the max date for the calendar navigation
-
updateMaxDate
-
getMaxDate
Sets the max date for the calendar navigation.- Returns:
- the max date for the calendar navigation
-
setMonthGridOptions
Sets the month grid options of the calendar.- Parameters:
monthGridOptions- the month grid options of the calendar
-
updateMonthGridOptions
-
getMonthGridOptions
Gets the month grid options of the calendar.- Returns:
- the month grid options of the calendar
-
addCalendarEventClickEventListener
public com.vaadin.flow.shared.Registration addCalendarEventClickEventListener(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.CalendarEventClickEvent> listener) Adds a CalendarEventClickEvent listener.- Parameters:
listener- the listener to be added- Returns:
- a handle that can be used for removing the listener
-
addSelectedDateUpdateEventListener
public com.vaadin.flow.shared.Registration addSelectedDateUpdateEventListener(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.SelectedDateUpdateEvent> listener) Adds a SelectedDateUpdateEvent listener.- Parameters:
listener- the listener to be added- Returns:
- a handle that can be used for removing the listener
-
addEvent
Adds the given event to the calendar.- Parameters:
event- calendar event to be added
-
removeEvent
Removes the event with given id from the calendar.- Parameters:
eventId- id of the event to be removed
-
updateEvent
Updates the given event.- Parameters:
event- the event to be updated
-
addCalendarEventAddedEventListener
public com.vaadin.flow.shared.Registration addCalendarEventAddedEventListener(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.CalendarEventAddedEvent> listener) Adds a CalendarEventAddedEvent listener.- Parameters:
listener- the listener to be added- Returns:
- a handle that can be used for removing the listener
-
addCalendarEventRemovedEventListener
public com.vaadin.flow.shared.Registration addCalendarEventRemovedEventListener(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.CalendarEventRemovedEvent> listener) Adds a CalendarEventRemovedEvent listener.- Parameters:
listener- the listener to be added- Returns:
- a handle that can be used for removing the listener
-
addCalendarEventUpdatedEventListener
public com.vaadin.flow.shared.Registration addCalendarEventUpdatedEventListener(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.CalendarEventUpdatedEvent> listener) Adds a CalendarEventUpdatedEvent listener.- Parameters:
listener- the listener to be added- Returns:
- a handle that can be used for removing the listener
-
addEventUpdateEventListener
public com.vaadin.flow.shared.Registration addEventUpdateEventListener(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.EventUpdateEvent> listener) Adds aEventUpdateEventlistener.- Parameters:
listener- the listener to be added- Returns:
- a handle that can be used for removing the listener
-
setDarkMode
public void setDarkMode(boolean dark) Programmatically sets the theme of the calendar to either dark or light mode.For more details, see the Schedule-X theme documentation.
- Parameters:
dark-trueto set the theme to dark mode,falsefor light mode
-
addCalendarViewAndDateChangeEvent
public com.vaadin.flow.shared.Registration addCalendarViewAndDateChangeEvent(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.CalendarViewAndDateChangeEvent> listener) Adds aCalendarViewAndDateChangeEventlistener.This event is dispatched from the client whenever the internal calendar state changes, including both the selected view and the selected date (e.g., due to screen resize).
- Parameters:
listener- the listener to be added- Returns:
- a handle that can be used for removing the listener
-