Top Description Inners Fields Constructors Methods
com.dlsc.gemsfx

public Class CalendarView

extends Control
Class Inheritance
Imports
com.dlsc.gemsfx.skins.CalendarViewSkin, .DateCellSkin, javafx.beans.property.BooleanProperty, .DoubleProperty, .ListProperty, .ObjectProperty, .SimpleListProperty, .SimpleObjectProperty, .SimpleStringProperty, .StringProperty, javafx.collections.FXCollections, .ObservableList, .ObservableSet, javafx.css.CssMetaData, .Styleable, .StyleableBooleanProperty, .StyleableDoubleProperty, .StyleableObjectProperty, .StyleableProperty, javafx.css.converter.BooleanConverter, .EnumConverter, .SizeConverter, javafx.scene.control.Cell, .Control, .Skin, javafx.scene.input.MouseEvent, .TouchEvent, javafx.scene.layout.Region, javafx.util.Callback, java.time.DayOfWeek, .LocalDate, .YearMonth, java.util.ArrayList, .Collections, .List, .Objects

Displays a given month of a given year. The view can be configured in many ways: Additionally the application can choose from two different behaviours when the user clicks on a date:
  1. Perform a selection / select the date
  2. Show details of the date (by default shows a popover with all entries on that date)
The image below shows the visual appearance of this control: Date Picker

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
CalendarView.DateCell

The base date cell implementation for month views.

public static enum
CalendarView.HeaderLayout

Different layouts that can be used to position the month, the year, and the various navigation elements in the header of the view.

public static enum
CalendarView.MonthDisplayMode

Enumerates the display modes for the month label at the top of the calendar view.

public static class
private static class
public static enum
CalendarView.YearDisplayMode

Enumerates the display modes for the year label at the top of the calendar view.

Field Summary

Modifier and TypeField and Description
private final ObjectProperty<Callback<CalendarView, CalendarView.DateCell>>
private final ObjectProperty<Callback<LocalDate, Boolean>>
private static final boolean
private static final boolean
private static final boolean
private static final boolean
private static final boolean
private static final boolean
private static final boolean
private static final CalendarView.MonthDisplayMode
private static final boolean
private static final boolean
private static final boolean
private static final boolean
private static final boolean
private static final boolean
private static final boolean
private static final boolean
private static final double
private static final CalendarView.YearDisplayMode
private static final boolean
private BooleanProperty
private BooleanProperty
private BooleanProperty
private BooleanProperty
private BooleanProperty
private BooleanProperty
private final ObjectProperty<LocalDate>
private final ObjectProperty<CalendarView.HeaderLayout>
private final ObjectProperty<LocalDate>
private BooleanProperty
private ObjectProperty<CalendarView.MonthDisplayMode>
private BooleanProperty
private final ObjectProperty<CalendarView.SelectionModel>
private BooleanProperty
private BooleanProperty
private BooleanProperty
private BooleanProperty
private BooleanProperty
private BooleanProperty
private BooleanProperty
private final ObjectProperty<LocalDate>
private final StringProperty
private final ObservableSet<DayOfWeek>
private DoubleProperty
private ObjectProperty<CalendarView.YearDisplayMode>
private final ObjectProperty<YearMonth>
private YearMonthView
private BooleanProperty
private YearView

Constructor Summary

AccessConstructor and Description
public
CalendarView()

Constructs a new view.

Method Summary

Modifier and TypeMethod and Description
public final ObjectProperty<Callback<CalendarView, CalendarView.DateCell>>

Returns:

the cell factory
cellFactoryProperty
()

A factory for creating alternative content for the month view.

protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public final ObjectProperty<Callback<LocalDate, Boolean>>

Returns:

a callback that determines the selectability of each date based on custom criteria.
dateFilterProperty
()

A property to define a filter for determining which dates in the calendar can be selected.

public final BooleanProperty

Returns:

true if the button used for showing the month selection view should be disabled
disableMonthDropdownButtonProperty
()

A property to control whether the "show month view" button will be disabled or not.

public final BooleanProperty

Returns:

true if the button used for going to the next month is currently disabled
disableNextMonthButtonProperty
()

A property to control whether the "show next month" button will be disabled or not.

public final BooleanProperty

Returns:

true if the button used for going to the next year is currently disabled
disableNextYearButtonProperty
()

A property to control whether the "show next year" button will be disabled or not.

public final BooleanProperty

Returns:

true if the button used for going to the next month is currently disabled
disablePreviousMonthButtonProperty
()

A property to control whether the "show previous month" button will be disabled or not.

public final BooleanProperty

Returns:

true if the button used for going to the next year is currently disabled
disablePreviousYearButtonProperty
()

A property to control whether the "show previous year" button will be disabled or not.

public final BooleanProperty

Returns:

true if the button used for showing the year selection view should be disabled
disableYearDropdownButtonProperty
()

A property to control whether the "show year view" button will be disabled or not.

public final ObjectProperty<LocalDate>

Returns:

the earliest possible date available for selection
earliestDateProperty
()

The earliest day that can be selected in the view.

public final Callback<CalendarView, CalendarView.DateCell>

Returns:

the cell factory
getCellFactory
()

Returns the value of cellFactoryProperty().

public static List<CssMetaData<? extends Styleable, ?>>
getClassCssMetaData()

Hides javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

public List<CssMetaData<? extends Styleable, ?>>
getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

public final Callback<LocalDate, Boolean>
public final LocalDate
public final CalendarView.HeaderLayout
public final LocalDate
public final CalendarView.MonthDisplayMode
public final CalendarView.SelectionModel
public final LocalDate

Returns:

the date representing "today"
getToday
()

Returns the value of todayProperty().

public final String
public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public ObservableSet<DayOfWeek>

Returns:

the weekend days
getWeekendDays
()

Returns the days of the week that are considered to be weekend days, for example Saturday and Sunday, or Friday and Saturday.

public final double
public final CalendarView.YearDisplayMode
public final YearMonth

Returns:

the year and month
getYearMonth
()

Returns the value of yearMonthProperty().

public YearMonthView

Returns:

the view used for showing and selecting a month
getYearMonthView
()

Returns the view used to display a month selection to the user.

public YearView

Returns:

the view used for showing and selecting a year
getYearView
()

Returns the view used to display a year selection to the user.

public final ObjectProperty<CalendarView.HeaderLayout>

Returns:

the currently used layout used for the header
headerLayoutProperty
()

The header layout value determines how the information and the navigation elements in the header will be laid out.

public final boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final boolean

Returns:

true if the arrows will be shown
isShowMonthArrows
()

Returns the value of the showMonthArrowsProperty().

public final boolean

Returns:

true if today will be highlighted visually
isShowToday
()

Returns the value of showTodayProperty().

public final boolean

Returns:

true if the button is shown
isShowTodayButton
()

Returns the value of the showTodayButtonProperty().

public final boolean

Returns:

true if week numbers will be shown
isShowWeekNumbers
()

Returns the value of showWeekNumbersProperty().

public final boolean
public final boolean
public final ObjectProperty<LocalDate>

Returns:

the earliest possible date available for selection
latestDateProperty
()

The latest day that can be selected in the view.

public final BooleanProperty

Returns:

true if days not belonging to the current month will be marked selected
markSelectedDaysOfPreviousOrNextMonthProperty
()

Determines whether selected dates will be marked as such when they are being displayed at the beginning of the next month or at the end of the previous month.

public final ObjectProperty<CalendarView.MonthDisplayMode>

Returns:

the month display mode property.
monthDisplayModeProperty
()

The display mode for the month label at the top of the calendar view.

public final BooleanProperty

Returns:

true if the user can pick a month directly
monthSelectionViewEnabledProperty
()

Determines whether the control offers the option to the user to pick a different month directly via a designated month selection view.

public final ObjectProperty<CalendarView.SelectionModel>
public final void
setCellFactory(Callback<CalendarView, CalendarView.DateCell>
the cell factory
factory
)

Sets the value of cellFactoryProperty().

public final void
public final void
setDisableMonthDropdownButton(boolean disableMonthDropdownButton)

public final void
setDisableNextMonthButton(boolean disableNextMonthButton)

public final void
setDisableNextYearButton(boolean disableNextYearButton)

public final void
setDisablePreviousMonthButton(boolean disablePreviousMonthButton)

public final void
setDisablePreviousYearButton(boolean disablePreviousYearButton)

public final void
setDisableYearDropdownButton(boolean disableYearDropdownButton)

public final void
setEarliestDate(LocalDate earliestDate)

public final void
public final void
public final void
setMarkSelectedDaysOfPreviousOrNextMonth(boolean markSelectedDaysOfPreviousOrNextMonth)

public final void
public final void
setMonthSelectionViewEnabled(boolean monthSelectionViewEnabled)

public final void
public final void
setShowDaysOfPreviousOrNextMonth(boolean showDaysOfPreviousOrNextMonth)

public final void
setShowMonth(boolean showMonth)

public final void
setShowMonthArrows(boolean
if true will show the arrows
show
)

Sets the value of the showMonthArrowsProperty().

public final void
setShowToday(boolean
if true today will be highlighted visually
show
)

Sets the value of showTodayProperty().

public final void
setShowTodayButton(boolean
if true will show the button
show
)

Sets the value of the showTodayButtonProperty().

public final void
setShowWeekNumbers(boolean
if true will show week numbers
show
)

Sets the value of showWeekNumbersProperty().

public final void
setShowYear(boolean showYear)

public final void
setToday(LocalDate
the date representing "today"
date
)

Sets the value of todayProperty().

public final void
setTodayText(String todayText)

public final void
setWeekNumberColumnWidth(double weekNumberColumnWidth)

public final void
public void
public final void
setYearSelectionViewEnabled(boolean yearSelectionViewEnabled)

public final BooleanProperty

Returns:

true if the calendar will be filled up with days of the previous and the next month
showDaysOfPreviousOrNextMonthProperty
()

By default, the calendar for a given month might also show some days of the previous and the next month.

public final BooleanProperty

Returns:

true if the arrows will be shown
showMonthArrowsProperty
()

Shows or hides the arrows to change the month.

public final BooleanProperty

Returns:

the BooleanProperty associated with the visibility of the month display.

When set to false: - Hides the month label at the top of the calendar. - Disables the visibility of buttons for month navigation (e.g., arrows or dropdown buttons).

When set to true: - Displays the month at the top of the calendar. - The visibility of the dropdown button for changing months is determined by the MonthDisplayMode. If the mode is MonthDisplayMode#TEXT_AND_DROPDOWN, the dropdown button is displayed. - The visibility of the month navigation arrows is independent of this property and is controlled by the {#showMonthArrows} property.

showMonthProperty
()

Returns the BooleanProperty that controls the visibility of the month display in the header.

public final BooleanProperty

Returns:

true if the button will be shown
showTodayButtonProperty
()

Show or hide a button to quickly go to today's date.

public final BooleanProperty

Returns:

true if today will be shown differently
showTodayProperty
()

A flag used to indicate that the view will mark the area that represents the value of todayProperty().

public final BooleanProperty

Returns:

true if week numbers are shown
showWeekNumbersProperty
()

Controls whether the view will show week numbers.

public final BooleanProperty

Returns:

true if the year is shown in the header
showYearProperty
()

Show or hide the year in the header.

public final ObjectProperty<LocalDate>

Returns:

the date representing "today"
todayProperty
()

Stores the date that is considered to represent "today".

public final StringProperty

Returns:

the today button text
todayTextProperty
()

The text that will be shown on the button used for going to today's date.

public final DoubleProperty
public final ObjectProperty<CalendarView.YearDisplayMode>

Returns:

the year display mode property.
yearDisplayModeProperty
()

The display mode for the year label at the top of the calendar view.

public final ObjectProperty<YearMonth>

Returns:

the year and month
yearMonthProperty
()

Stores the year and month shown by the control.

public final BooleanProperty

Returns:

true if the user can pick a month directly
yearSelectionViewEnabledProperty
()

Determines whether the control offers the option to the user to pick a different year directly via a designated year selection view.

Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertyexecuteAccessibleActiongetBaselineOffsetgetContextMenugetCssMetaDatagetInitialFocusTraversablegetSkingetTooltipisResizablelayoutChildrenqueryAccessibleAttributesetContextMenusetSkinsetTooltipskinPropertytooltipProperty