[REVIEW] Restricting the ComboBox selection model to single selection
Jeff McDonald
deep.blue.6802 at gmail.com
Sat Feb 4 20:12:05 PST 2012
+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