Module MaterialFX

Class MFXDatePickerSkin

All Implemented Interfaces:
Skin<MFXTextField>

public class MFXDatePickerSkin extends MFXTextFieldSkin
Skin associated with every MFXDatePicker by default.

Extends MFXTextFieldSkin and adds the necessary properties, components, listeners and bindings to build the date picker.

Compared to the old implementation (it was the MFXDatePickerContent class) this is much smaller, easier to read/understand, organized and efficient.

The structure is pretty simple. The popup contains a GridPane which shows the days of the current selected month. The month/year selection is controlled by a pair of MFXComboBox and arrows.

The grid is 6x7 (rows x columns). The first row contains the week days, the other rows contain the days. To make it as efficient as possible both the week days and the days cells are cached. The cells are just updated when needed.

When the MFXDatePicker.cellFactoryProperty() or the MFXDatePicker.localeProperty() change a full/partial reset of the cache is needed.

  • Constructor Details

  • Method Details

    • initialize

      protected void initialize()
    • setBehavior

      protected void setBehavior()
    • updateValue

      protected void updateValue(LocalDate date)
      Responsible for updating the date picker's text with the given date.

      The date is converted using the date picker's MFXDatePicker.converterSupplierProperty(). In case it's null uses toString().

      The caret is always positioned at the end of the text after the update.

    • createPopupContent

      protected Node createPopupContent()
      Responsible for creating the popup's content.
    • getDatePicker

      public MFXDatePicker getDatePicker()
      Convenience method to cast SkinBase.getSkinnable() to MFXDatePicker.
    • dispose

      public void dispose()
      Specified by:
      dispose in interface Skin<MFXTextField>
      Overrides:
      dispose in class SkinBase<MFXTextField>