Verified Owner
Top Description Inners Fields Constructors Methods
org.jabref.gui.util.component

public Class TemporalAccessorPicker

extends DatePicker
Class Inheritance
Imports
java.time.DateTimeException, .LocalDate, .LocalDateTime, .LocalTime, .Year, .YearMonth, java.time.format.DateTimeFormatter, .DateTimeParseException, java.time.temporal.TemporalAccessor, .TemporalQueries, java.util.Objects, java.util.function.Supplier, javafx.beans.property.ObjectProperty, .SimpleObjectProperty, javafx.scene.control.ContextMenu, .DatePicker, javafx.util.StringConverter, org.jabref.gui.fieldeditors.contextmenu.EditorContextAction, org.jabref.gui.util.BindingsHelper, org.jabref.logic.util.strings.StringUtil, org.jabref.model.entry.Date

A date picker with configurable datetime format where both date and time can be changed via the text field and the date can additionally be changed via the JavaFX default date picker. Also supports incomplete dates.

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final ObjectProperty<StringConverter<TemporalAccessor>>
private final DateTimeFormatter
private final ObjectProperty<TemporalAccessor>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static TemporalAccessor
private static LocalDate
getDate(TemporalAccessor temporalAccessor)

private static LocalDate
public final StringConverter<TemporalAccessor>
public TemporalAccessor
public final void
public void
public final ObjectProperty<StringConverter<TemporalAccessor>>
public ObjectProperty<TemporalAccessor>
Inherited from javafx.scene.control.DatePicker:
cancelEditchronologyPropertycommitValueconverterPropertycreateDefaultSkindayCellFactoryPropertyeditorPropertygetChronologygetClassCssMetaDatagetControlCssMetaDatagetConvertergetDayCellFactorygetEditorisShowWeekNumbersqueryAccessibleAttributesetChronologysetConvertersetDayCellFactorysetShowWeekNumbersshowWeekNumbersProperty

Field Detail

converterback to summary
private final ObjectProperty<StringConverter<TemporalAccessor>> converter

Hides javafx.scene.control.DatePicker.converter.

defaultFormatterback to summary
private final DateTimeFormatter defaultFormatter
temporalAccessorValueback to summary
private final ObjectProperty<TemporalAccessor> temporalAccessorValue

Constructor Detail

TemporalAccessorPickerback to summary
public TemporalAccessorPicker()

Method Detail

addCurrentTimeback to summary
private static TemporalAccessor addCurrentTime(LocalDate date)
getDateback to summary
private static LocalDate getDate(TemporalAccessor temporalAccessor)
getLocalDateback to summary
private static LocalDate getLocalDate(TemporalAccessor dateTime)
getStringConverterback to summary
public final StringConverter<TemporalAccessor> getStringConverter()
getTemporalAccessorValueback to summary
public TemporalAccessor getTemporalAccessorValue()
setStringConverterback to summary
public final void setStringConverter(StringConverter<TemporalAccessor> value)
setTemporalAccessorValueback to summary
public void setTemporalAccessorValue(TemporalAccessor temporalAccessorValue)
stringConverterPropertyback to summary
public final ObjectProperty<StringConverter<TemporalAccessor>> stringConverterProperty()
temporalAccessorValuePropertyback to summary
public ObjectProperty<TemporalAccessor> temporalAccessorValueProperty()
org.jabref.gui.util.component back to summary

private Class TemporalAccessorPicker.InternalConverter

extends StringConverter<LocalDate>
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public LocalDate
fromString(String value)

Implements abstract javafx.util.StringConverter.fromString.

Converts the string provided into an object defined by the specific converter.

public String
toString(LocalDate object)

Implements abstract javafx.util.StringConverter.toString.

Converts the object provided into its string form.

Constructor Detail

InternalConverterback to summary
private InternalConverter()

Method Detail

fromStringback to summary
public LocalDate fromString(String value)

Implements abstract javafx.util.StringConverter.fromString.

Doc from javafx.util.StringConverter.fromString.

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.

Annotations
@Override
toStringback to summary
public String toString(LocalDate object)

Implements abstract javafx.util.StringConverter.toString.

Doc from javafx.util.StringConverter.toString.

Converts the object provided into its string form. Format of the returned string is defined by the specific converter.

Annotations
@Override