[threeten-dev] [JavaFX API Review] RT-27841: Define API for DatePicker
Leif Samuelsson
leif.samuelsson at oracle.com
Thu Apr 18 19:15:32 PDT 2013
There is no time picker planned for 8.0, but I suggest that we file feature
requests in JIRA for TimePicker and DateTimePicker, to be considered for a
future release.
For many use cases, a ComboBox<LocalTime> might be enough. Especially if you
can prepopulate it with a list of times, say for ticket sales, appointments,
and such.
Leif
On 2013-04-18 19:03, Scott Palmer wrote:
> It's not clear to me,not knowing the new Java 8 date and time API. Will this be a Date and/or Time picker? I.e. will date and time be covered with a single control, or will the Date picker only handle calendar popups and choosing the date, with a separate control for a Time field?
>
>
> Scott
>
> On 2013-04-18, at 6:30 PM, Leif Samuelsson <leif.samuelsson at oracle.com> wrote:
>
>> Hi all,
>>
>> The new JSR-310 API for date and time has now made it into JDK 8. This means
>> that we can finally add a DatePicker UI control to JavaFX with support for a
>> large number of locale based calendar formats.
>>
>> DatePicker is built on ComboBox, using both a TextField and a popup for
>> typing or picking a date. The value type for setting and getting a date is
>> java.time.LocalDate. This class uses the ISO-8601 calendar (proleptic
>> Gregorian), although the actual display of the calendar popup will be based
>> on whatever calendar (Chronology in the API) that is either specified in the
>> user's default Locale, or set explicitly by the application.
>>
>> The DatePicker API is intended to be minimal at first, while still providing
>> lots of flexibility. We can expand it with various conveniences in the
>> future after getting it properly road tested. If in the future we get a
>> FormattedTextField that extends TextField, then we can retrofit it into
>> DatePicker without losing API compatibility.
>>
>> The popup can be styled with CSS and the individual grid cells can be fully
>> customized by use of a cell factory.
>>
>> The application can add validation and error handling for text input by
>> providing a StringConverter. This could for example wrap the default
>> converter and catch parse exceptions.
>>
>> For reference, here are some links to the java.time Javadoc pages:
>>
>> http://download.java.net/jdk8/docs/api/java/time/LocalDate.html
>> http://download.java.net/jdk8/docs/api/java/time/chrono/Chronology.html
>>
>> Below is a brief overview of the proposed DatePicker and DateCell
>> classes. You can find the full Javadoc in the JIRA issue:
>>
>> https://javafx-jira.kenai.com/browse/RT-27481
>>
>> ---
>>
>> package javafx.scene.control;
>>
>> public class DatePicker extends ComboBoxBase<LocalDate> {
>> public DatePicker();
>> public DatePicker(LocalDate localDate);
>> public ObjectProperty<Callback<DatePicker, DateCell>> dayCellFactoryProperty();
>> public ObjectProperty<Chronology> chronologyProperty();
>> public BooleanProperty showWeekNumbersProperty();
>> public ObjectProperty<StringConverter<LocalDate>> converterProperty();
>> public ReadOnlyObjectProperty<TextField> editorProperty();
>> }
>>
>> ---
>>
>> package javafx.scene.control;
>>
>> public class DateCell extends Cell<LocalDate> {
>> @Override public void updateItem(LocalDate item, boolean empty);
>> @Override protected Skin<?> createDefaultSkin();
>> }
>>
>> ---
>>
>> A code review for the implementation will follow.
>>
>> Thanks,
>> Leif
>>
More information about the threeten-dev
mailing list