Top Description Fields Constructors Methods
com.dlsc.gemsfx.daterange

public Class DateRangePicker

extends ComboBoxBase<DateRange>
Class Inheritance
Imports
com.dlsc.gemsfx.skins.DateRangePickerSkin, javafx.beans.property.BooleanProperty, .ObjectProperty, .SimpleBooleanProperty, .SimpleObjectProperty, .SimpleStringProperty, .StringProperty, javafx.scene.control.ComboBoxBase, .Skin, javafx.scene.layout.Region, java.time.format.DateTimeFormatter, .FormatStyle, java.util.Objects

A control to let the user select a date range (start date, end date) via two com.dlsc.gemsfx.CalendarView instances or via a preset link.
See Also
DateRangeView

Field Summary

Modifier and TypeField and Description
private final StringProperty
private DateRangeView
private final ObjectProperty<DateTimeFormatter>
private final BooleanProperty
private final BooleanProperty
private final BooleanProperty
Inherited from javafx.scene.control.ComboBoxBase:
ON_HIDDENON_HIDINGON_SHOWINGON_SHOWN

Constructor Summary

AccessConstructor and Description
public
DateRangePicker()

Constructs a new picker.

Method Summary

Modifier and TypeMethod and Description
protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

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

public final StringProperty

Returns:

the text to show when a custom range has been selected
customRangeTextProperty
()

Stores the text shown when a custom date range has been selected by the user instead of a preset range.

public final ObjectProperty<DateTimeFormatter>

Returns:

the date formatter
formatterProperty
()

The formatter used to convert the selected date / date range to text.

public final String
public DateRangeView

Returns:

the actual view when expanded
getDateRangeView
()

Returns the view that will be shown by this picker when expanded.

public final DateTimeFormatter
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 final boolean
public final boolean
public final boolean
public final void
setCustomRangeText(String customRangeText)

public final void
public final void
setShowIcon(boolean showIcon)

public final void
setShowPresetTitle(boolean showPresetTitle)

public final void
setSmall(boolean small)

public final BooleanProperty

Returns:

true if the icon will be shown
showIconProperty
()

Determines if the picker will show the calendar icon in front of the selected date range.

public final BooleanProperty

Returns:

true if the preset title will be shown
showPresetTitleProperty
()

Determines if the picker will show the name of the selected preset in front of the selected date range, e.g. "Last Week".

public final BooleanProperty

Returns:

true if the picker displays its value on a single line of text
smallProperty
()

The picker can either display all of its information on two lines or in a single line (small).

Inherited from javafx.scene.control.ComboBoxBase:
armarmedPropertydisarmeditablePropertyexecuteAccessibleActiongetOnActiongetOnHiddengetOnHidinggetOnShowinggetOnShowngetPromptTextgetValuehideisArmedisEditableisShowingonActionPropertyonHiddenPropertyonHidingPropertyonShowingPropertyonShownPropertypromptTextPropertyqueryAccessibleAttributesetEditablesetOnActionsetOnHiddensetOnHidingsetOnShowingsetOnShownsetPromptTextsetValueshowshowingPropertyvalueProperty

Field Detail

customRangeTextback to summary
private final StringProperty customRangeText
dateRangeViewback to summary
private DateRangeView dateRangeView
formatterback to summary
private final ObjectProperty<DateTimeFormatter> formatter
showIconback to summary
private final BooleanProperty showIcon
showPresetTitleback to summary
private final BooleanProperty showPresetTitle
smallback to summary
private final BooleanProperty small

Constructor Detail

DateRangePickerback to summary
public DateRangePicker()

Constructs a new picker.

Method Detail

createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Annotations
@Override
customRangeTextPropertyback to summary
public final StringProperty customRangeTextProperty()

Stores the text shown when a custom date range has been selected by the user instead of a preset range.

Returns:StringProperty

the text to show when a custom range has been selected

formatterPropertyback to summary
public final ObjectProperty<DateTimeFormatter> formatterProperty()

The formatter used to convert the selected date / date range to text.

Returns:ObjectProperty<DateTimeFormatter>

the date formatter

getCustomRangeTextback to summary
public final String getCustomRangeText()
getDateRangeViewback to summary
public DateRangeView getDateRangeView()

Returns the view that will be shown by this picker when expanded.

Returns:DateRangeView

the actual view when expanded

getFormatterback to summary
public final DateTimeFormatter getFormatter()
getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Annotations
@Override
isShowIconback to summary
public final boolean isShowIcon()
isShowPresetTitleback to summary
public final boolean isShowPresetTitle()
isSmallback to summary
public final boolean isSmall()
setCustomRangeTextback to summary
public final void setCustomRangeText(String customRangeText)
setFormatterback to summary
public final void setFormatter(DateTimeFormatter formatter)
setShowIconback to summary
public final void setShowIcon(boolean showIcon)
setShowPresetTitleback to summary
public final void setShowPresetTitle(boolean showPresetTitle)
setSmallback to summary
public final void setSmall(boolean small)
showIconPropertyback to summary
public final BooleanProperty showIconProperty()

Determines if the picker will show the calendar icon in front of the selected date range.

Returns:BooleanProperty

true if the icon will be shown

showPresetTitlePropertyback to summary
public final BooleanProperty showPresetTitleProperty()

Determines if the picker will show the name of the selected preset in front of the selected date range, e.g. "Last Week".

Returns:BooleanProperty

true if the preset title will be shown

smallPropertyback to summary
public final BooleanProperty smallProperty()

The picker can either display all of its information on two lines or in a single line (small).

Returns:BooleanProperty

true if the picker displays its value on a single line of text