[REVIEW] Restricting the ComboBox selection model to single selection

Tom Eugelink tbee at tbee.org
Sun Feb 5 00:14:17 PST 2012


Not sure if you two are talking about the same thing. As I understand Jonathan's proposal, he wants to restrict combobox to singleselection, so it never will be possible to have a multiselection combobox. Jeff, OTOH, assumes the option of a multiselect combobox remains.

Tom


On 2012-02-05 05:12, Jeff McDonald wrote:
> +1
>
> I support the proposal.
>
> The selection behavior should be different between a single selection and a
> multiple selection ComboBox. With a single selection ComboBox the popup
> should disappear once an item is selected. A multi-selection ComboBox
> should allow multiple selections before disappearing. Being able to skin a
> single-selection ComboBox differently than a multi-selection ComboBox would
> be a benefit as well. See Multi-choice
> ComboBox<http://www.codeproject.com/Articles/42133/Multiple-Selection-ComboBox-for-Silverlight>
> which
> is a Silverlight multi-selection component.
>
> Cheers,
> Jeff
>
> On 03/02/2012 7:18 PM, Jonathan Giles wrote:
>> Hi all,
>>
>> http://javafx-jira.kenai.com/browse/RT-19367
>>
>> I'm asking for approval to change the API of the ComboBox
>> selectionModel property, from the more general SelectionModel class,
>> to the more specific SingleSelectionModel class. This enforces the
>> fact that the ComboBox, for now and evermore, will only support single
>> selection (much like the ChoiceBox control). Should multiple selection
>> ever be needed, a separate 'ListBox' control can be developed to more
>> aptly serve these needs.
>>
>> The desire to make this change is, however, more due to the fact that
>> the current API does no one any favours. It misleads developers to
>> think that by installing a MultipleSelectionModel into the property,
>> they may be afforded some multiple selection functionality, which is
>> not true. This change makes it impossible for them to think this, as
>> compilation will fail in this case. I would argue that this is a bug
>> in the API, and one that should be fixed prior to being set in stone.
>> Not fixing this bug prior to shipping the ComboBox control will lead
>> to confusion and / or bug reports from developers expecting
>> functionality.
>>
>> The proposed patch is attached to the Jira issue. The changes are
>> minimal and, I would argue, as risk free as one can hope. It has no
>> impact on unit tests as there were no multiple selection tests
>> written, and I hope the same can be said for the automated tests.
>>
>> Thanks,
>> Jonathan




More information about the openjfx-dev mailing list