changeset 9273:e667f5baecfd

8136838: [ComboBox, DatePicker] Value doesn't update when focus is lost Reviewed-by: jgiles
author leifs
date Thu, 01 Oct 2015 19:57:42 -0700
parents 8607f6d3c627
children 3db9e3cf618b
files modules/controls/src/main/java/javafx/scene/control/skin/ComboBoxPopupControl.java modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/caspian/caspian.css modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css
diffstat 3 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/javafx/scene/control/skin/ComboBoxPopupControl.java	Thu Oct 01 17:07:41 2015 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/skin/ComboBoxPopupControl.java	Thu Oct 01 19:57:42 2015 -0700
@@ -34,7 +34,6 @@
 import com.sun.javafx.scene.traversal.TraversalContext;
 import javafx.beans.InvalidationListener;
 import javafx.beans.value.ObservableValue;
-import javafx.css.PseudoClass;
 import javafx.css.Styleable;
 import javafx.event.EventHandler;
 import javafx.geometry.Bounds;
@@ -137,6 +136,11 @@
             if (getEditor() != null) {
                 // Fix for the regression noted in a comment in RT-29885.
                 ((FakeFocusTextField)textField).setFakeFocus(hasFocus);
+
+                // JDK-8120120 (aka RT-21454) and JDK-8136838
+                if (!hasFocus) {
+                    setTextFromTextFieldIntoComboBoxValue();
+                }
             }
         });
 
@@ -581,6 +585,4 @@
      *                                                                         *
      **************************************************************************/
 
-    private static PseudoClass CONTAINS_FOCUS_PSEUDOCLASS_STATE = PseudoClass.getPseudoClass("contains-focus");
-
 }
--- a/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/caspian/caspian.css	Thu Oct 01 17:07:41 2015 -0700
+++ b/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/caspian/caspian.css	Thu Oct 01 19:57:42 2015 -0700
@@ -3186,8 +3186,8 @@
     -fx-background-insets: 0 0 -1 0, 0, 1 0 1 1;
 }
 
-.combo-box-base:editable:contains-focus,
-.date-picker:contains-focus {
+.combo-box-base:editable:focused,
+.date-picker:focused {
     -fx-background-color: -fx-focus-color, -fx-outer-border, -fx-control-inner-background;
     -fx-background-radius: 5.4, 3, 2;
     -fx-background-insets: -1.4, 0, 1;
--- a/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css	Thu Oct 01 17:07:41 2015 -0700
+++ b/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css	Thu Oct 01 19:57:42 2015 -0700
@@ -1767,8 +1767,8 @@
     -fx-background-insets: 1 0 1 1;
     -fx-background-radius: 2 0 0 2;
 }
-.combo-box-base:editable:contains-focus,
-.date-picker:contains-focus {
+.combo-box-base:editable:focused,
+.date-picker:focused {
     -fx-background-color: -fx-focus-color;
     -fx-background-insets: -0.2;
     -fx-background-radius: 3;
@@ -1784,8 +1784,8 @@
     -fx-background-insets: 1 0 1 1, 1 0 1 1, 3 2 3 3;
     -fx-background-radius: 2 0 0 2, 1 0 0 1, 0;
 }
-.combo-box-base:editable:contains-focus > .arrow-button,
-.date-picker:contains-focus > .arrow-button {
+.combo-box-base:editable:focused > .arrow-button,
+.date-picker:focused > .arrow-button {
     -fx-background-color: -fx-inner-border, -fx-body-color, -fx-faint-focus-color, -fx-body-color;
     -fx-background-insets: 1, 2, 1, 2.6;
     -fx-background-radius: 0 2 2 0, 0 1 1 0, 0 1 1 0, 0 1 1 0;