JDK-8091666 : [Spinner] Review LocalDate and LocalTime spinner value factories
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 8u40
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2014-07-17
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Blocks :  
Blocks :  
Relates :  
Relates :  
Description
Because the Spinner shows a simple TextField, it is not possible for a user to specify which element of a date or time they want to increment. This means that the increment / decrement functionality can only step by the ChronoUnit passed in by the developer, and this leads to negative user experiences. Ideally we would allow for users to click inside the textfield and specify which element they want to increment (hour, minute, or second), or (day, month, year).

One option is to remove these two spinner value factories until such time that we can support this use case. This is probably the direction I am leaning...
Comments
There is no scope for improving this for JavaFX 8u40, so I'm retargeting to 9.
10-10-2014

Changeset to package-scope the LocalDate and LocalTime API: http://hg.openjdk.java.net/openjfx/8u-dev/rt/rev/8296c327320b I'll leave this Jira issue open until we tackle the questions Steve poses. In short, at present there is no notion of changing the increment unit in the SpinnerValueFactories for LocalDate and LocalTime, and in fact there is no way for these two value factories at present to observe changes to the TextField caret position, as there is no relationship from a SpinnerValueFactory to a Spinner. To support this we would need to create this link (which isn't necessarily bad), so that we could then observe the caret position.
30-07-2014

Is it not possible to change the increment / decrement at run time based on where the user clicks? (NOTE: I am not asking you to write this code at this time. I'm just wondering whether we have an API hole). Alternately, just before anything is incremented or decremented, could the location of the caret be queried and the increment changed accordingly (again, not asking for you to write the code, just looking for API holes).
29-07-2014

+1 to remove the public's but you can't close this bug yet. We may remove the classes entirely.
29-07-2014

The proposed patch - removing 'public' from the relevant places.
29-07-2014

+1 from me. Steve?
28-07-2014

Presently the API for the LocalDate and LocalTime spinner value factories takes a ChronoUnit to specify which unit should be incremented / decremented with the arrows. I don't think this API is necessarily accurate - it should still be settable, but should also be able to be changed based on the user clicking in the TextField. I am fine with removing the public modifier from the two spinner value factory implementations, and also their corresponding constructors in the Spinner class. Just give the +1 and I'll get to it.
28-07-2014

Depending on where the user clicks, can we not fix this by changing the increment value dynamically? Perhaps Martin would like to look at this as part of the formatted text work? In the meantime, rather than deleting the code, could we remove the public modifier from the code and leave this JIRA open until we either implement the functionality or remove the classes?
28-07-2014