Package io.jmix.ui.component.impl
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.component.Calendar
Calendar.CalendarBackwardClickEvent<V>, Calendar.CalendarDateClickEvent<V>, Calendar.CalendarDayClickEvent<V>, Calendar.CalendarEventClickEvent<V>, Calendar.CalendarEventMoveEvent<V>, Calendar.CalendarEventResizeEvent<V>, Calendar.CalendarForwardClickEvent<V>, Calendar.CalendarRangeSelectEvent<V>, Calendar.CalendarWeekClickEvent<V>, Calendar.TimeFormat
Nested classes/interfaces inherited from interface io.jmix.ui.component.Component
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEvent
-
Field Summary
Modifier and TypeFieldDescriptionprotected CalendarEventProvider
protected DatatypeRegistry
protected DateTimeTransformations
protected boolean
protected final String
protected final String
Fields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a listener that is invoked when the user clicks backward navigation button.addDateClickListener
(Consumer<Calendar.CalendarDateClickEvent<V>> listener) Adds a listener that is invoked when the user clicks on a day number of the month.addDayClickListener
(Consumer<Calendar.CalendarDayClickEvent<V>> listener) Adds a listener that is invoked when the user clicks on an empty space in the day.Adds a listener that is invoked when the user clicks on an event.addEventMoveListener
(Consumer<Calendar.CalendarEventMoveEvent<V>> listener) Adds a listener that is invoked when the user changes an event position.Adds a listener that is invoked when the user changes an event duration.Adds a listener that is invoked when the user clicks forward navigation button.Adds a listener that is invoked when the user drag-marks day or time cells using mouse.addWeekClickListener
(Consumer<Calendar.CalendarWeekClickEvent<V>> listener) Adds a listener that is invoked when the user clicks on a week number.void
protected Date
calculateNewEnd
(com.vaadin.v7.ui.components.calendar.event.CalendarEvent calendarEvent, Date newStart) protected void
checkDatatypeMismatch
(Datatype datatype) protected V
convertToModel
(Date date) protected Date
convertToPresentation
(V date) protected JmixCalendar
int
int
int
int
protected MetaProperty
protected void
initComponent
(JmixCalendar component) protected void
initDefaultEventProvider
(JmixCalendar component) protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
boolean
protected void
onBackward
(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.BackwardEvent event) protected void
onDateClick
(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.DateClickEvent event) protected void
protected void
onEventClick
(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.EventClick event) protected void
onEventMove
(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.MoveEvent event) protected void
onEventResize
(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.EventResize event) protected void
onForward
(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.ForwardEvent event) protected void
onRangeSelect
(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.RangeSelectEvent event) protected void
onWeekClick
(com.vaadin.v7.ui.components.calendar.CalendarComponentEvents.WeekClick event) void
setDatatype
(Datatype<V> datatype) Sets the givendatatype
to the component.void
setDatatypeRegistry
(DatatypeRegistry datatypeRegistry) void
setDateTimeTransformations
(DateTimeTransformations dateTimeTransformations) void
setDayNames
(Map<DayOfWeek, String> dayNames) Sets localized Calendar day names.void
setEndDate
(V date) Set end date for the calendar's range.void
setEventProvider
(CalendarEventProvider calendarEventProvider) Set the calendar event provider.void
setFirstDayOfWeek
(Integer dayOfWeek) Allows setting first day of week independent of Locale.void
setFirstVisibleDayOfWeek
(int firstDay) Set first day of the week to show.void
setFirstVisibleHourOfDay
(int firstHour) Set first hour of the day to show.void
setLastVisibleDayOfWeek
(int lastDay) Set last day of the week to show.void
setLastVisibleHourOfDay
(int lastHour) Set last hour of the day to show.void
setMonthNames
(Map<Month, String> monthNames) Sets localized Calendar month names.protected void
setNavigationButtonsStyle
(boolean value) void
setNavigationButtonsVisible
(boolean value) Set visibility for the backward and forward buttons.void
setStartDate
(V date) Set start date for the calendar range.void
setStyleName
(String name) Sets one or more style names of the component, replacing any previous styles.void
setTimeFormat
(Calendar.TimeFormat format) Set format for time.void
setTimeZone
(TimeZone zone) Set timezone.void
setWeeklyCaptionFormat
(String dateFormatPattern) Set date caption format for the weekly view.Methods inherited from class io.jmix.ui.component.impl.AbstractComponent
addAttachListener, addDetachListener, addStyleName, assignDebugId, attached, detached, getAlignment, getCaption, getComponent, getComposition, getContextHelpIconClickHandler, getContextHelpText, getDebugId, getDescription, getEventHub, getFrame, getHeight, getHeightSizeUnit, getHtmlSanitizer, getIcon, getIconName, getIconResource, getId, getParent, getStyleName, getUiComponentProperties, getUiProperties, getWidth, getWidthSizeUnit, getXmlDescriptor, hasSubscriptions, hasValidationError, isAttached, isCaptionAsHtml, isContextHelpTextHtmlEnabled, isDescriptionAsHtml, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, onContextHelpIconClick, publish, removeStyleName, sanitize, setAlignment, setApplicationContext, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDebugId, setDescription, setDescriptionAsHtml, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setParent, setResponsive, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jmix.ui.component.Component
addStyleName, getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
Methods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrame
Methods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaption
Methods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescription
Methods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSet
Methods inherited from interface io.jmix.ui.component.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
Methods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
-
Field Details
-
TIME_FORMAT_12H
- See Also:
-
TIME_FORMAT_24H
- See Also:
-
calendarEventProvider
-
dateTimeTransformations
-
datatypeRegistry
-
datatype
-
-
Constructor Details
-
CalendarImpl
public CalendarImpl()
-
-
Method Details
-
createComponent
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
initComponent
-
initDefaultEventProvider
-
setDateTimeTransformations
-
setDatatypeRegistry
-
setDatatype
Description copied from interface:HasDatatype
Sets the givendatatype
to the component. Its value will be formatted according to this datatype.- Specified by:
setDatatype
in interfaceHasDatatype<V>
- Parameters:
datatype
-Datatype
instance
-
getDatatype
- Specified by:
getDatatype
in interfaceHasDatatype<V>
- Returns:
- a datatype that is used by this component
-
getDefaultDatatype
-
getMetaProperty
-
checkDatatypeMismatch
-
setStartDate
Description copied from interface:Calendar
Set start date for the calendar range.- Specified by:
setStartDate
in interfaceCalendar<V>
-
getStartDate
- Specified by:
getStartDate
in interfaceCalendar<V>
- Returns:
- the start date for the calendar range.
-
setEndDate
Description copied from interface:Calendar
Set end date for the calendar's range.- Specified by:
setEndDate
in interfaceCalendar<V>
-
getEndDate
- Specified by:
getEndDate
in interfaceCalendar<V>
- Returns:
- the last date for the calendar range.
-
convertToPresentation
-
convertToModel
-
setTimeZone
Description copied from interface:Calendar
Set timezone.- Specified by:
setTimeZone
in interfaceCalendar<V>
-
getTimeZone
- Specified by:
getTimeZone
in interfaceCalendar<V>
- Returns:
- timezone.
-
setTimeFormat
Description copied from interface:Calendar
Set format for time. 12H/24H.- Specified by:
setTimeFormat
in interfaceCalendar<V>
-
getTimeFormat
- Specified by:
getTimeFormat
in interfaceCalendar<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 interfaceCalendar<V>
-
getFirstVisibleDayOfWeek
public int getFirstVisibleDayOfWeek()- Specified by:
getFirstVisibleDayOfWeek
in interfaceCalendar<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 interfaceCalendar<V>
-
getLastVisibleDayOfWeek
public int getLastVisibleDayOfWeek()- Specified by:
getLastVisibleDayOfWeek
in interfaceCalendar<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 interfaceCalendar<V>
-
getFirstVisibleHourOfDay
public int getFirstVisibleHourOfDay()- Specified by:
getFirstVisibleHourOfDay
in interfaceCalendar<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 interfaceCalendar<V>
-
getLastVisibleHourOfDay
public int getLastVisibleHourOfDay()- Specified by:
getLastVisibleHourOfDay
in interfaceCalendar<V>
- Returns:
- last showed hour of the day.
-
setFirstDayOfWeek
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 interfaceCalendar<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
Description copied from interface:Calendar
Set date caption format for the weekly view.- Specified by:
setWeeklyCaptionFormat
in interfaceCalendar<V>
-
getWeeklyCaptionFormat
- Specified by:
getWeeklyCaptionFormat
in interfaceCalendar<V>
- Returns:
- date pattern of captions.
-
setEventProvider
Description copied from interface:Calendar
Set the calendar event provider. Provider can contain calendar events.- Specified by:
setEventProvider
in interfaceCalendar<V>
- Parameters:
calendarEventProvider
- an event provider with events- See Also:
-
addDateClickListener
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 interfaceCalendar<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
Description copied from interface:Calendar
Adds a listener that is invoked when the user clicks on an event.- Specified by:
addEventClickListener
in interfaceCalendar<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
Description copied from interface:Calendar
Adds a listener that is invoked when the user changes an event duration.- Specified by:
addEventResizeListener
in interfaceCalendar<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
Description copied from interface:Calendar
Adds a listener that is invoked when the user changes an event position.- Specified by:
addEventMoveListener
in interfaceCalendar<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
-
internalRemoveEventMoveListener
protected void internalRemoveEventMoveListener(Consumer<Calendar.CalendarEventMoveEvent<V>> listener) -
addWeekClickListener
Description copied from interface:Calendar
Adds a listener that is invoked when the user clicks on a week number.- Specified by:
addWeekClickListener
in interfaceCalendar<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 interfaceCalendar<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 interfaceCalendar<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
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 interfaceCalendar<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
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 interfaceCalendar<V>
- Parameters:
listener
- a listener to add- Returns:
- a registration object for removing an event listener
-
onDayClick
-
getEventProvider
- Specified by:
getEventProvider
in interfaceCalendar<V>
- Returns:
- calendar event provider.
-
setStyleName
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 interfaceComponent
- Overrides:
setStyleName
in classAbstractComponent<JmixCalendar>
- Parameters:
name
- one or more style names separated by space.
-
getDayNames
- Specified by:
getDayNames
in interfaceCalendar<V>
- Returns:
DayOfWeek
values matched to localized day names
-
setDayNames
Description copied from interface:Calendar
Sets localized Calendar day names.- Specified by:
setDayNames
in interfaceCalendar<V>
- Parameters:
dayNames
-DayOfWeek
values matched to localized day names
-
getMonthNames
- Specified by:
getMonthNames
in interfaceCalendar<V>
- Returns:
Month
values matched to localized month names
-
setMonthNames
Description copied from interface:Calendar
Sets localized Calendar month names.- Specified by:
setMonthNames
in interfaceCalendar<V>
- Parameters:
monthNames
-Month
values matched to localized month names
-