[REVIEW REQUEST] Committing ComboBox text input to the value property on focus loss

Jonathan Giles jonathan.giles at oracle.com
Wed May 23 16:07:26 PDT 2012


Daniel,

Currently this is done by differentiating between null (invalid) and the 
empty string (valid).

-- Jonathan


On 24/05/2012 11:01 a.m., Daniel Zwolenski wrote:
> For validation is there some way to differentiate between 'null (not 
> set)' and 'null (invalid)'?
>
> On Thu, May 24, 2012 at 8:59 AM, Richard Bair <richard.bair at oracle.com 
> <mailto:richard.bair at oracle.com>> wrote:
>
>     Seems reasonable to me.
>
>     On May 23, 2012, at 3:56 PM, Jonathan Giles wrote:
>
>     > In both cases, assuming invalid input is put into
>     StringConverter.fromString(String), and we signal this by
>     returning null, the value property is not changed, and the text
>     typed into the ComboBox remains as it was - with the invalid input
>     still in place.
>     >
>     > Ideally in a future release when we have validation support this
>     would be the point where the ComboBox would indicate an invalid
>     input has been received (most probably due to a typo or a user
>     trying their luck with invalid input).
>     >
>     > -- Jonathan
>     >
>     >
>     > On 24/05/2012 10:51 a.m., Richard Bair wrote:
>     >> OK, so:
>     >>
>     >> User types invalid input, hits enter. What happens?
>     >> User types invalid input, tabs out. What happens?
>     >>
>     >> Cheers
>     >> Richard
>     >>
>     >> On May 23, 2012, at 2:54 PM, Jonathan Giles wrote:
>     >>
>     >>> Hi all,
>     >>>
>     >>> The jira issue for the runtime bug is here:
>     http://javafx-jira.kenai.com/browse/RT-21454
>     >>> The jira issue for Scene Builder is here:
>     http://javafx-jira.kenai.com/browse/DTL-4415
>     >>>
>     >>> I'm hoping to make a slight behavioural change to ComboBox in
>     2.2 so that it acts in a more useful manner. Currently, in an
>     editable ComboBox, the value property is only set when the user
>     presses Enter. What RT-21454 asks for is that the value property
>     also be updated when focus is lost.
>     >>>
>     >>> If we don't make this change, the form developer has to
>     consider either forcing an event to commit the value, or getting
>     the ComboBox editor (which is new API in 2.2), and retrieve the
>     text out of there. Of course, this will burn every developer until
>     they test their form and realise the value property is not set.
>     >>>
>     >>> Therefore, I would like to make a small change to ComboBox
>     such that whatever the user has typed when focus is lost becomes
>     the new ComboBox value (assuming it is legal input to the
>     StringConverter). There is a patch attached to the runtime jira
>     above which makes this change, but does not change any API: this
>     is purely a behavioural change to make ComboBox more useful.
>     >>>
>     >>> Thanks,
>     >>> Jonathan
>
>


More information about the openjfx-dev mailing list