Package com.flowingcode.addons.ycalendar
Class MonthCalendar
java.lang.Object
com.vaadin.flow.component.Component
com.flowingcode.addons.ycalendar.AbstractCalendarComponent<MonthCalendar>
com.flowingcode.addons.ycalendar.MonthCalendar
- All Implemented Interfaces:
AttachNotifier,DetachNotifier,HasElement,HasSize,HasStyle,HasTheme,Serializable
@Tag("fc-month-calendar")
@JsModule("./fc-month-calendar/month-calendar-mixin.js") @JsModule("./fc-month-calendar/fc-month-calendar.js")
@NpmPackage(value="@polymer/iron-a11y-keys-behavior",
version="3.0.1")
@Uses(com.vaadin.flow.component.datepicker.DatePicker.class)
public class MonthCalendar
extends AbstractCalendarComponent<MonthCalendar>
implements HasSize, HasTheme
A component for displaying a calendar view of a specific month and year.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMonthCalendar(int year, Month month) Creates a new instance ofMonthCalendarfor the given year and month.MonthCalendar(YearMonth yearMonth) Creates a new instance ofMonthCalendarfor the given year and month. -
Method Summary
Modifier and TypeMethodDescriptiongetMonth()Returns the month displayed in this calendar.Returns the year and month displayed in this calendar.voidRefresh the styles of all dates in the displayed year and month.voidrefreshItem(LocalDate date) Refresh the style of the given date.voidsetClassNameGenerator(ValueProvider<LocalDate, String> classNameGenerator) Sets the function that generates CSS class names for days in this calendar.voidsetReadOnly(boolean readOnly) Sets the readonly attribute for the component.voidsetYearMonth(YearMonth yearMonth) Sets the year and month to display in this calendar.Methods inherited from class com.flowingcode.addons.ycalendar.AbstractCalendarComponent
addDateSelectedListener, onAttach, setI18nMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
-
Constructor Details
-
MonthCalendar
Creates a new instance ofMonthCalendarfor the given year and month.- Parameters:
year- the year (in four digits) to displaymonth- the month-of-year to display
-
MonthCalendar
Creates a new instance ofMonthCalendarfor the given year and month.- Parameters:
yearMonth- theYearMonthto display
-
-
Method Details
-
setReadOnly
public void setReadOnly(boolean readOnly) Sets the readonly attribute for the component.- Parameters:
readOnly- the state of the readonly attribute
-
getYearMonth
Returns the year and month displayed in this calendar.- Returns:
- the year and month displayed in this calendar
-
getMonth
Returns the month displayed in this calendar.- Returns:
- the month displayed in this calendar
-
setYearMonth
Sets the year and month to display in this calendar.- Parameters:
yearMonth- theYearMonthto display
-
setClassNameGenerator
Sets the function that generates CSS class names for days in this calendar. Returningnullfrom the generator results in no custom class name being set. Multiple class names can be returned from the generator as space-separated.- Parameters:
classNameGenerator- theValueProviderto use for generating class names
-
refreshAll
public void refreshAll()Refresh the styles of all dates in the displayed year and month.- Specified by:
refreshAllin classAbstractCalendarComponent<MonthCalendar>
-
refreshItem
Refresh the style of the given date.- Parameters:
date- the date to update the style for- Throws:
IllegalArgumentException- if the displayed year and month does not containdate
-