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="@schedule-x/calendar",version="2.31.0") @NpmPackage(value="@schedule-x/theme-default",version="2.31.0") @NpmPackage(value="@schedule-x/resize",version="2.31.0") @NpmPackage(value="@schedule-x/drag-and-drop",version="2.31.0") @NpmPackage(value="@schedule-x/current-time",version="2.31.0") @NpmPackage(value="@schedule-x/scroll-controller",version="2.31.0") @NpmPackage(value="@schedule-x/calendar-controls",version="2.31.0") @NpmPackage(value="@schedule-x/event-recurrence",version="2.31.0") @NpmPackage(value="@schedule-x/ical",version="2.31.0") @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:
  • Field Details

    • container

      protected com.vaadin.flow.component.html.Div container
      Div containing the calendar.
  • Constructor Details

  • Method Details

    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.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

      protected String viewsToJson()
    • eventsToJson

      protected String eventsToJson(LocalDateTime start, LocalDateTime end)
    • configurationToJson

      protected String configurationToJson()
    • calendarsToJson

      protected String calendarsToJson()
      Serialize all calendars as a JSON object. Example: { "personal": { ... }, "work": { ... } }
    • getDataProvider

      public com.vaadin.flow.data.provider.CallbackDataProvider<Event,EventQueryFilter> getDataProvider()
    • setDataProvider

      public void setDataProvider(com.vaadin.flow.data.provider.CallbackDataProvider<Event,EventQueryFilter> dataProvider)
    • getConfiguration

      public Configuration getConfiguration()
      Returns current calendar configuration.
      Returns:
      the configuration of the calendar
    • onDetach

      protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
      Overrides:
      onDetach in class com.vaadin.flow.component.Component
    • getJsConnector

      protected abstract String getJsConnector()
    • setView

      public void setView(ViewType view)
      Sets the calendar view.
      Parameters:
      view - the view to set
    • getView

      public ViewType getView()
      Gets the current calendar view in display.
      Returns:
      the current view
    • setDate

      public void setDate(LocalDate selectedDate)
      Sets the calendar date.
      Parameters:
      selectedDate - the date to set
    • updateDate

      protected void updateDate(LocalDate selectedDate)
    • getDate

      public LocalDate getDate()
      Gets the current date set in calendar.
      Returns:
      current date
    • setFirstDayOfWeek

      public void setFirstDayOfWeek(Integer firstDayOfWeek)
      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

      protected void updateFirstDayOfWeek(Integer firstDayOfWeek)
    • getFirstDayOfWeek

      public Integer getFirstDayOfWeek()
      Returns the day(number) shown as first day of the week in the calendars.
      Returns:
      first day of the week
    • setLocale

      public void setLocale(Locale locale)
      Sets the language for the calendar. List of supported languages: https://schedule-x.dev/docs/calendar/language
      Parameters:
      locale - locale for the calendar
    • updateLocale

      protected void updateLocale(Locale locale)
    • getLocale

      public Locale getLocale()
      Returns the current language/locale of the calendar.
      Overrides:
      getLocale in class com.vaadin.flow.component.Component
      Returns:
      the locale use by the calendar
    • setViews

      public void setViews(List<? extends ViewType> views)
      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

      public List<? extends ViewType> getViews()
      Returns the current views in the calendar.
      Returns:
      the views currently displayed in the calendar
    • setDayBoundaries

      public void setDayBoundaries(Configuration.DayBoundaries dayBoundaries)
      Sets the day boundaries of the calendar.
      Parameters:
      dayBoundaries - the day boundaries of the calendar
    • updateDayBoundaries

      protected void updateDayBoundaries(Configuration.DayBoundaries dayBoundaries)
    • getDayBoundaries

      public Configuration.DayBoundaries getDayBoundaries()
      Gets the day boundaries of the calendar.
      Returns:
      the day boundaries of the calendar
    • setWeekOptions

      public void setWeekOptions(Configuration.WeekOptions weekOptions)
      Sets the week options of the calendar.
      Parameters:
      weekOptions - the week options of the calendar
    • updateWeekOptions

      protected void updateWeekOptions(Configuration.WeekOptions weekOptions)
    • getWeekOptions

      public Configuration.WeekOptions getWeekOptions()
      Gets the week options of the calendar.
      Returns:
      the week options of the calendar
    • setCalendars

      public void setCalendars(Map<String,Calendar> calendars)
      Sets the available calendars to be displayed in the calendar.
      Parameters:
      calendars - the calendars to be displayed in the calendar
    • getCalendars

      public Map<String,Calendar> getCalendars()
      Returns the available calendars displayed in the calendar.
      Returns:
      the calendars displayed in the calendar
    • setMinDate

      public void setMinDate(LocalDate minDate)
      Sets the min date for the calendar navigation.
      Parameters:
      minDate - the min date for the calendar navigation
    • updateMinDate

      protected void updateMinDate(LocalDate minDate)
    • getMinDate

      public LocalDate getMinDate()
      Gets the min date for the calendar navigation.
      Returns:
      the min date for the calendar navigation
    • setMaxDate

      public void setMaxDate(LocalDate maxDate)
      Sets the max date for the calendar navigation.
      Parameters:
      maxDate - the max date for the calendar navigation
    • updateMaxDate

      protected void updateMaxDate(LocalDate maxDate)
    • getMaxDate

      public LocalDate getMaxDate()
      Sets the max date for the calendar navigation.
      Returns:
      the max date for the calendar navigation
    • setMonthGridOptions

      public void setMonthGridOptions(Configuration.MonthGridOptions monthGridOptions)
      Sets the month grid options of the calendar.
      Parameters:
      monthGridOptions - the month grid options of the calendar
    • updateMonthGridOptions

      protected void updateMonthGridOptions(Configuration.MonthGridOptions monthGridOptions)
    • getMonthGridOptions

      public Configuration.MonthGridOptions 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

      public void addEvent(Event event)
      Adds the given event to the calendar.
      Parameters:
      event - calendar event to be added
    • removeEvent

      public void removeEvent(String eventId)
      Removes the event with given id from the calendar.
      Parameters:
      eventId - id of the event to be removed
    • updateEvent

      public void updateEvent(Event event)
      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 a EventUpdateEvent listener.
      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 - true to set the theme to dark mode, false for light mode
    • addCalendarViewAndDateChangeEvent

      public com.vaadin.flow.shared.Registration addCalendarViewAndDateChangeEvent(com.vaadin.flow.component.ComponentEventListener<BaseScheduleXCalendar.CalendarViewAndDateChangeEvent> listener)
      Adds a CalendarViewAndDateChangeEvent listener.

      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