Class CalendarImpl<V>

All Implemented Interfaces:
AttachNotifier, Calendar<V>, Component, Component.BelongToFrame, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper, HasContextHelp, HasDatatype<V>, HasDebugId, HasHtmlCaption, HasHtmlDescription, HasHtmlSanitizer, org.springframework.beans.factory.InitializingBean

public class CalendarImpl<V> extends AbstractComponent<JmixCalendar> implements Calendar<V>, org.springframework.beans.factory.InitializingBean
  • Field Details

  • Constructor Details

    • CalendarImpl

      public CalendarImpl()
  • Method Details

    • createComponent

      protected JmixCalendar createComponent()
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • initComponent

      protected void initComponent(JmixCalendar component)
    • initDefaultEventProvider

      protected void initDefaultEventProvider(JmixCalendar component)
    • setDateTimeTransformations

      @Autowired public void setDateTimeTransformations(DateTimeTransformations dateTimeTransformations)
    • setDatatypeRegistry

      @Autowired public void setDatatypeRegistry(DatatypeRegistry datatypeRegistry)
    • setDatatype

      public void setDatatype(Datatype<V> datatype)
      Description copied from interface: HasDatatype
      Sets the given datatype to the component. Its value will be formatted according to this datatype.
      Specified by:
      setDatatype in interface HasDatatype<V>
      Parameters:
      datatype - Datatype instance
    • getDatatype

      @Nonnull public Datatype<V> getDatatype()
      Specified by:
      getDatatype in interface HasDatatype<V>
      Returns:
      a datatype that is used by this component
    • getDefaultDatatype

      protected Datatype<V> getDefaultDatatype()
    • getMetaProperty

      @Nullable protected MetaProperty getMetaProperty()
    • checkDatatypeMismatch

      protected void checkDatatypeMismatch(@Nullable Datatype datatype)
    • setStartDate

      public void setStartDate(@Nullable V date)
      Description copied from interface: Calendar
      Set start date for the calendar range.
      Specified by:
      setStartDate in interface Calendar<V>
    • getStartDate

      @Nullable public V getStartDate()
      Specified by:
      getStartDate in interface Calendar<V>
      Returns:
      the start date for the calendar range.
    • setEndDate

      public void setEndDate(@Nullable V date)
      Description copied from interface: Calendar
      Set end date for the calendar's range.
      Specified by:
      setEndDate in interface Calendar<V>
    • getEndDate

      @Nullable public V getEndDate()
      Specified by:
      getEndDate in interface Calendar<V>
      Returns:
      the last date for the calendar range.
    • convertToPresentation

      @Nullable protected Date convertToPresentation(@Nullable V date)
    • convertToModel

      @Nullable protected V convertToModel(@Nullable Date date)
    • setTimeZone

      public void setTimeZone(TimeZone zone)
      Description copied from interface: Calendar
      Set timezone.
      Specified by:
      setTimeZone in interface Calendar<V>
    • getTimeZone

      public TimeZone getTimeZone()
      Specified by:
      getTimeZone in interface Calendar<V>
      Returns:
      timezone.
    • setTimeFormat

      public void setTimeFormat(Calendar.TimeFormat format)
      Description copied from interface: Calendar
      Set format for time. 12H/24H.
      Specified by:
      setTimeFormat in interface Calendar<V>
    • getTimeFormat

      public Calendar.TimeFormat getTimeFormat()
      Specified by:
      getTimeFormat in interface Calendar<V>
      Returns:
      enumeration of ite format.
    • setFirstVisibleDayOfWeek

      public void setFirstVisibleDayOfWeek(int firstDay)
      Description copied from interface: Calendar
      Set first day of the week to show.
      Specified by:
      setFirstVisibleDayOfWeek in interface Calendar<V>
    • getFirstVisibleDayOfWeek

      public int getFirstVisibleDayOfWeek()
      Specified by:
      getFirstVisibleDayOfWeek in interface Calendar<V>
      Returns:
      first showed day of the week.
    • setLastVisibleDayOfWeek

      public void setLastVisibleDayOfWeek(int lastDay)
      Description copied from interface: Calendar
      Set last day of the week to show.
      Specified by:
      setLastVisibleDayOfWeek in interface Calendar<V>
    • getLastVisibleDayOfWeek

      public int getLastVisibleDayOfWeek()
      Specified by:
      getLastVisibleDayOfWeek in interface Calendar<V>
      Returns:
      last showed day of the week.
    • setFirstVisibleHourOfDay

      public void setFirstVisibleHourOfDay(int firstHour)
      Description copied from interface: Calendar
      Set first hour of the day to show.
      Specified by:
      setFirstVisibleHourOfDay in interface Calendar<V>
    • getFirstVisibleHourOfDay

      public int getFirstVisibleHourOfDay()
      Specified by:
      getFirstVisibleHourOfDay in interface Calendar<V>
      Returns:
      first showed hour of the day.
    • setLastVisibleHourOfDay

      public void setLastVisibleHourOfDay(int lastHour)
      Description copied from interface: Calendar
      Set last hour of the day to show.
      Specified by:
      setLastVisibleHourOfDay in interface Calendar<V>
    • getLastVisibleHourOfDay

      public int getLastVisibleHourOfDay()
      Specified by:
      getLastVisibleHourOfDay in interface Calendar<V>
      Returns:
      last showed hour of the day.
    • setFirstDayOfWeek

      public void setFirstDayOfWeek(Integer dayOfWeek)
      Description copied from interface: Calendar
      Allows setting first day of week independent of Locale.

      Pass null to use a day of week defined by current locale.

      Specified by:
      setFirstDayOfWeek in interface Calendar<V>
      Parameters:
      dayOfWeek - any of java.util.Calendar.SUNDAY ... java.util.Calendar.SATURDAY or null to revert to default first day of week by locale
    • setWeeklyCaptionFormat

      public void setWeeklyCaptionFormat(String dateFormatPattern)
      Description copied from interface: Calendar
      Set date caption format for the weekly view.
      Specified by:
      setWeeklyCaptionFormat in interface Calendar<V>
    • getWeeklyCaptionFormat

      public String getWeeklyCaptionFormat()
      Specified by:
      getWeeklyCaptionFormat in interface Calendar<V>
      Returns:
      date pattern of captions.
    • setEventProvider

      public void setEventProvider(@Nullable CalendarEventProvider calendarEventProvider)
      Description copied from interface: Calendar
      Set the calendar event provider. Provider can contain calendar events.
      Specified by:
      setEventProvider in interface Calendar<V>
      Parameters:
      calendarEventProvider - an event provider with events
      See Also:
    • addDateClickListener

      public Subscription addDateClickListener(Consumer<Calendar.CalendarDateClickEvent<V>> listener)
      Description copied from interface: Calendar
      Adds a listener that is invoked when the user clicks on a day number of the month.
      Specified by:
      addDateClickListener in interface Calendar<V>
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • onDateClick

      protected void onDateClick(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.DateClickEvent event)
    • internalRemoveDateClickListener

      protected void internalRemoveDateClickListener(Consumer<Calendar.CalendarDateClickEvent<V>> listener)
    • addEventClickListener

      public Subscription addEventClickListener(Consumer<Calendar.CalendarEventClickEvent<V>> listener)
      Description copied from interface: Calendar
      Adds a listener that is invoked when the user clicks on an event.
      Specified by:
      addEventClickListener in interface Calendar<V>
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • onEventClick

      protected void onEventClick(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.EventClick event)
    • internalRemoveEventClickListener

      protected void internalRemoveEventClickListener(Consumer<Calendar.CalendarEventClickEvent<V>> listener)
    • addEventResizeListener

      public Subscription addEventResizeListener(Consumer<Calendar.CalendarEventResizeEvent<V>> listener)
      Description copied from interface: Calendar
      Adds a listener that is invoked when the user changes an event duration.
      Specified by:
      addEventResizeListener in interface Calendar<V>
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • onEventResize

      protected void onEventResize(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.EventResize event)
    • internalRemoveEventResizeListener

      protected void internalRemoveEventResizeListener(Consumer<Calendar.CalendarEventResizeEvent<V>> listener)
    • addEventMoveListener

      public Subscription addEventMoveListener(Consumer<Calendar.CalendarEventMoveEvent<V>> listener)
      Description copied from interface: Calendar
      Adds a listener that is invoked when the user changes an event position.
      Specified by:
      addEventMoveListener in interface Calendar<V>
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • onEventMove

      protected void onEventMove(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.MoveEvent event)
    • calculateNewEnd

      @Nullable protected Date calculateNewEnd(com.vaadin.v7.ui.components.calendar.event.CalendarEvent calendarEvent, @Nullable Date newStart)
    • internalRemoveEventMoveListener

      protected void internalRemoveEventMoveListener(Consumer<Calendar.CalendarEventMoveEvent<V>> listener)
    • addWeekClickListener

      public Subscription addWeekClickListener(Consumer<Calendar.CalendarWeekClickEvent<V>> listener)
      Description copied from interface: Calendar
      Adds a listener that is invoked when the user clicks on a week number.
      Specified by:
      addWeekClickListener in interface Calendar<V>
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • onWeekClick

      protected void onWeekClick(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.WeekClick event)
    • internalRemoveWeekClickListener

      protected void internalRemoveWeekClickListener(Consumer<Calendar.CalendarWeekClickEvent<V>> listener)
    • addForwardClickListener

      public Subscription addForwardClickListener(Consumer<Calendar.CalendarForwardClickEvent<V>> listener)
      Description copied from interface: Calendar
      Adds a listener that is invoked when the user clicks forward navigation button.
      Specified by:
      addForwardClickListener in interface Calendar<V>
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • onForward

      protected void onForward(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.ForwardEvent event)
    • internalRemoveForwardClickListener

      protected void internalRemoveForwardClickListener(Consumer<Calendar.CalendarForwardClickEvent<V>> listener)
    • addBackwardClickListener

      public Subscription addBackwardClickListener(Consumer<Calendar.CalendarBackwardClickEvent<V>> listener)
      Description copied from interface: Calendar
      Adds a listener that is invoked when the user clicks backward navigation button.
      Specified by:
      addBackwardClickListener in interface Calendar<V>
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • onBackward

      protected void onBackward(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.BackwardEvent event)
    • internalRemoveBackwardClickListener

      protected void internalRemoveBackwardClickListener(Consumer<Calendar.CalendarBackwardClickEvent<V>> listener)
    • addRangeSelectListener

      public Subscription addRangeSelectListener(Consumer<Calendar.CalendarRangeSelectEvent<V>> listener)
      Description copied from interface: Calendar
      Adds a listener that is invoked when the user drag-marks day or time cells using mouse.
      Specified by:
      addRangeSelectListener in interface Calendar<V>
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • onRangeSelect

      protected void onRangeSelect(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.RangeSelectEvent event)
    • internalRemoveRangeSelectListener

      protected void internalRemoveRangeSelectListener(Consumer<Calendar.CalendarRangeSelectEvent<V>> listener)
    • addDayClickListener

      public Subscription addDayClickListener(Consumer<Calendar.CalendarDayClickEvent<V>> listener)
      Description copied from interface: Calendar
      Adds a listener that is invoked when the user clicks on an empty space in the day.
      Specified by:
      addDayClickListener in interface Calendar<V>
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • onDayClick

      protected void onDayClick(JmixCalendar.JmixCalendarDayClickEvent event)
    • getEventProvider

      public CalendarEventProvider getEventProvider()
      Specified by:
      getEventProvider in interface Calendar<V>
      Returns:
      calendar event provider.
    • setStyleName

      public void setStyleName(@Nullable String name)
      Description copied from interface: Component
      Sets one or more style names of the component, replacing any previous styles. Multiple styles can be specified as a space-separated list of style names. Styles implementation is client-type-specific.
      Specified by:
      setStyleName in interface Component
      Overrides:
      setStyleName in class AbstractComponent<JmixCalendar>
      Parameters:
      name - one or more style names separated by space.
    • setNavigationButtonsVisible

      public void setNavigationButtonsVisible(boolean value)
      Description copied from interface: Calendar
      Set visibility for the backward and forward buttons.
      Specified by:
      setNavigationButtonsVisible in interface Calendar<V>
    • isNavigationButtonsVisible

      public boolean isNavigationButtonsVisible()
      Specified by:
      isNavigationButtonsVisible in interface Calendar<V>
      Returns:
      backward and forward buttons visibility.
    • setNavigationButtonsStyle

      protected void setNavigationButtonsStyle(boolean value)
    • getDayNames

      public Map<DayOfWeek,String> getDayNames()
      Specified by:
      getDayNames in interface Calendar<V>
      Returns:
      DayOfWeek values matched to localized day names
    • setDayNames

      public void setDayNames(Map<DayOfWeek,String> dayNames)
      Description copied from interface: Calendar
      Sets localized Calendar day names.
      Specified by:
      setDayNames in interface Calendar<V>
      Parameters:
      dayNames - DayOfWeek values matched to localized day names
    • getMonthNames

      public Map<Month,String> getMonthNames()
      Specified by:
      getMonthNames in interface Calendar<V>
      Returns:
      Month values matched to localized month names
    • setMonthNames

      public void setMonthNames(Map<Month,String> monthNames)
      Description copied from interface: Calendar
      Sets localized Calendar month names.
      Specified by:
      setMonthNames in interface Calendar<V>
      Parameters:
      monthNames - Month values matched to localized month names