0

I'm making a JavaFX program for which I would like to use the new Time API. I wanted to use the LocalDatePicker provided in the JFXtras library which would allow users to select multiple localdate objects and would streamline the program's handling of selected objects (as opposed to the similar CalendarPicker in the same library which uses the older date API).

I imported the custom JFXtras controls into JavaFX scene builder, and while the "multiple" selection mode works very well for the JFXtras CalendarPicker control, the same functionality seems broken in the LocalDatePicker control.

Multiple/Range selection does not work in either the preview feature of scene builder, in a compiled FXML/controller file generated in Netbeans, and when simply added to a JavaFX scene, while in all those cases the CalendarPicker control does work. which leads me to believe it is a problem with the control itself and not my implementation. I checked the respective classes in the library and the code handling modeProperty seems identical.

Thing is, the sample program including all controls on the JFXtras page (http://jfxtras.org/resources/java/jfxtras-labs-samples-8.0-r4-SNAPSHOT-shadow.jar) has a multiple selection working for the LocalDatePicker control.

What am I doing wrong?

Sorry if it's an easy fix, I'm pretty new to Java (and JavaFX)

Thanks

Rayman
  • 3
  • 2
  • LocalDatePicker uses CalendarPicker internally; the LocalDatePicker control has an API that exposes the same properties as CalendarPicker, only using Java 8 time types. The LocalDatePicker skin creates a CalendarPicker and uses mapping/glue code to convert from Calendar to LocalDate and back. If you compare the test classes that guarantee that the controls keep working as they should (https://github.com/JFXtras/jfxtras/blob/8.0/jfxtras-controls/src/test/java/jfxtras/scene/control/test/) you'll find that they run virtually the identical scenario's, including multiple and range mode. – tbeernot Jan 25 '15 at 17:58
  • Bottom line is that I'm highly in doubt if the control is the cause of the problem, knowing that SceneBuilder has loads of custom code to handle controls. But I'll take a peek and see if I can find something wrong. – tbeernot Jan 25 '15 at 17:59
  • If I create a new scene builder 2.0 file -> import "jfxtras-common-8.0-r3.jar"-> add pane -> add LocalDatePicker: Same problem. Is it the right import? – Rayman Jan 25 '15 at 19:31
  • I see the problem as well, question is what is causing it. – tbeernot Jan 25 '15 at 20:56

1 Answers1

0

Oh yes. This was my fault. Even though there was code to sync the mode value between LocalDatePicker and CalendarPicker, I forgot to set the initial value. In the tests the value is set after the control is visible and then the sync code kicks in. Please try 8.0-r4-SNAPSHOT. Thanks for reporting.

tbeernot
  • 2,473
  • 4
  • 24
  • 31