changeset 4842:bf88b13087fd

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/8.0/scrum/controls/jfx/rt
author jgiles
date Thu, 29 Aug 2013 09:34:24 +1200
parents 7f98f57fecd2 3db94ad212b6
children 2fd809b11dfd 1d4565315819
files
diffstat 3 files changed, 26 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Wed Aug 28 07:36:05 2013 -0400
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Thu Aug 29 09:34:24 2013 +1200
@@ -137,23 +137,10 @@
         
         updateButtonCell();
         
-        // 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 hasFocus) {
-                if (comboBox.isEditable() && hasFocus) {
-                    Platform.runLater(new Runnable() {
-                        @Override public void run() {
-                            textField.requestFocus();
-                        }
-                    });
-                }
-            }
-        });
-        
         comboBox.addEventFilter(KeyEvent.ANY, new EventHandler<KeyEvent>() {
             @Override public void handle(KeyEvent ke) {
                 if (textField == null) return;
-                
+
                 // When the user hits the enter or F4 keys, we respond before 
                 // ever giving the event to the TextField.
                 if (ke.getCode() == KeyCode.ENTER) {
@@ -368,11 +355,15 @@
         // Fix for RT-21406: ComboBox do not show initial text value
         initialTextFieldValue = textField.getText();
         // End of fix (see updateDisplayNode below for the related code)
-        
+
         textField.focusedProperty().addListener(new ChangeListener<Boolean>() {
             @Override public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean hasFocus) {
                 if (! comboBox.isEditable()) return;
-                
+
+                // Fix for RT-29885
+                comboBox.getProperties().put("FOCUSED", hasFocus);
+                // --- end of RT-29885
+
                 // RT-21454 starts here
                 if (! hasFocus) {
                     setTextFromTextFieldIntoComboBoxValue();
@@ -380,6 +371,7 @@
                 } else {
                     pseudoClassStateChanged(CONTAINS_FOCUS_PSEUDOCLASS_STATE, true);
                 }
+                // --- end of RT-21454
             }
         });
 
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/DatePickerSkin.java	Wed Aug 28 07:36:05 2013 -0400
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/DatePickerSkin.java	Thu Aug 29 09:34:24 2013 +1200
@@ -77,19 +77,6 @@
             });
         }
 
-        // move focus in to the textfield if the comboBox is editable
-        datePicker.focusedProperty().addListener(new ChangeListener<Boolean>() {
-            @Override public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean hasFocus) {
-                if (datePicker.isEditable() && hasFocus) {
-                    Platform.runLater(new Runnable() {
-                        @Override public void run() {
-                            textField.requestFocus();
-                        }
-                    });
-                }
-            }
-        });
-
         datePicker.addEventFilter(KeyEvent.ANY, new EventHandler<KeyEvent>() {
             @Override public void handle(KeyEvent ke) {
                 if (textField == null) return;
@@ -243,6 +230,10 @@
             @Override public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean hasFocus) {
                 if (!datePicker.isEditable()) return;
 
+                // Fix for RT-29885
+                datePicker.getProperties().put("FOCUSED", hasFocus);
+                // --- end of RT-29885
+
                 // RT-21454 starts here
                 if (! hasFocus) {
                     setTextFromTextFieldIntoComboBoxValue();
--- a/modules/controls/src/main/java/javafx/scene/control/ComboBoxBase.java	Wed Aug 28 07:36:05 2013 -0400
+++ b/modules/controls/src/main/java/javafx/scene/control/ComboBoxBase.java	Thu Aug 29 09:34:24 2013 +1200
@@ -25,6 +25,7 @@
 
 package javafx.scene.control;
 
+import javafx.collections.MapChangeListener;
 import javafx.css.PseudoClass;
 import javafx.beans.property.*;
 import javafx.event.ActionEvent;
@@ -116,6 +117,19 @@
      */
     public ComboBoxBase() {
         getStyleClass().add(DEFAULT_STYLE_CLASS);
+
+        // Fix for RT-29885
+        getProperties().addListener(new MapChangeListener<Object, Object>() {
+            @Override public void onChanged(Change<?,?> change) {
+                if (change.wasAdded()) {
+                    if (change.getKey() == "FOCUSED") {
+                        setFocused((Boolean)change.getValueAdded());
+                        getProperties().remove("FOCUSED");
+                    }
+                }
+            }
+        });
+        // End of fix for RT-29885
     }
     
     void valueInvalidated() {