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

public Class DateRangeView

extends Control
Class Inheritance
Imports
com.dlsc.gemsfx.CalendarView, .CalendarView.SelectionModel, com.dlsc.gemsfx.skins.DateRangeViewSkin, javafx.beans.property.*, javafx.beans.value.WritableValue, javafx.collections.FXCollections, .ObservableList, javafx.css.*, javafx.css.converter.EnumConverter, javafx.geometry.Orientation, .Side, javafx.scene.control.Control, .Skin, java.time.LocalDate, .YearMonth, java.time.temporal.TemporalAdjusters, .TemporalField, .WeekFields, java.util.*

The date range view can be used to define a start and an end date via two CalendarView instances.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final StringProperty
private final StringProperty
private CalendarView
private static final PseudoClass
private final ObjectProperty<Runnable>
private ObjectProperty<Orientation>
private final ObservableList<DateRangePreset>
private final ObjectProperty<Side>
private final StringProperty
private final CalendarView.SelectionModel
private final BooleanProperty
private final BooleanProperty
private CalendarView
private final StringProperty
private final ObjectProperty<DateRange>
private static final PseudoClass

Constructor Summary

AccessConstructor and Description
public
DateRangeView()

Constructs a new date range view.

Method Summary

Modifier and TypeMethod and Description
public final StringProperty

Returns:

the text for the apply button
applyTextProperty
()

The text used for the apply button.

public final StringProperty

Returns:

the text for the cancel button
cancelTextProperty
()

The text used for the cancel button.

private CalendarView
protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

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

private DateRangePreset
private DateRangePreset
private DateRangePreset
private DateRangePreset
private DateRangePreset
public final String
public final String
public static List<CssMetaData<? extends Styleable, ?>>

Returns:

the CssMetaData
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 CalendarView

Returns:

the calendar view for the end date selection
getEndCalendarView
()

Returns the CalendarView that is being used for the end date selection.

public final Runnable
public final Orientation
public final ObservableList<DateRangePreset>

Returns:

the presets
getPresets
()

The list of currently available presets.

public final Side
public final String
public final CalendarView.SelectionModel

Returns:

the shared calendar selection model
getSelectionModel
()

Returns the selection model used and shared by the two calendar picker instances.

public CalendarView

Returns:

the calendar view for the start date selection
getStartCalendarView
()

Returns the CalendarView that is being used for the start date selection.

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 final DateRange
public final boolean
public final boolean
public final ObjectProperty<Runnable>

Returns:

the closing callback
onCloseProperty
()

A runnable callback that will be invoked when the user closes the control.

public final ObjectProperty<Orientation>

Returns:

the layout orientation of the two calendar views
orientationProperty
()

Determines how the start and end calendars will be laid out, either next to each other (horizontal), or one on top of the other (vertical).

public final ObjectProperty<Side>

Returns:

the location of the presets
presetsLocationProperty
()

Defines where the presets will be shown relative to the two calendar views.

public final StringProperty

Returns:

the title for the preset section
presetTitleProperty
()

The name used for the title label of the presets section.

public final void
setApplyText(String applyText)

public final void
setCancelText(String cancelText)

public final void
public final void
public final void
setPresetsLocation(Side presetsLocation)

public final void
setPresetTitle(String presetTitle)

public final void
setShowCancelAndApplyButton(boolean showCancelAndApplyButton)

public final void
setShowPresets(boolean showPresets)

public final void
setToText(String toText)

public final void
public final BooleanProperty

Returns:

true if the buttons will be shown
showCancelAndApplyButtonProperty
()

Shows or hides the cancel and the apply buttons.

public final BooleanProperty

Returns:

controls visibility of the presets section
showPresetsProperty
()

Controls whether the presets will be shown by the control

public final StringProperty

Returns:

the text for the "to" label
toTextProperty
()

The text shown on the label between the two calendar views.

public final ObjectProperty<DateRange>

Returns:

the current date range
valueProperty
()

Stores the currently selected / defined date range.

Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertyexecuteAccessibleActiongetBaselineOffsetgetContextMenugetCssMetaDatagetInitialFocusTraversablegetSkingetTooltipisResizablelayoutChildrenqueryAccessibleAttributesetContextMenusetSkinsetTooltipskinPropertytooltipProperty

Field Detail

applyTextback to summary
private final StringProperty applyText
cancelTextback to summary
private final StringProperty cancelText
endCalendarViewback to summary
private CalendarView endCalendarView
HORIZONTAL_PSEUDOCLASS_STATEback to summary
private static final PseudoClass HORIZONTAL_PSEUDOCLASS_STATE
onCloseback to summary
private final ObjectProperty<Runnable> onClose
orientationback to summary
private ObjectProperty<Orientation> orientation
presetsback to summary
private final ObservableList<DateRangePreset> presets
presetsLocationback to summary
private final ObjectProperty<Side> presetsLocation
presetTitleback to summary
private final StringProperty presetTitle
selectionModelback to summary
private final CalendarView.SelectionModel selectionModel
showCancelAndApplyButtonback to summary
private final BooleanProperty showCancelAndApplyButton
showPresetsback to summary
private final BooleanProperty showPresets
startCalendarViewback to summary
private CalendarView startCalendarView
toTextback to summary
private final StringProperty toText
valueback to summary
private final ObjectProperty<DateRange> value
VERTICAL_PSEUDOCLASS_STATEback to summary
private static final PseudoClass VERTICAL_PSEUDOCLASS_STATE

Constructor Detail

DateRangeViewback to summary
public DateRangeView()

Constructs a new date range view.

Method Detail

applyTextPropertyback to summary
public final StringProperty applyTextProperty()

The text used for the apply button.

Returns:StringProperty

the text for the apply button

cancelTextPropertyback to summary
public final StringProperty cancelTextProperty()

The text used for the cancel button.

Returns:StringProperty

the text for the cancel button

createCalendarback to summary
private CalendarView createCalendar()
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
createLastMonthPresetback to summary
private DateRangePreset createLastMonthPreset()
createThisMonthPresetback to summary
private DateRangePreset createThisMonthPreset()
createThisWeekPresetback to summary
private DateRangePreset createThisWeekPreset()
createTodayRangePresetback to summary
private DateRangePreset createTodayRangePreset()
createYesterdayPresetback to summary
private DateRangePreset createYesterdayPreset()
getApplyTextback to summary
public final String getApplyText()
getCancelTextback to summary
public final String getCancelText()
getClassCssMetaDataback to summary
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.

Returns:List<CssMetaData<? extends Styleable, ?>>

the CssMetaData

Since
JavaFX 8.0
getControlCssMetaDataback to summary
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Doc from javafx.scene.control.Control.getControlCssMetaData.

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

Annotations
@Override
Since
JavaFX 8.0
getEndCalendarViewback to summary
public CalendarView getEndCalendarView()

Returns the CalendarView that is being used for the end date selection.

Returns:CalendarView

the calendar view for the end date selection

getOnCloseback to summary
public final Runnable getOnClose()
getOrientationback to summary
public final Orientation getOrientation()
getPresetsback to summary
public final ObservableList<DateRangePreset> getPresets()

The list of currently available presets.

Returns:ObservableList<DateRangePreset>

the presets

getPresetsLocationback to summary
public final Side getPresetsLocation()
getPresetTitleback to summary
public final String getPresetTitle()
getSelectionModelback to summary
public final CalendarView.SelectionModel getSelectionModel()

Returns the selection model used and shared by the two calendar picker instances.

Returns:CalendarView.SelectionModel

the shared calendar selection model

See Also
getStartCalendarView(), getEndCalendarView()
getStartCalendarViewback to summary
public CalendarView getStartCalendarView()

Returns the CalendarView that is being used for the start date selection.

Returns:CalendarView

the calendar view for the start date selection

getToTextback to summary
public final String getToText()
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
getValueback to summary
public final DateRange getValue()
isShowCancelAndApplyButtonback to summary
public final boolean isShowCancelAndApplyButton()
isShowPresetsback to summary
public final boolean isShowPresets()
onClosePropertyback to summary
public final ObjectProperty<Runnable> onCloseProperty()

A runnable callback that will be invoked when the user closes the control.

Returns:ObjectProperty<Runnable>

the closing callback

orientationPropertyback to summary
public final ObjectProperty<Orientation> orientationProperty()

Determines how the start and end calendars will be laid out, either next to each other (horizontal), or one on top of the other (vertical).

Returns:ObjectProperty<Orientation>

the layout orientation of the two calendar views

presetsLocationPropertyback to summary
public final ObjectProperty<Side> presetsLocationProperty()

Defines where the presets will be shown relative to the two calendar views. Supports left and right side values.

Returns:ObjectProperty<Side>

the location of the presets

presetTitlePropertyback to summary
public final StringProperty presetTitleProperty()

The name used for the title label of the presets section. E.g. "Quick Selection".

Returns:StringProperty

the title for the preset section

setApplyTextback to summary
public final void setApplyText(String applyText)
setCancelTextback to summary
public final void setCancelText(String cancelText)
setOnCloseback to summary
public final void setOnClose(Runnable onClose)
setOrientationback to summary
public final void setOrientation(Orientation value)
setPresetsLocationback to summary
public final void setPresetsLocation(Side presetsLocation)
setPresetTitleback to summary
public final void setPresetTitle(String presetTitle)
setShowCancelAndApplyButtonback to summary
public final void setShowCancelAndApplyButton(boolean showCancelAndApplyButton)
setShowPresetsback to summary
public final void setShowPresets(boolean showPresets)
setToTextback to summary
public final void setToText(String toText)
setValueback to summary
public final void setValue(DateRange value)
showCancelAndApplyButtonPropertyback to summary
public final BooleanProperty showCancelAndApplyButtonProperty()

Shows or hides the cancel and the apply buttons.

Returns:BooleanProperty

true if the buttons will be shown

showPresetsPropertyback to summary
public final BooleanProperty showPresetsProperty()

Controls whether the presets will be shown by the control

Returns:BooleanProperty

controls visibility of the presets section

toTextPropertyback to summary
public final StringProperty toTextProperty()

The text shown on the label between the two calendar views.

Returns:StringProperty

the text for the "to" label

valuePropertyback to summary
public final ObjectProperty<DateRange> valueProperty()

Stores the currently selected / defined date range.

Returns:ObjectProperty<DateRange>

the current date range

com.dlsc.gemsfx.daterange back to summary

private Class DateRangeView.StyleableProperties

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final CssMetaData<DateRangeView, Orientation>
private static final List<CssMetaData<? extends Styleable, ?>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ORIENTATIONback to summary
private static final CssMetaData<DateRangeView, Orientation> ORIENTATION
STYLEABLESback to summary
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES

Constructor Detail

StyleablePropertiesback to summary
private StyleableProperties()