[REVIEW REQUEST] Add text property to ComboBox

Richard Bair richard.bair at oracle.com
Wed Apr 25 15:09:31 PDT 2012


Ya, this one is a real hard one. Previously my gut feel was that we didn't want to expose the editor, but I've done a 180 on it. I think the implementation will actually be cleaner, but also it keeps us from having inconsistency between TextInputControl and ComboBox. If we had mixins in Java (like in JavaFX-Script) we would have done TextInputControl (and Labeled!) as mixins and then we wouldn't have this issue as ComboBox could implement that mixin directly. But as it is, I think having getEditor() would be the best. Note that a developer can customize the skin of an editor of a ComboBox via CSS, so you can totally customize what the skin is like. The ComboBox skin doesn't really care -- as long as it can be resized and changes in text are observed and mutable it is good to go.

Richard

On Apr 23, 2012, at 12:54 PM, Jonathan Giles wrote:

> After all the discussion on adding text / textfield / textInputControl properties to ComboBox, there is still no clear winner. My gut feeling is to not expose TextField / TextInputControl directly to the user. However, my main driver for getting this done is for the Scene Builder team, who want access to the entire TextInputControl (and realistically, the TextField itself).
> 
> Ideally, I could postpone this past JavaFX 2.2 so there was more time for consideration, but realistically I think we're at a point where we just need to make a decision and move on.
> 
> Therefore, ignoring my gut feeling and being pragmatic about this request, I will give 24 hours notice that my intention is to expose the TextField itself in the ComboBox control. If there are any strong objections, please let them be known (even if you've registered an objection already). If I don't hear any strong objections, I will assume an implicit approval has been given.
> 
> -- Jonathan
> 
> 
> On 18/04/2012 9:32 p.m., Werner Lehmann wrote:
>> Fully agree with this. The common usecase by far are strings, and ColorComboboxes etc. could still extend ComboBoxBase.
>> 
>> In my opinion it should not be necessary to lookup control internals - might be ok as a temporary workaround but not in the long run. This lookup will also break encapsulation but in a more contrived way.
>> 
>> As to exposing TextField or TextInputControl: the latter would make sense only if TextArea was also an option, right? That would probably require a different skin. Correct me if I am wrong but that also sounds like requiring another control using such a TextArea based skin. If that is true than nothing is lost by exposing TextField on ComboBox. Also, I have never seen a multiline text combobox - can't be very common.
>> 
>> Rgds
>> Werner
>> 
>> On 18.04.2012 02:30, Jonathan Giles wrote:
>>> What are peoples thoughts? Can we wrap this one up by simply exposing
>>> the TextField/TextInputControl, or are there concerns with this? Also,
>>> if we are to expose one, I'm tempted to expose TextField rather than
>>> TextInputControl...



More information about the openjfx-dev mailing list