RFR: 8209788: Left/Right/Ctrl+A keys not working in editor of ComboBox if popup showing [v8]
Ambarish Rapte
arapte at openjdk.java.net
Sat Aug 29 09:13:56 UTC 2020
On Fri, 28 Aug 2020 17:30:11 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> Ambarish Rapte has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix for non editable ComboBox
>
> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/behavior/ListViewBehavior.java line 143:
>
>> 142:
>> 143: if (Boolean.FALSE.equals(control.getProperties().containsKey("excludeKeyMappingsForComboBoxEditor"))) {
>> 144: // This is not ComboBox's ListView
>
> Unless I'm missing something, you don't need to compare with a `Boolean` at all since containsKey returns a `boolean`
> primitive type, so I think this can be simplified to:
> if (!control.getProperties().containsKey("excludeKeyMappingsForComboBoxEditor")) {
>
> If instead you do want to check the value of the property, and not just its existence, you would need the following,
> and it would be important to check `!TRUE.equals` rather than `FALSE.equals` so that an unset property would be treated
> as `false`. if (!Boolean.TRUE.equals(control.getProperties().get("excludeKeyMappingsForComboBoxEditor"))) {
Changed to use
`if (!control.getProperties().containsKey("excludeKeyMappingsForComboBoxEditor")) {`
> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/behavior/ListViewBehavior.java line 359:
>
>> 358: Boolean isComboBoxEditable = (Boolean)getNode().getProperties().get("editableComboBoxEditor");
>> 359: if (isComboBoxEditable != null) {
>> 360: // This is ComboBox's ListView
>
> Maybe simplify this as follows, to match the earlier logic?
>
> if (Boolean.FALSE.equals(getNode().getProperties().get("editableComboBoxEditor"))) {
With this change, we need to check both FALSE and TRUE.
For a Non ComboBox ListView `getNode().getProperties().get("editableComboBoxEditor")` would be `null`.
if (Boolean.FALSE.equals(getNode().getProperties().get("editableComboBoxEditor"))) { add KeyMappings }
else if (Boolean.TRUE.equals(getNode().getProperties().get("editableComboBoxEditor"))) { remove KeyMappings }
else { ListView is not contained by ComboBox }
-------------
PR: https://git.openjdk.java.net/jfx/pull/172
More information about the openjfx-dev
mailing list