Top Inners Fields Constructors Methods
com.dlsc.gemsfx

public Class DurationPicker

extends CustomComboBox<Duration>
Class Inheritance
Imports
com.dlsc.gemsfx.skins.DurationPickerSkin, javafx.beans.InvalidationListener, javafx.beans.property.BooleanProperty, .ListProperty, .ObjectProperty, .SimpleBooleanProperty, .SimpleListProperty, .SimpleObjectProperty, javafx.collections.FXCollections, .MapChangeListener, .ObservableList, javafx.scene.Node, javafx.scene.control.Label, .Skin, javafx.scene.layout.Region, javafx.util.Callback, .Pair, java.time.Duration, java.time.temporal.ChronoUnit, java.util.Objects, java.util.function.Consumer

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
DurationPicker.LabelType

The possible types of labels used by the duration picker, see setLabelType(LabelType).

Field Summary

Modifier and TypeField and Description
private final ObjectProperty<Duration>
private final ListProperty<ChronoUnit>
private final BooleanProperty
private final ObjectProperty<DurationPicker.LabelType>
private final BooleanProperty
private final ObjectProperty<Duration>
private final ObjectProperty<Duration>
private final ObjectProperty<Consumer<DurationPicker>>
private final BooleanProperty
private final ObjectProperty<Callback<Pair<ChronoUnit, ChronoUnit>, Node>>
private final BooleanProperty

Constructor Summary

AccessConstructor and Description
public

Method Summary

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

Overrides javafx.scene.control.Control.createDefaultSkin.

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

public final ObjectProperty<Duration>
public final ListProperty<ChronoUnit>
fieldsProperty()

The list of fields that will be displayed inside the control.

public final BooleanProperty

Returns:

true if the fields will be filled with leading zeros
fillDigitsProperty
()

Determines if the fields will be "filled" with leading zeros or not, example: "04" for 4 hours, or "0005" for 5 milliseconds.

public final Duration
public final ObservableList<ChronoUnit>
public final DurationPicker.LabelType
public final Duration
public final Duration
public final Consumer<DurationPicker>
public final Callback<Pair<ChronoUnit, ChronoUnit>, Node>
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 boolean
public final ObjectProperty<DurationPicker.LabelType>

Returns:

the type of labels shown for each unit
labelTypeProperty
()

The label type determines if the control will show no labels, short labels (e.g. "d") or long labels (e.g. "days").

public final BooleanProperty

Returns:

true if rollover is desired
linkingFieldsProperty
()

A property used to control whether the fields should automatically increase or decrease the previous field when they reach their upper or lower limit.

public final ObjectProperty<Duration>

Returns:

the maximum duration
maximumDurationProperty
()

Stores the maximum duration that the picker can display.

public final ObjectProperty<Duration>

Returns:

the minimum duration
minimumDurationProperty
()

Stores the minimum duration that the picker can display.

public final ObjectProperty<Consumer<DurationPicker>>

Returns:

the "on show popup" consumer
onShowPopupProperty
()

This consumer will be invoked to bring up a control for entering the time without using the keyboard.

public final BooleanProperty

Returns:

true if the fields should rollover
rolloverProperty
()

A flag used to signal whether the time fields should start at the beginning of its value range when it reaches the end of it.

public ObjectProperty<Callback<Pair<ChronoUnit, ChronoUnit>, Node>>

Returns:

the separator factory
separatorFactoryProperty
()

The separator factory is used to create nodes that will be placed between two fields of the picker.

public final void
public final void
public final void
setFillDigits(boolean fillDigits)

public final void
public final void
setLinkingFields(boolean linkingFields)

public final void
setMaximumDuration(Duration maximumDuration)

public final void
setMinimumDuration(Duration minimumDuration)

public final void
public final void
setRollover(boolean rollover)

public void
public final void
setShowPopupTriggerButton(boolean showPopupTriggerButton)

public final BooleanProperty

Returns:

true if the control will show a button for showing the popup
showPopupTriggerButtonProperty
()

Determines if the control will show a button for showing or hiding the popup.

Inherited from com.dlsc.gemsfx.CustomComboBox:
buttonDisplayPropertygetButtonDisplaygetClassCssMetaDatagetControlCssMetaDatasetButtonDisplay

Field Detail

durationback to summary
private final ObjectProperty<Duration> duration
fieldsback to summary
private final ListProperty<ChronoUnit> fields
fillDigitsback to summary
private final BooleanProperty fillDigits
labelTypeback to summary
private final ObjectProperty<DurationPicker.LabelType> labelType
linkingFieldsback to summary
private final BooleanProperty linkingFields
maximumDurationback to summary
private final ObjectProperty<Duration> maximumDuration
minimumDurationback to summary
private final ObjectProperty<Duration> minimumDuration
onShowPopupback to summary
private final ObjectProperty<Consumer<DurationPicker>> onShowPopup
rolloverback to summary
private final BooleanProperty rollover
separatorFactoryback to summary
private final ObjectProperty<Callback<Pair<ChronoUnit, ChronoUnit>, Node>> separatorFactory
showPopupTriggerButtonback to summary
private final BooleanProperty showPopupTriggerButton

Constructor Detail

DurationPickerback to summary
public DurationPicker()

Method Detail

constrainback to summary
private void constrain()
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
durationPropertyback to summary
public final ObjectProperty<Duration> durationProperty()
fieldsPropertyback to summary
public final ListProperty<ChronoUnit> fieldsProperty()

The list of fields that will be displayed inside the control. Supported units are: weeks, days, hours, minutes, seconds, millis.

fillDigitsPropertyback to summary
public final BooleanProperty fillDigitsProperty()

Determines if the fields will be "filled" with leading zeros or not, example: "04" for 4 hours, or "0005" for 5 milliseconds. This only applies to fields with a granularity of HOURS or lower. It does not make sense to fill DAYS with it as there is no limit on the number of days (no upper bound). The default value is "true".

Returns:BooleanProperty

true if the fields will be filled with leading zeros

getDurationback to summary
public final Duration getDuration()
getFieldsback to summary
public final ObservableList<ChronoUnit> getFields()
getLabelTypeback to summary
public final DurationPicker.LabelType getLabelType()
getMaximumDurationback to summary
public final Duration getMaximumDuration()
getMinimumDurationback to summary
public final Duration getMinimumDuration()
getOnShowPopupback to summary
public final Consumer<DurationPicker> getOnShowPopup()
getSeparatorFactoryback to summary
public final Callback<Pair<ChronoUnit, ChronoUnit>, Node> getSeparatorFactory()
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
isFillDigitsback to summary
public final boolean isFillDigits()
isLinkingFieldsback to summary
public final boolean isLinkingFields()
isRolloverback to summary
public final boolean isRollover()
isShowPopupTriggerButtonback to summary
public final boolean isShowPopupTriggerButton()
labelTypePropertyback to summary
public final ObjectProperty<DurationPicker.LabelType> labelTypeProperty()

The label type determines if the control will show no labels, short labels (e.g. "d") or long labels (e.g. "days").

Returns:ObjectProperty<DurationPicker.LabelType>

the type of labels shown for each unit

linkingFieldsPropertyback to summary
public final BooleanProperty linkingFieldsProperty()

A property used to control whether the fields should automatically increase or decrease the previous field when they reach their upper or lower limit.

Returns:BooleanProperty

true if rollover is desired

maximumDurationPropertyback to summary
public final ObjectProperty<Duration> maximumDurationProperty()

Stores the maximum duration that the picker can display.

Returns:ObjectProperty<Duration>

the maximum duration

minimumDurationPropertyback to summary
public final ObjectProperty<Duration> minimumDurationProperty()

Stores the minimum duration that the picker can display. The minimum duration can not be negative.

Returns:ObjectProperty<Duration>

the minimum duration

onShowPopupPropertyback to summary
public final ObjectProperty<Consumer<DurationPicker>> onShowPopupProperty()

This consumer will be invoked to bring up a control for entering the time without using the keyboard. The default implementation shows a popup.

Returns:ObjectProperty<Consumer<DurationPicker>>

the "on show popup" consumer

rolloverPropertyback to summary
public final BooleanProperty rolloverProperty()

A flag used to signal whether the time fields should start at the beginning of its value range when it reaches the end of it. E.g. incrementing hour 23 would result in hour 0 when the user tries to increase it by one.

Returns:BooleanProperty

true if the fields should rollover

separatorFactoryPropertyback to summary
public ObjectProperty<Callback<Pair<ChronoUnit, ChronoUnit>, Node>> separatorFactoryProperty()

The separator factory is used to create nodes that will be placed between two fields of the picker. E.g. to separate hours one would return a label with a colon in it (8 hours 35 minutes and 40 seconds would then look like this -> "8:35:40").

Returns:ObjectProperty<Callback<Pair<ChronoUnit, ChronoUnit>, Node>>

the separator factory

setDurationback to summary
public final void setDuration(Duration duration)
setFieldsback to summary
public final void setFields(ObservableList<ChronoUnit> fields)
setFillDigitsback to summary
public final void setFillDigits(boolean fillDigits)
setLabelTypeback to summary
public final void setLabelType(DurationPicker.LabelType labelType)
setLinkingFieldsback to summary
public final void setLinkingFields(boolean linkingFields)
setMaximumDurationback to summary
public final void setMaximumDuration(Duration maximumDuration)
setMinimumDurationback to summary
public final void setMinimumDuration(Duration minimumDuration)
setOnShowPopupback to summary
public final void setOnShowPopup(Consumer<DurationPicker> onShowPopup)
setRolloverback to summary
public final void setRollover(boolean rollover)
setSeparatorFactoryback to summary
public void setSeparatorFactory(Callback<Pair<ChronoUnit, ChronoUnit>, Node> separatorFactory)
setShowPopupTriggerButtonback to summary
public final void setShowPopupTriggerButton(boolean showPopupTriggerButton)
showPopupTriggerButtonPropertyback to summary
public final BooleanProperty showPopupTriggerButtonProperty()

Determines if the control will show a button for showing or hiding the popup.

Returns:BooleanProperty

true if the control will show a button for showing the popup

com.dlsc.gemsfx back to summary

public final Enum DurationPicker.LabelType

extends Enum<DurationPicker.LabelType>
Class Inheritance

The possible types of labels used by the duration picker, see setLabelType(LabelType).

Field Summary

Modifier and TypeField and Description
public static final DurationPicker.LabelType
LONG

Display the full name of a field, e.g. "days", "hours", ...

public static final DurationPicker.LabelType
NONE

Do not display any label for the values.

public static final DurationPicker.LabelType
SHORT

Display short labels for each field, e.g. "d" for "days", "h" for "hours", etc...

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static DurationPicker.LabelType
public static DurationPicker.LabelType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

LONGback to summary
public static final DurationPicker.LabelType LONG

Display the full name of a field, e.g. "days", "hours", ...

NONEback to summary
public static final DurationPicker.LabelType NONE

Do not display any label for the values.

SHORTback to summary
public static final DurationPicker.LabelType SHORT

Display short labels for each field, e.g. "d" for "days", "h" for "hours", etc...

Constructor Detail

LabelTypeback to summary
private LabelType()

Method Detail

valueOfback to summary
public static DurationPicker.LabelType valueOf(String name)
valuesback to summary
public static DurationPicker.LabelType[] values()