First recall how the date picker normally works: - The user selects a date in the popup, which sets valueProperty() to the selected date. - The converter (converterProperty()) is used to transform the date
to a string representation and display it in the text field.
The idea is now to intercept the process and add an additional step: - The user selects a date in the popup, which
sets valueProperty() to the selected date. - The date is converted to a TemporalAccessor (i.e,
enriched by a time component) using addCurrentTime(LocalDate) - The string converter (stringConverterProperty()) is used to transform the temporal accessor to a string representation and display it in
the text field.
Inspiration taken from Controlsfx DateTimePicker
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final ObjectProperty | |
| private final DateTimeFormatter | |
| private final ObjectProperty |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static TemporalAccessor | |
| private static LocalDate | |
| private static LocalDate | |
| public final StringConverter | |
| public TemporalAccessor | |
| public final void | |
| public void | |
| public final ObjectProperty | |
| public ObjectProperty |
| converter | back to summary |
|---|---|
| private final ObjectProperty<StringConverter<TemporalAccessor>> converter | |
| defaultFormatter | back to summary |
|---|---|
| private final DateTimeFormatter defaultFormatter | |
| temporalAccessorValue | back to summary |
|---|---|
| private final ObjectProperty<TemporalAccessor> temporalAccessorValue | |
| TemporalAccessorPicker | back to summary |
|---|---|
| public TemporalAccessorPicker() | |
| addCurrentTime | back to summary |
|---|---|
| private static TemporalAccessor addCurrentTime(LocalDate date) | |
| getDate | back to summary |
|---|---|
| private static LocalDate getDate(TemporalAccessor temporalAccessor) | |
| getLocalDate | back to summary |
|---|---|
| private static LocalDate getLocalDate(TemporalAccessor dateTime) | |
| getStringConverter | back to summary |
|---|---|
| public final StringConverter | |
| getTemporalAccessorValue | back to summary |
|---|---|
| public TemporalAccessor getTemporalAccessorValue() | |
| setStringConverter | back to summary |
|---|---|
| public final void setStringConverter(StringConverter<TemporalAccessor> value) | |
| setTemporalAccessorValue | back to summary |
|---|---|
| public void setTemporalAccessorValue(TemporalAccessor temporalAccessorValue) | |
| stringConverterProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| temporalAccessorValueProperty | back to summary |
|---|---|
| public ObjectProperty | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public LocalDate | fromString(String value)
Implements abstract javafx. Converts the string provided into an object defined by the specific converter. |
| public String | toString(LocalDate object)
Implements abstract javafx. Converts the object provided into its string form. |
| InternalConverter | back to summary |
|---|---|
| private InternalConverter() | |
| fromString | back to summary |
|---|---|
| public LocalDate fromString(String value) Implements abstract javafx. Doc from javafx. Converts the string provided into an object defined by the specific converter. Format of the string and type of the resulting object is defined by the specific converter.
| |
| toString | back to summary |
|---|---|
| public String toString(LocalDate object) Implements abstract javafx. Doc from javafx. Converts the object provided into its string form. Format of the returned string is defined by the specific converter.
| |