Class 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 Details

    • MonthCalendar

      public MonthCalendar(int year, Month month)
      Creates a new instance of MonthCalendar for the given year and month.
      Parameters:
      year - the year (in four digits) to display
      month - the month-of-year to display
    • MonthCalendar

      public MonthCalendar(YearMonth yearMonth)
      Creates a new instance of MonthCalendar for the given year and month.
      Parameters:
      yearMonth - the YearMonth to 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

      public YearMonth getYearMonth()
      Returns the year and month displayed in this calendar.
      Returns:
      the year and month displayed in this calendar
    • getMonth

      public Month getMonth()
      Returns the month displayed in this calendar.
      Returns:
      the month displayed in this calendar
    • setYearMonth

      public void setYearMonth(YearMonth yearMonth)
      Sets the year and month to display in this calendar.
      Parameters:
      yearMonth - the YearMonth to display
    • setClassNameGenerator

      public void setClassNameGenerator(ValueProvider<LocalDate,String> classNameGenerator)
      Sets the function that generates CSS class names for days in this calendar. Returning null from the generator results in no custom class name being set. Multiple class names can be returned from the generator as space-separated.
      Parameters:
      classNameGenerator - the ValueProvider to use for generating class names
    • refreshAll

      public void refreshAll()
      Refresh the styles of all dates in the displayed year and month.
      Specified by:
      refreshAll in class AbstractCalendarComponent<MonthCalendar>
    • refreshItem

      public void refreshItem(LocalDate date)
      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 contain date