Class JmixFullCalendar

java.lang.Object
com.vaadin.flow.component.Component
io.jmix.fullcalendarflowui.kit.component.JmixFullCalendar
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, Serializable
Direct Known Subclasses:
FullCalendar

@Tag("jmix-full-calendar") @NpmPackage(value="@fullcalendar/core",version="6.1.15") @NpmPackage(value="@fullcalendar/interaction",version="6.1.15") @NpmPackage(value="@fullcalendar/daygrid",version="6.1.15") @NpmPackage(value="@fullcalendar/timegrid",version="6.1.15") @NpmPackage(value="@fullcalendar/list",version="6.1.15") @NpmPackage(value="@fullcalendar/multimonth",version="6.1.15") @NpmPackage(value="@fullcalendar/moment-timezone",version="6.1.15") @NpmPackage(value="@fullcalendar/moment",version="6.1.15") @JsModule("./src/fullcalendar/jmix-full-calendar.js") @CssImport("./src/fullcalendar/jmix-full-calendar.css") public class JmixFullCalendar extends com.vaadin.flow.component.Component implements com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle
See Also:
  • Field Details

    • serializer

      protected JmixFullCalendarSerializer serializer
    • deserializer

      protected JmixFullCalendarDeserializer deserializer
    • options

      protected JmixFullCalendarOptions options
    • jsonFactory

      protected elemental.json.JsonFactory jsonFactory
    • displayMode

      protected CalendarDisplayMode displayMode
    • currentDate

      protected LocalDate currentDate
    • itemsDataProvidersExecutionMap

      protected Map<String,com.vaadin.flow.internal.StateTree.ExecutionRegistration> itemsDataProvidersExecutionMap
    • synchronizeOptionsExecution

      protected com.vaadin.flow.internal.StateTree.ExecutionRegistration synchronizeOptionsExecution
    • incrementalUpdateExecution

      protected com.vaadin.flow.internal.StateTree.ExecutionRegistration incrementalUpdateExecution
    • datesSetDomRegistration

      protected com.vaadin.flow.shared.Registration datesSetDomRegistration
    • moreLinkClickDomRegistration

      protected com.vaadin.flow.shared.Registration moreLinkClickDomRegistration
    • eventClickDomRegistration

      protected com.vaadin.flow.shared.Registration eventClickDomRegistration
    • eventMouseEnterDomRegistration

      protected com.vaadin.flow.shared.Registration eventMouseEnterDomRegistration
    • eventMouseLeaveDomRegistration

      protected com.vaadin.flow.shared.Registration eventMouseLeaveDomRegistration
    • eventDropDomRegistration

      protected com.vaadin.flow.shared.Registration eventDropDomRegistration
    • eventResizeDomRegistration

      protected com.vaadin.flow.shared.Registration eventResizeDomRegistration
    • dateClickDomRegistration

      protected com.vaadin.flow.shared.Registration dateClickDomRegistration
    • selectDomRegistration

      protected com.vaadin.flow.shared.Registration selectDomRegistration
    • unselectDomRegistration

      protected com.vaadin.flow.shared.Registration unselectDomRegistration
    • dayNavigationLinkClickDomRegistration

      protected com.vaadin.flow.shared.Registration dayNavigationLinkClickDomRegistration
    • weekNavigationLinkClickDomRegistration

      protected com.vaadin.flow.shared.Registration weekNavigationLinkClickDomRegistration
    • initialized

      protected boolean initialized
  • Constructor Details

    • JmixFullCalendar

      public JmixFullCalendar()
  • Method Details

    • getInitialCalendarDisplayMode

      @Nullable public CalendarDisplayMode getInitialCalendarDisplayMode()
      Returns:
      initial calendar display mode or null if not set
    • setInitialCalendarDisplayMode

      public void setInitialCalendarDisplayMode(CalendarDisplayMode displayMode)
      Sets initial calendar display mode that will be shown after attaching component to th UI.

      The default value is CalendarDisplayModes.DAY_GRID_MONTH.

      The property change is not applied after component attached to the UI.

      Parameters:
      displayMode - initial calendar display mode
    • getCurrentCalendarDisplayMode

      public CalendarDisplayMode getCurrentCalendarDisplayMode()
      Returns:
      current calendar display mode
    • setCalendarDisplayMode

      public void setCalendarDisplayMode(CalendarDisplayMode displayMode)
      Switches currently shown display mode to the provided one.
      Parameters:
      displayMode - calendar display mode to set
    • addCustomCalendarDisplayMode

      public void addCustomCalendarDisplayMode(CustomCalendarDisplayMode displayMode)
      Adds custom display mode to the calendar. Then custom display mode can be shown by: Note that it is initial option and dynamically changing/adding/removing custom display modes will not apply after attaching component to the UI.
      Parameters:
      displayMode - custom calendar display mode to add
    • removeCustomCalendarDisplayMode

      public void removeCustomCalendarDisplayMode(CustomCalendarDisplayMode customDisplayMode)
      Removes custom calendar display mode.

      Note that it is initial option and dynamically changing/adding/removing custom display modes will not apply after attaching component to UI.

      Parameters:
      customDisplayMode - custom calendar display mode to remove
    • getCustomCalendarDisplayMode

      @Nullable public CustomCalendarDisplayMode getCustomCalendarDisplayMode(String id)
      Returns custom calendar display mode by its ID.
      Parameters:
      id - the ID of custom calendar display mode
      Returns:
      custom calendar display mode or null if there is no display mode with the provided ID
    • getCustomCalendarDisplayModes

      public List<CustomCalendarDisplayMode> getCustomCalendarDisplayModes()
      Returns:
      list of custom calendar display modes added to the component
    • getCalendarDisplayModeProperties

      public <T extends AbstractCalendarDisplayModeProperties> T getCalendarDisplayModeProperties(CalendarDisplayModes displayMode)
      Returns properties for the specific calendar display mode. Almost all calendar display modes have a specific set of properties. Moreover, the properties object can override some properties from the component.
      Type Parameters:
      T - type of display mode properties
      Parameters:
      displayMode - calendar display mode to get properties
      Returns:
      properties object that correspond to the provided calendar display mode
    • isWeekNumbersVisible

      public boolean isWeekNumbersVisible()
      Returns:
      true if week numbers are visible
    • setWeekNumbersVisible

      public void setWeekNumbersVisible(boolean weekNumbersVisible)
      Sets whether week numbers should be displayed on the calendar.

      The default value is false.

      Parameters:
      weekNumbersVisible - whether to show week numbers
    • getValidRangeStart

      @Nullable public LocalDate getValidRangeStart()
      Returns:
      the start date of valid range or null if not set
    • setValidRangeStart

      public void setValidRangeStart(@Nullable LocalDate start)
      Sets the start date of valid range.

      See for more information setValidRange(LocalDate, LocalDate).

      Parameters:
      start - the start date or null to reset value
    • getValidRangeEnd

      @Nullable public LocalDate getValidRangeEnd()
      Returns:
      the end date of valid range or null if not set
    • setValidRangeEnd

      public void setValidRangeEnd(@Nullable LocalDate end)
      Sets the end date of valid range.

      See for more information setValidRange(LocalDate, LocalDate).

      Parameters:
      end - the end date or null to reset value
    • setValidRange

      public void setValidRange(@Nullable LocalDate start, @Nullable LocalDate end)
      Sets the date range where the user can navigate and where events can be displayed.

      Dates outside the valid range will be grayed-out. The user will not be able to drag or resize events into these areas.

      The end date is exclusive. For example, if valid range is 2024-09-01 to 2024-09-10, the September 10th day is not included in the range and will be disabled.

      Navigation methods won't navigate to invalid range.

      Parameters:
      start - start date of valid range or null to reset value
      end - end date of valid range or null to reset value
    • getVisibleRangeStart

      @Nullable public LocalDate getVisibleRangeStart()
      Returns:
      start date of visible range or null if not set
    • getVisibleRangeEnd

      @Nullable public LocalDate getVisibleRangeEnd()
      Returns:
      end date of visible range or null if not set
    • setVisibleRange

      public void setVisibleRange(LocalDate start, LocalDate end)
      The visible date range is applied together with generic calendar display modes GenericCalendarDisplayModes. For instance, you can set GenericCalendarDisplayModes.DAY_GRID, visible range from 2024-09-01 to 2024-09-03 and component will show two days.

      Note the end date is exclusive.

      Parameters:
      start - start date of visible range
      end - end date of visible range
    • getTimeZone

      @Nullable public TimeZone getTimeZone()
      Returns:
      component's timezone or null if not set
    • setTimeZone

      public void setTimeZone(@Nullable TimeZone timeZone)
      Sets the timezone to the component.

      The default value is user's timezone. If user does not have a timezone, the system default will be used.

      Parameters:
      timeZone - timezone to set
    • getDate

      public LocalDate getDate()
      Returns a date for the current date of the calendar.

      For month view, it will always be a date between the first and last day of the month. For week views, it will always be a date between the first and last day of the week.

      Returns:
      the current date of the calendar
    • scrollToTime

      public void scrollToTime(Long duration)
      Scrolls to the specified time in milliseconds.

      Scrolling to a specific time works when the calendar display mode is either CalendarDisplayModes.TIME_GRID_DAY or CalendarDisplayModes.TIME_GRID_WEEK.

      Parameters:
      duration - the time duration
    • scrollToTime

      public void scrollToTime(LocalTime localTime)
      Scrolls to the specified time.

      Scrolling to a specific time works when the calendar display mode is either CalendarDisplayModes.TIME_GRID_DAY or CalendarDisplayModes.TIME_GRID_WEEK.

      Parameters:
      localTime - the time to scroll
    • select

      public void select(LocalDateTime start)
      Selects a time range that starts from specified time to next 24h.
      Parameters:
      start - date-time to select
    • select

      public void select(LocalDateTime start, boolean allDay)
      Selects a time range that starts from specified time to next 24h. If all-day is true the all-day cell will be selected.
      Parameters:
      start - date-time to select
      allDay - whether to select all-day cell
    • select

      public void select(LocalDateTime start, LocalDateTime end)
      Selects the date-time range.
      Parameters:
      start - start date-time of selection
      end - end date-time of selection
    • select

      public void select(LocalDateTime start, LocalDateTime end, boolean allDay)
      Selects the date-time range. If all-day is true the all-day cell(s) will be selected.
      Parameters:
      start - start date-time of selection
      end - end date-time of selection
      allDay - whether to select all-day cell(s)
    • unselect

      public void unselect()
      Clears the current selection.
    • isNavigationLinksEnabled

      public boolean isNavigationLinksEnabled()
      Returns:
      true if navigation to date by day and week names is enabled
    • setNavigationLinksEnabled

      public void setNavigationLinksEnabled(boolean enabled)
      Enables navigation to date using day names and week names.

      The default value is false.

      Parameters:
      enabled - whether to enable navigation
    • isDefaultDayMaxEventRowsEnabled

      public boolean isDefaultDayMaxEventRowsEnabled()
      Returns:
      true if the component should limit the number of events by height of the day cell
    • setDefaultDayMaxEventRowsEnabled

      public void setDefaultDayMaxEventRowsEnabled(boolean enabled)
      Limits the maximum number of stacked events within a given day.
      • true - limits the number of events by height of the day cell.
      • false - component displays all events as is.
      This property is applied for day-grid display modes and in all-day cells.

      The default value false.

      Parameters:
      enabled - whether to limit the number of events
    • getDayMaxEventRows

      @Nullable public Integer getDayMaxEventRows()
      Returns:
      the maximum rows count of events including "more" row or null if not set
    • setDayMaxEventRows

      public void setDayMaxEventRows(@Nullable Integer maxEventRows)
      Sets rows count of events in day-grid display modes and in "all-day" section in time-grid display modes.

      Note that "more" row is included to count. For instance, if dayMaxEventRows = 1, only the "more" row will be shown.

      Takes precedence over the setDefaultDayMaxEventRowsEnabled(boolean).

      Parameters:
      maxEventRows - maximum value of event rows in cell
    • isDefaultDayMaxEventsEnabled

      public boolean isDefaultDayMaxEventsEnabled()
      Returns:
      true if the component should limit the number of events by height of the day cell
    • setDefaultDayMaxEventsEnabled

      public void setDefaultDayMaxEventsEnabled(boolean enabled)
      Limits the maximum number of stacked events within a given day.
      • true - limits the number of events by height of the day cell.
      • false - component displays all events as is.
      This property is applied for day-grid display modes and in all-day cells.

      The default value false.

      Parameters:
      enabled - whether to limit the number of events
    • getDayMaxEvents

      @Nullable public Integer getDayMaxEvents()
      Returns:
      the maximum rows count of events excluding "more" row or null if not set
    • setDayMaxEvents

      public void setDayMaxEvents(@Nullable Integer maxRows)
      Sets rows count of events in day-grid display modes and in "all-day" section in time-grid display modes.

      Note that "more" row is not included to count. For instance, if dayMaxEventRows = 1, one event and the "more" row will be shown.

      Takes precedence over the setDefaultDayMaxEventsEnabled(boolean).

      Parameters:
      maxRows - maximum value of event rows in cell excluding "more" row
    • getEventMaxStack

      @Nullable public Integer getEventMaxStack()
      Returns:
      maximum number of events to stack or null if not set
    • setEventMaxStack

      public void setEventMaxStack(@Nullable Integer eventMaxStack)
      Sets the maximum number of events that stack top-to-bottom for time-grid display modes.
      Parameters:
      eventMaxStack - the maximum number of events that stack. The null or -1 values set default behaviour.
    • getMoreLinkCalendarDisplayMode

      @Nullable public CalendarDisplayMode getMoreLinkCalendarDisplayMode()
      Returns:
      the calendar display mode that should be shown when "more" more link is clicked or null if not set
    • setMoreLinkCalendarDisplayMode

      public void setMoreLinkCalendarDisplayMode(@Nullable CalendarDisplayMode displayMode)
      Sets the calendar display mode that should be shown when "more" link is clicked.
      Parameters:
      displayMode - the display mode that should be opened
    • getMoreLinkClassNames

      public List<String> getMoreLinkClassNames()
      Returns:
      list of CSS class names added to "more" link
    • setMoreLinkClassNames

      public void setMoreLinkClassNames(@Nullable List<String> classNames)
      Sets CSS class names that should be added to "more" link.
      Parameters:
      classNames - class names to set
    • addMoreLinkClassName

      public void addMoreLinkClassName(String className)
      Adds CSS class name to "more" link.
      Parameters:
      className - class name to add
    • addMoreLinkClassNames

      public void addMoreLinkClassNames(String... classNames)
      Adds class names to "more" link.
      Parameters:
      classNames - class names to add
    • removeMoreLinkClassName

      public void removeMoreLinkClassName(String className)
      Removes CSS class name from "more" link.
      Parameters:
      className - class name to remove
    • removeAllMoreLinkClassName

      public void removeAllMoreLinkClassName()
      Removes all CSS class names from "more" link.
    • isEventStartEditable

      public boolean isEventStartEditable()
      Returns:
      true if event start time is editable
    • setEventStartEditable

      public void setEventStartEditable(boolean editable)
      Enables to edit event start time using dragging.

      Note, this property can be overridden on per-event by CalendarEvent#getStartEditable() property.

      The default value is false.

      Parameters:
      editable - whether to enable editing event start time
    • isEventDurationEditable

      public boolean isEventDurationEditable()
      Returns:
      true if event duration is editable
    • setEventDurationEditable

      public void setEventDurationEditable(boolean editable)
      Enables to edit event duration using resizing.

      Note, this property can be overridden on per-event by durationEditable property.

      The default value is false.

      Parameters:
      editable - whether to edit event duration
    • isEventResizableFromStart

      public boolean isEventResizableFromStart()
      Returns:
      true if an event is resizable from start date
    • setEventResizableFromStart

      public void setEventResizableFromStart(boolean resizableFromStart)
      Enables to resize an event from its starting date.

      The default value is false.

      Parameters:
      resizableFromStart - whether to resize an event from start
    • getEventDragMinDistance

      @Nullable public Integer getEventDragMinDistance()
      Returns:
      drag minimum distance in pixels or null if not set
    • setEventDragMinDistance

      public void setEventDragMinDistance(@Nullable Integer minDistance)
      Sets how many pixels the user’s mouse/touch must move before an event drag activates.

      The default value is 5.

      Parameters:
      minDistance - minimum distance in pixels
    • getDragRevertDuration

      @Nullable public Integer getDragRevertDuration()
      Returns:
      duration in milliseconds or null if not set
    • setDragRevertDuration

      public void setDragRevertDuration(@Nullable Integer revertDuration)
      Sets the time it takes for an event to revert to its original position after an unsuccessful drag.

      The default value is 500.

      Parameters:
      revertDuration - duration in milliseconds
    • isDragScroll

      public boolean isDragScroll()
      Returns:
      true if component scrolls content during event drag-and-drop and date selecting
    • setDragScroll

      public void setDragScroll(boolean enabled)
      Enables to automatically scroll the scroll-containers during event drag-and-drop and date selecting.

      The default value is true.

      The property change is not applied after component attached to the UI.

      Parameters:
      enabled - whether to enable scrolling
    • getSnapDuration

      @Nullable public CalendarDuration getSnapDuration()
      Returns:
      snap duration or null if not set
    • setSnapDuration

      public void setSnapDuration(@Nullable CalendarDuration snapDuration)
      Sets a value that determines the time interval at which a dragged event will snap to the time axis. This also affects the granularity at which selections can be made.

      The default value is taken from getSlotDuration().

      Parameters:
      snapDuration - duration to set
    • isAllMaintainDurationEnabled

      public boolean isAllMaintainDurationEnabled()
      Returns:
      true if the duration will remain roughly the same before and after it is dragged to or from an all-day section
    • setAllDayMaintainDurationEnabled

      public void setAllDayMaintainDurationEnabled(boolean enabled)
      Determines how an event’s duration should be mutated when it is dragged from a timed section to an all-day section and vice versa.
      • true - the duration will remain roughly the same before and after it is dragged to or from an all-day section. "Roughly" because if an event has a duration with hourly precision, it will be rounded down to the nearest whole-day.
      • false - the event’s duration will be reset to getDefaultAllDayEventDuration() if it is being dropped in an all-day section or getDefaultTimedEventDuration() if it is being dropped in a timed section
      The default value is false.
      Parameters:
      enabled - whether to maintain duration
    • isEventOverlap

      public boolean isEventOverlap()
      Returns:
      true if events can overlap other events during dragging and resizing
    • setEventOverlap

      public void setEventOverlap(boolean enabled)
      Allows events to overlap each other during dragging and resizing.

      The default value is true.

      Parameters:
      enabled - whether to enable event overlap
    • getEventOverlapJsFunction

      @Nullable public JsFunction getEventOverlapJsFunction()
      Returns:
      event overlap JavaScript function or null if not set
    • setEventOverlapJsFunction

      public void setEventOverlapJsFunction(@Nullable JsFunction jsFunction)
      Sets JavaScript function definition that will be executed every time when an event is dragged/resized to cell with other events. The function should return true if an event can overlap other event or false otherwise.

      For instance, function enables event overlapping if events are all-day:

      
       calendar.setEventOverlapJsFunction(new JsFunction("""
               function(stillEvent, movingEvent) {
                   return stillEvent.allDay && movingEvent.allDay;
               }
               """));
       
      The stillEvent is the event underneath the moving event.

      The movingEvent is the event that is being dragged or resized. Its start and end dates will remain at their original values when the function is called.

      The available properties of movingEvent and stillEvent you can find in FullCalendar docs

      Note that JavaScript function takes precedence over the setEventOverlap(boolean). And JavaScript function can be overridden by calendar event's "overlap" property value.

      Parameters:
      jsFunction - JavaScript function
    • isSelectionEnabled

      public boolean isSelectionEnabled()
      Returns:
      true if day or time selection is enabled
    • setSelectionEnabled

      public void setSelectionEnabled(boolean enabled)
      Allows the user to highlight multiple days or timeslots by clicking and dragging.

      The default value is false.

      Parameters:
      enabled - whether to enable selection
    • isSelectMirror

      public boolean isSelectMirror()
      Returns:
      true if component draws an event while the users is dragging
    • setSelectMirror

      public void setSelectMirror(boolean selectMirror)
      Enables the drawing of a placeholder event while the user is dragging.

      This property applies to time-grid display modes.

      The default value is false.

      Parameters:
      selectMirror - whether to draw a placeholder event
    • isUnselectAuto

      public boolean isUnselectAuto()
      Returns:
      true if selection should be cleared when clicking on the page
    • setUnselectAuto

      public void setUnselectAuto(boolean unselectAuto)
      Sets whether clicking elsewhere on the page will clear the current selection. Works only if isSelectionEnabled() is true.

      The default value is true.

      The property change is not applied after component attached to the UI.

      Parameters:
      unselectAuto - whether option is unselectAuto
    • getUnselectCancelSelector

      @Nullable public String getUnselectCancelSelector()
      Returns:
      the CSS selector or null if not set
    • setUnselectCancelSelector

      public void setUnselectCancelSelector(@Nullable String cssSelector)
      Sets the CSS selector that will ignore the isUnselectAuto() property. For instance:

      vaadin-form-layout .custom-text-input.

      The property change is not applied after component attached to the UI.

      Parameters:
      cssSelector - CSS selector, e.g. ".my-element"
    • isSelectOverlap

      public boolean isSelectOverlap()
      Returns:
      true if selection of cells with events is enabled
    • setSelectOverlap

      public void setSelectOverlap(boolean selectOverlap)
      Enables to select cells that contains events.

      The default value is true.

      Parameters:
      selectOverlap - whether to enable selecting cells with events
    • getSelectOverlapJsFunction

      @Nullable public JsFunction getSelectOverlapJsFunction()
      Returns:
      select overlap function or null if not set
    • setSelectOverlapJsFunction

      public void setSelectOverlapJsFunction(@Nullable JsFunction jsFunction)
      Sets JavaScript function definition that will be executed every time when the user selection tries to occupy cells with events. The function should return true if a selection can be performed for cell with the provided event or false otherwise.

      For instance, function enables selection if event is a background:

      
       calendar.setSelectOverlapJsFunction(new JsFunction("""
               function (event) {
                   return event.display === 'background';
               }
               """));
       
      The event is the event in the cell.

      The available properties of event you can find in FullCalendar docs

      Parameters:
      jsFunction - JavaScript function
    • getSelectAllowJsFunction

      @Nullable public JsFunction getSelectAllowJsFunction()
      Returns:
      select allow JavaScript function or null if not set
    • setSelectAllowJsFunction

      public void setSelectAllowJsFunction(@Nullable JsFunction jsFunction)
      Sets JavaScript function definition that will be executed every time when the user drags selection to cells. The function should return true if a selection can be performed for cell with the provided date range or false otherwise.

      For instance, the function enables selection for today's date and futures:

      
       calendar.setSelectAllowJsFunction(new JsFunction("""
               function(selectionInfo) {
                   const currentDate = new Date();
                   currentDate.setHours(0, 0, 0, 0);
                   return currentDate < selectionInfo.end;
               }
               """)
       
      The selectionInfo is object that contains information about date range.

      The available properties of selectionInfo you can find in FullCalendar docs

      Parameters:
      jsFunction - JavaScript function
    • getSelectMinDistance

      public int getSelectMinDistance()
      Returns:
      the minimum distance the user’s mouse must travel after a mousedown, before a selection is allowed
    • setSelectMinDistance

      public void setSelectMinDistance(int minDistance)
      Sets the minimum distance the user’s mouse must travel after a mousedown, before a selection is allowed. A non-zero value is useful for differentiating a selection from a date click event.

      This property is only applicable to mouse-related interaction. For touch interaction, see setSelectLongPressDelay(Integer).

      The default value is 0.

      The property change is not applied after component attached to the UI.

      Parameters:
      minDistance - minimum distance in pixels
    • getDefaultDayPopoverFormat

      @Nullable public String getDefaultDayPopoverFormat()
      Returns:
      the day popover format or null if not set
    • setDefaultDayPopoverFormat

      public void setDefaultDayPopoverFormat(@Nullable String format)
      Sets the date format of title of the popover that is shown when "more" link is clicked. By default, component sets localized format from messages when is created.

      This property act as default format for all display modes and for CustomCalendarDisplayMode until specific property won't be set for these display modes. However, all display-mode properties objects by default explicitly specify the format, thus they override this property.

      As component uses moment plugin for FullCalendar, we should follow the moment.js formatting rules: Moment.js Documentation. For instance, the "MMM D, YY" produces Sep 9, 24.

      The property change is not applied after component attached to the UI.

      Parameters:
      format - format to set
    • getDefaultDayHeaderFormat

      @Nullable public String getDefaultDayHeaderFormat()
      Returns:
      the day header format or null if not set
    • setDefaultDayHeaderFormat

      public void setDefaultDayHeaderFormat(@Nullable String format)
      Sets the format of the text that will be displayed on the calendar’s column headings. By default, component sets localized format from messages when is created.

      This property act as default format for all display modes and for CustomCalendarDisplayMode until specific property won't be set for these display modes. However, all display-mode properties objects by default explicitly specify the format, thus they override this property.

      As component uses moment plugin for FullCalendar, we should follow the moment.js formatting rules: Moment.js Documentation. For instance, the "dd" produces Mo.

      The property change is not applied after component attached to the UI.

      Parameters:
      format - format to set
    • getDefaultWeekNumberFormat

      @Nullable public String getDefaultWeekNumberFormat()
      Returns:
      the format of the week number or null if not set
    • setDefaultWeekNumberFormat

      public void setDefaultWeekNumberFormat(@Nullable String format)
      Sets the format of the week number that will be displayed when isWeekNumbersVisible() is true. By default, component sets localized format from messages when is created.

      This property act as default format for all display modes and for CustomCalendarDisplayMode until specific property won't be set for these display modes. However, all display-mode properties objects by default explicitly specify the format, thus they override this property.

      As component uses moment plugin for FullCalendar, we should follow the moment.js formatting rules: Moment.js Documentation. For instance, the "[Week] w" produces Week 1 (1, 2, ... 52, 53).

      The property change is not applied after component attached to the UI.

      Parameters:
      format - format to set
    • getDefaultSlotLabelFormat

      @Nullable public String getDefaultSlotLabelFormat()
      Returns:
      the slot label format or null if not set
    • setDefaultSlotLabelFormat

      public void setDefaultSlotLabelFormat(@Nullable String format)
      Sets the format of the text that will be displayed within a time slot. By default, component sets localized format from messages when is created.

      This property act as default format for all display modes and for CustomCalendarDisplayMode until specific property won't be set for these display modes. However, all display-mode properties objects by default explicitly specify the format, thus they override this property.

      As component uses moment plugin for FullCalendar, we should follow the moment.js formatting rules: Moment.js Documentation. For instance, the "ha" produces 1 am (1, 2, ... 12 am/pm).

      The property change is not applied after component attached to the UI.

      Parameters:
      format - format to set
    • getDefaultEventTimeFormat

      @Nullable public String getDefaultEventTimeFormat()
      Returns:
      the event time format or null if not set
    • setDefaultEventTimeFormat

      public void setDefaultEventTimeFormat(@Nullable String format)
      Sets the format of the time-text that will be displayed on each event. By default, component sets localized format from messages when is created.

      This property act as default format for all display modes and for CustomCalendarDisplayMode until specific property won't be set for these display modes. However, all display-mode properties objects by default explicitly specify the format, thus they override this property.

      As component uses moment plugin for FullCalendar, we should follow the moment.js formatting rules: Moment.js Documentation. For instance, the "HH:mm" produces 00:00 (01, 2, ... 23 : 01, 02 ... 59).

      The property change is not applied after component attached to the UI.

      Parameters:
      format - format to set
    • isWeekendsVisible

      public boolean isWeekendsVisible()
      Returns:
      true if weekends are visible
    • setWeekendsVisible

      public void setWeekendsVisible(boolean visible)
      Sets whether to include Saturday and Sunday columns in any of the calendar display modes.

      The default value is true

      Parameters:
      visible - whether to show weekends
    • isDayHeadersVisible

      public boolean isDayHeadersVisible()
      Returns:
      true if day headers are visible
    • setDayHeadersVisible

      public void setDayHeadersVisible(boolean visible)
      Sets whether the day headers should appear. It works for day-grid, time-grid and month display modes.

      The default value is true.

      Parameters:
      visible - whether to show day headers
    • getSlotDuration

      @Nullable public CalendarDuration getSlotDuration()
      Returns:
      the interval for displaying time slots or null if not set
    • setSlotDuration

      public void setSlotDuration(@Nullable CalendarDuration duration)
      Sets the interval at which time slots are displayed.

      The default value is 30 minutes.

      Parameters:
      duration - the interval to set
    • getSlotLabelInterval

      @Nullable public CalendarDuration getSlotLabelInterval()
      Returns:
      the frequency for labeling time slots with text or null if not set
    • setSlotLabelInterval

      public void setSlotLabelInterval(@Nullable CalendarDuration duration)
      Sets the frequency for labeling time slots with text.

      If not specified, a reasonable value will be automatically computed based on getSlotDuration().

      When specifying this property, give the CalendarDuration.ofHours(1) value, this will cause the header labels to appear on the hour marks, even if getSlotDuration() was hypothetically 15 or 30 minutes long.

      Parameters:
      duration - the interval to set
    • getSlotMinTime

      @Nullable public CalendarDuration getSlotMinTime()
      Returns:
      thr slot minimum time or null if not set
    • setSlotMinTime

      public void setSlotMinTime(@Nullable CalendarDuration slotMinTime)
      Sets the first time slot that will be displayed for each day.

      The default value is 00:00:00. It means the start time will be at the very beginning of the day (midnight). Determines the first time slot, even when the scrollbars have been scrolled all the way back.

      Parameters:
      slotMinTime - slot minimum time to set
    • getSlotMaxTime

      @Nullable public CalendarDuration getSlotMaxTime()
      Returns:
      the slot maximum time or null if not set
    • setSlotMaxTime

      public void setSlotMaxTime(@Nullable CalendarDuration slotMaxTime)
      Sets the last time slot that will be displayed for each day. The specified value represents the exclusive end time, meaning the time slot ending at this value will not be included.

      The default value is 24:00:00. It means that the end time will be at the very end of the day (midnight). Determines the last slot, even when the scrollbars have been scrolled all the way back.

      Parameters:
      slotMaxTime - the slot maximum time
    • getScrollTime

      @Nullable public CalendarDuration getScrollTime()
      Returns:
      the scroll time or null if not set
    • setScrollTime

      public void setScrollTime(@Nullable CalendarDuration scrollTime)
      Sets the initial scroll position to a specific time.

      The user will be able to scroll back to see events before this time. If you want to prevent users from doing this, use the setSlotMinTime(CalendarDuration) instead.

      By default, scroll time is reapplied to the calendar whenever the date range changes. To disable this, set setScrollTimeReset(boolean) to false.

      The default value is 06:00:00.

      The property change is not applied after component attached to the UI.

      Parameters:
      scrollTime - the time to scroll to
    • isScrollTimeReset

      public boolean isScrollTimeReset()
      Returns:
      true if the scroll position should be reset every time
    • setScrollTimeReset

      public void setScrollTimeReset(boolean scrollTimeReset)
      Sets whether the calendar should scroll to getScrollTime() every time the date range changes.

      By default, whenever the date range changes either via calendar methods or the user actions, the scroll is reset. Set to false to disable this behaviour.

      The default value is true.

      Parameters:
      scrollTimeReset - whether to reset scroll
    • isDefaultAllDay

      public boolean isDefaultAllDay()
      Returns:
      true if events without allDay property is shown as all-day
    • setDefaultAllDay

      public void setDefaultAllDay(boolean defaultAllDay)
      Sets the default value for each calendar event's allDay property when it is unspecified.

      If the property is set to true, all events without allDay property (e.g. is not specified mapping in data provider or calendar event returns null for getAllDay()) will be considered as all-day events.

      Note, in this case, events without allDay property will be shown as all-day events. If such event will be changed by dragging or resizing, and you have listeners for these events, the component will set to calendar event setAllDay(), which can lead to modifying entity/DTO instance.

      The default value is false.

      Parameters:
      defaultAllDay - whether to show events as all-day
    • getDefaultAllDayEventDuration

      @Nullable public CalendarDuration getDefaultAllDayEventDuration()
      Returns:
      the default all-day duration or null if not set
    • setDefaultAllDayEventDuration

      public void setDefaultAllDayEventDuration(@Nullable CalendarDuration duration)
      Sets the default duration of all-day events if they don't specify endDateTime property.

      For instance, the property is set to 2 days. The event that has allDay = true and do not have endDateTime property, will be shown in all-day section and will occupy two days.

      Note, calendar event's endDateTime property will remain unset, unless setForceEventDuration(boolean) has been set to true. In this case, the calendar will explicitly assign end date to an event. If such event will be changed by dragging or resizing, and you have listeners for these events, the component will set to calendar event setEndDateTime(), which can lead to modifying entity/DTO instance.

      This property only affects events with allDay = true.

      The default value is 1 day.

      Parameters:
      duration - the default all-day duration
    • getDefaultTimedEventDuration

      @Nullable public CalendarDuration getDefaultTimedEventDuration()
      Returns:
      the default time duration or null if not set
    • setDefaultTimedEventDuration

      public void setDefaultTimedEventDuration(@Nullable CalendarDuration duration)
      Sets the default duration for timed events if they don't specify endDateTime property.

      For instance, the property is set to 2 hours. The event that has allDay = false and do not have endDateTime property, will occupy two hours in time slots.

      Note, calendar event's end property will remain unset, unless setForceEventDuration(boolean) has been set to true. In this case, the calendar will explicitly assign end date to an event. If such event will be changed by dragging or resizing, and you have listeners for these events, the component will set to calendar event setEndDateTime(), which can lead to modifying entity/DTO instance.

      This property only affects events with allDay = false.

      The default value is 1 hour.

      Parameters:
      duration - the default time duration
    • isForceEventDuration

      public boolean isForceEventDuration()
      Returns:
      true if end property value is assigned by component to events that do not have it, or returns null if not set
    • setForceEventDuration

      public void setForceEventDuration(boolean forceEventDuration)
      Makes the component to assign end property value to events if they do not have it.

      Note, if event does not specify end property, the component will set it explicitly. If such event will be changed by dragging or resizing, and you have listeners for these events, the component will set to calendar event setEndDateTime(), which can lead to modifying entity/DTO instance.

      The default value is false.

      Parameters:
      forceEventDuration - whether to assign end date to events
    • getInitialDate

      @Nullable public LocalDate getInitialDate()
      Returns:
      the initial date to show or null if not set
    • setInitialDate

      public void setInitialDate(@Nullable LocalDate initialDate)
      Sets the initial date that will be displayed when the component is attached to UI.

      If not specified, the current date will be used.

      The property change is not applied after component attached to the UI.

      Parameters:
      initialDate - initial date to show
    • getDateIncrement

      @Nullable public CalendarDuration getDateIncrement()
      Returns:
      the step duration or null if not set
    • setDateIncrement

      public void setDateIncrement(CalendarDuration dateIncrement)
      Defines the step of navigateToNext()/navigateToPrevious() methods.

      It is unnecessary to define this property if predefined display modes are used, because the step is calculated automatically based on display mode.

      For CustomCalendarDisplayMode the CustomCalendarDisplayMode.getDuration() will be used as step if specified.

      Parameters:
      dateIncrement - the step duration
    • getDateAlignment

      @Nullable public String getDateAlignment()
      Returns:
      the first visible date of CustomCalendarDisplayMode or null if not set
    • setDateAlignment

      public void setDateAlignment(@Nullable String alignment)
      Sets the first visible date of CustomCalendarDisplayMode.

      When a custom calendar display mode is being used, and you’d like to guarantee that the calendar begins at a certain interval, like the start-of-week or start-of-month, specify a value like "week" or "month". If the property is not specified, a reasonable default will be generated based on the display mode’s duration.

      If a display mode’s range is explicitly defined with setVisibleRange(LocalDate, LocalDate), this property will be ignored.

      Parameters:
      alignment - the first visible date, like "week" or "month"
    • isEventInteractive

      public boolean isEventInteractive()
      Returns:
      true if all events are focusable/tabbable
    • setEventInteractive

      public void setEventInteractive(boolean interactive)
      Enables all events to be focusable/tabbable.

      Note, calendar events can override this value if they specify getInteractive().

      The default value is false.

      Parameters:
      interactive - whether events should be focusable/tabbable
    • getEventLongPressDelay

      @Nullable public Integer getEventLongPressDelay()
      Returns:
      the event long press delay or null if not set
    • setEventLongPressDelay

      public void setEventLongPressDelay(@Nullable Integer delay)
      Sets amount of time the user must hold down before an event becomes draggable.

      For touch devices.

      The default value is 1000 milliseconds.

      Parameters:
      delay - the delay to set
      See Also:
    • getSelectLongPressDelay

      @Nullable public Integer getSelectLongPressDelay()
      Returns:
      the select long press delay or null if not set
    • setSelectLongPressDelay

      public void setSelectLongPressDelay(@Nullable Integer delay)
      Sets the amount of time the user must hold down before a date becomes selectable on touch devices.

      The default value is 1000 milliseconds.

      Parameters:
      delay - the delay to set
      See Also:
    • isNowIndicatorVisible

      public boolean isNowIndicatorVisible()
      Returns:
      true if now indicator is visible
    • setNowIndicatorVisible

      public void setNowIndicatorVisible(boolean nowIndicatorVisible)
      Enables displaying a marker indicating the current time. The property applies in time-grid display modes.

      The default value is false.

      The property change is not applied after component attached to the UI.

      Parameters:
      nowIndicatorVisible - whether to display a now indicator
    • isExpandRows

      public boolean isExpandRows()
      Returns:
      true if rows are expanded in time-grid display modes
    • setExpandRows

      public void setExpandRows(boolean expandRows)
      Enables to expand rows of time-grid display modes if they don’t take up the entire height.

      The default value is false.

      Parameters:
      expandRows - whether to expand rows
    • getWindowResizeDelay

      @Nullable public Integer getWindowResizeDelay()
      Returns:
      the delay or null if not set
    • setWindowResizeDelay

      public void setWindowResizeDelay(@Nullable Integer windowResizeDelay)
      Sets the delay that the calendar will wait before adjusting its size after a window resize occurs.

      The default value is 100.

      Parameters:
      windowResizeDelay - the delay in milliseconds
    • getEventBackgroundColor

      @Nullable public String getEventBackgroundColor()
      Returns:
      event background color or null if not set
    • setEventBackgroundColor

      public void setEventBackgroundColor(@Nullable String eventBackgroundColor)
      Sets the background color for all events on the calendar.

      Note, calendar events can override this value if they specify getBackgroundColor().

      Supported values are:

      • #f00
      • #ff0000
      • rgb(255,0,0)
      • Color name - red
      Parameters:
      eventBackgroundColor - background color to set
    • getEventBorderColor

      @Nullable public String getEventBorderColor()
      Returns:
      the event border color or null if not set
    • setEventBorderColor

      public void setEventBorderColor(@Nullable String borderColor)
      Sets the border color for all events on the calendar.

      Note, calendar events can override this value if they specify getBorderColor().

      Supported values are:

      • #f00
      • #ff0000
      • rgb(255,0,0)
      • Color name - red
      Parameters:
      borderColor - event border color
    • getEventTextColor

      @Nullable public String getEventTextColor()
      Returns:
      the event text color or null if not set
    • setEventTextColor

      public void setEventTextColor(@Nullable String textColor)
      Sets the text color for all events on the calendar.

      Note, calendar events can override this value if they specify getTextColor().

      Supported values are:

      • #f00
      • #ff0000
      • rgb(255,0,0)
      • Color name - red

      The color applies in time-grid display modes and for all-day events in day-grid display modes.

      Parameters:
      textColor - event text color
    • isDisplayEventTime

      public boolean isDisplayEventTime()
      Returns:
      true if time-text of events is shown
    • setDisplayEventTime

      public void setDisplayEventTime(boolean displayEventTime)
      Determines visibility of time text of each event.

      The property applies to timed-events (not all-day). If set to true, time text will always be displayed on the event. If set to false, time text will never be displayed on the event. Events that are all-day will never display time text anyhow.

      The default value is true.

      Parameters:
      displayEventTime - whether to display time text of events
    • getNextDayThreshold

      @Nullable public CalendarDuration getNextDayThreshold()
      Returns:
      the next day threshold time or null if not set
    • setNextDayThreshold

      public void setNextDayThreshold(@Nullable CalendarDuration nextDayThreshold)
      Sets the minimum time that event's end date should achieve to render event as it if were on that day.

      For instance, the property is set to 09:00:00. And there is an event with dates:

      • start - 2024-09-01T20:00:00;
      • end - 2024-09-02T02:00:00;

      So, the event spans to another day, but it will be rendered as a one-day event, because we specified the nextDayThreshold property. However, If the event has end date - 2024-09-02T10:00:00, it will be rendered as two-day event.

      Only affects timed events that appear on whole-days cells. Whole-day cells occur in day-grid display modes and the all-day slots in the time-grid display modes.

      Note that this property is ignored when event's allDay property is set to true.

      The default value is 00:00:00.

      Parameters:
      nextDayThreshold - the next day threshold time
      See Also:
    • isEventOrderStrict

      public boolean isEventOrderStrict()
      Returns:
      true if the component strictly follows the specified event order
    • setEventOrderStrict

      public void setEventOrderStrict(boolean eventOrderStrict)
      Enables the component to strictly follow the specified event order.

      By default, this property is false, meaning the event order is not strict and compactness will be prioritized over following event order exactly.

      Parameters:
      eventOrderStrict - whether to strictly follow event order
      See Also:
    • getEventOrder

      public List<String> getEventOrder()
      Returns:
      list of properties involved in the sorting process
    • setEventOrder

      public void setEventOrder(@Nullable List<String> eventOrder)
      Sets the list of calendar event properties that should participate in sorting. It is also available to specify properties from event's additionalProperties.

      For most calendar display modes, this property determines the vertical ordering of events within the same day. For time-grid display modes however, it determines the horizontal ordering of events within the same time slot.

      The default value puts earlier events first. If tied, it puts longer events first. If still tied, it puts all-day events first. If still tied, orders events by title, alphabetically.

      If putting a lower-precedent event before a higher-precedent improves compactness, the algorithm will do so. To disable this behavior, set setEventOrderStrict(boolean) to true.

      The provided properties are sorted in ascending order. If a property is prefixed with a minus sign like "-title", sorting will be in descending order.

      Parameters:
      eventOrder - list of properties
      See Also:
    • getEventOrderJsFunction

      @Nullable public JsFunction getEventOrderJsFunction()
      Returns:
      event order JavaScript function or null if not set
    • setEventOrderJsFunction

      public void setEventOrderJsFunction(@Nullable JsFunction jsFunction)
      Sets JavaScript function definition that should sort event in the same day cell or time slot. The function should return -1 if first event is "less" than second one, and 1 if the first event is "greater" than second one.

      For instance, function sorts by additional property:

      
        calendar.setEventOrderJsFunction(new JsFunction("""
           function (event1, event2) {
               if (event1.priority === event2.priority) {
                   return 0;
               }
               return event1.priority > event2.priority ? 1 : -1;
           }
           """));
        
      The event1 is the first event to be compared.

      The event2 is the second event to be compared.

      The available properties of event1 and event2 you can find in FullCalendar docs

      Note that JavaScript function takes precedence over the setEventOrder(List).

      Parameters:
      jsFunction - JavaScript function
      See Also:
    • isProgressiveEventRendering

      public boolean isProgressiveEventRendering()
      Returns:
      true if progressive event rendering is enabled
    • setProgressiveEventRendering

      public void setProgressiveEventRendering(boolean progressiveEventRendering)
      Enables rendering of events from the data provider as soon as the events are loaded.
      • true - renders each data provider as it is received. Will result in more renders.
      • false - waits until all data providers have received their data and then renders everything at once, resulting in fewer renders.

      The default value is false.

      Parameters:
      progressiveEventRendering - whether to enable progressive event rendering
    • createJsonFactory

      protected elemental.json.JsonFactory createJsonFactory()
    • createSerializer

      protected JmixFullCalendarSerializer createSerializer()
    • createDeserializer

      protected JmixFullCalendarDeserializer createDeserializer()
    • createOptions

      protected JmixFullCalendarOptions createOptions()
    • inverseDuration

      protected CalendarDuration inverseDuration(CalendarDuration duration)
    • requestUpdateOptions

      protected void requestUpdateOptions(boolean onlyDirty)
    • performUpdateOptions

      protected void performUpdateOptions(boolean onlyDirty)
    • performCompleteInit

      protected void performCompleteInit()
    • updateInitialOptions

      protected void updateInitialOptions()
    • attachCalendarOptionChangeListener

      protected void attachCalendarOptionChangeListener()
    • onOptionChange

      protected void onOptionChange(JmixFullCalendarOptions.OptionChangeEvent event)
    • attachDatesSetDomEventListener

      protected void attachDatesSetDomEventListener()
    • attachMoreLinkClickDomEventListener

      protected void attachMoreLinkClickDomEventListener()
    • attachEventClickDomEventListener

      protected void attachEventClickDomEventListener()
    • detachEventClickDomEventListener

      protected void detachEventClickDomEventListener()
    • attachEventMouseEnterDomEventListener

      protected void attachEventMouseEnterDomEventListener()
    • detachEventMouseEnterDomEventListener

      protected void detachEventMouseEnterDomEventListener()
    • attachEventMouseLeaveDomEventListener

      protected void attachEventMouseLeaveDomEventListener()
    • detachEventMouseLeaveDomEventListener

      protected void detachEventMouseLeaveDomEventListener()
    • attachEventDropDomEventListener

      protected void attachEventDropDomEventListener()
    • detachEventDropDomEventListener

      protected void detachEventDropDomEventListener()
    • attachEventResizeDomEventListener

      protected void attachEventResizeDomEventListener()
    • detachEventResizeDomEventListener

      protected void detachEventResizeDomEventListener()
    • attachDateClickDomEventListener

      protected void attachDateClickDomEventListener()
    • detachDateClickDomEventListener

      protected void detachDateClickDomEventListener()
    • attachSelectDomEventListener

      protected void attachSelectDomEventListener()
    • detachSelectDomEventListener

      protected void detachSelectDomEventListener()
    • attachUnselectDomEventListener

      protected void attachUnselectDomEventListener()
    • detachUnselectDomEventListener

      protected void detachUnselectDomEventListener()
    • attachDayNavigationLinkClickDomEventListener

      protected void attachDayNavigationLinkClickDomEventListener()
    • attachWeekNavigationLinkClickDomEventListener

      protected void attachWeekNavigationLinkClickDomEventListener()
    • onEventClick

      protected void onEventClick(EventClickDomEvent event)
    • onEventMouseEnter

      protected void onEventMouseEnter(EventMouseEnterDomEvent event)
    • onEventMouseLeave

      protected void onEventMouseLeave(EventMouseLeaveDomEvent event)
    • onDatesSet

      protected void onDatesSet(DatesSetDomEvent event)
    • onMoreLinkClick

      protected void onMoreLinkClick(MoreLinkClickDomEvent event)
    • onEventDrop

      protected void onEventDrop(EventDropDomEvent event)
    • onEventResize

      protected void onEventResize(EventResizeDomEvent event)
    • onDateClick

      protected void onDateClick(DateClickDomEvent event)
    • onSelect

      protected void onSelect(SelectDomEvent event)
    • onUnselect

      protected void onUnselect(UnselectDomEvent event)
    • onDayNavigationLinkClick

      protected void onDayNavigationLinkClick(DayNavigationLinkClickDomEvent event)
    • onWeekNavigationLinkClick

      protected void onWeekNavigationLinkClick(WeekNavigationLinkClickDomEvent event)
    • getDisplayMode

      protected CalendarDisplayMode getDisplayMode(String id)
    • fetchCalendarItems

      @ClientCallable protected elemental.json.JsonArray fetchCalendarItems(String sourceId, String start, String end)
    • getMoreLinkClassNames

      @ClientCallable protected elemental.json.JsonArray getMoreLinkClassNames(elemental.json.JsonObject jsonContext)
    • getDayHeaderClassNames

      @ClientCallable protected elemental.json.JsonArray getDayHeaderClassNames(elemental.json.JsonObject jsonContext)
    • getDayCellClassNames

      @ClientCallable protected elemental.json.JsonArray getDayCellClassNames(elemental.json.JsonObject jsonContext)
    • getSlotLabelClassNames

      @ClientCallable protected elemental.json.JsonArray getSlotLabelClassNames(elemental.json.JsonObject jsonContext)
    • getNowIndicatorClassNames

      @ClientCallable protected elemental.json.JsonArray getNowIndicatorClassNames(elemental.json.JsonObject jsonContext)
    • getDayCellBottomTextInfo

      @ClientCallable protected elemental.json.JsonObject getDayCellBottomTextInfo(elemental.json.JsonObject jsonContext)
    • addDataProvidersOnAttach

      protected void addDataProvidersOnAttach()
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component