changeset 1642:b46fbd1f74f9 2.2.25-b04

RT-28467: ComboBox focus switching blocks all user interaction (backport from JavaFX 8.0, where it was fixed as RT-26185)
author jgiles
date Fri, 01 Mar 2013 13:36:53 +1300
parents fa463c60d951
children 61c25ccb8167
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java
diffstat 1 files changed, 5 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Fri Feb 08 09:19:31 2013 +1300
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Fri Mar 01 13:36:53 2013 +1300
@@ -124,8 +124,10 @@
         
         // move focus in to the textfield if the comboBox is editable
         comboBox.focusedProperty().addListener(new ChangeListener<Boolean>() {
-            @Override public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
-                updateFakeFocus(comboBox.isFocused());
+            @Override public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean hasFocus) {
+                if (comboBox.isEditable()) {
+                    updateFakeFocus(hasFocus);
+                }
             }
         });
         
@@ -157,8 +159,6 @@
                         return;
                     }
                 }
-                
-                textField.fireEvent(t);
             }
         });
         
@@ -345,20 +345,7 @@
         // is lost from the ComboBox
         textField.focusedProperty().addListener(new ChangeListener<Boolean>() {
             @Override public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean hasFocus) {
-                if (hasFocus) {
-                    // Using Platform.runLater here, as without it it seems we
-                    // enter into some form of race condition where we are 
-                    // wanting to set focus on the comboBox whilst the textField
-                    // is still notifying of its focus gain.
-                    // This issue was identified in RT-21088.
-                    Platform.runLater(new Runnable() {
-                        @Override public void run() {
-                            comboBox.requestFocus();
-                        }
-                    });
-                }
-                
-                updateFakeFocus(hasFocus);
+                if (! comboBox.isEditable()) return;
                 
                 // RT-21454 starts here
                 if (! hasFocus) {