changeset 1618:5df591c88735 2.2.40-b24

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/2u/MASTER/jfx/rt
author kcr
date Tue, 07 May 2013 13:14:48 -0700
parents b5ad50aba793 54fa88fc97bb
children 4ea478033ced
files javafx-ui-controls/src/com/sun/javafx/scene/control/FocusableTextField.java
diffstat 3 files changed, 8 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/FocusableTextField.java	Wed May 01 15:42:18 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.javafx.scene.control;
-
-import com.sun.javafx.event.EventDispatchChainImpl;
-import javafx.event.EventDispatchChain;
-import javafx.scene.control.TextField;
-
-/**
- * Used by ComboBox - makes it possible to call setFocused from external classes.
- */
-public final class FocusableTextField extends TextField {
-    
-    public void setFakeFocus(boolean focus) {
-        setFocused(focus);
-    }
-
-    @Override
-    public EventDispatchChain buildEventDispatchChain(EventDispatchChain tail) {
-        EventDispatchChain chain = new EventDispatchChainImpl();
-        chain.append(getEventDispatcher());
-        return chain;
-    }
-}
\ No newline at end of file
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Wed May 01 15:42:18 2013 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Tue May 07 13:14:48 2013 -0700
@@ -26,7 +26,6 @@
 package com.sun.javafx.scene.control.skin;
 
 import com.sun.javafx.event.EventDispatchChainImpl;
-import com.sun.javafx.scene.control.FocusableTextField;
 import com.sun.javafx.scene.control.WeakListChangeListener;
 import javafx.scene.control.ComboBox;
 import com.sun.javafx.scene.control.behavior.ComboBoxListViewBehavior;
@@ -125,8 +124,12 @@
         // 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()) {
-                    updateFakeFocus(hasFocus);
+                if (comboBox.isEditable() && hasFocus) {
+                    Platform.runLater(new Runnable() {
+                        @Override public void run() {
+                            textField.requestFocus();
+                        }
+                    });
                 }
             }
         });
@@ -357,12 +360,6 @@
         return textField;
     }
     
-    private void updateFakeFocus(boolean b) {
-        if (textField == null) return;
-        if (! (textField instanceof FocusableTextField)) return;
-        ((FocusableTextField)textField).setFakeFocus(b);
-    }
-    
     private void updateDisplayNode() {
         StringConverter<T> c = comboBox.getConverter();
         if (c == null) return;
--- a/javafx-ui-controls/src/javafx/scene/control/ComboBox.java	Wed May 01 15:42:18 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/ComboBox.java	Tue May 07 13:14:48 2013 -0700
@@ -26,7 +26,6 @@
 package javafx.scene.control;
 
 import com.sun.javafx.event.EventDispatchChainImpl;
-import com.sun.javafx.scene.control.FocusableTextField;
 import com.sun.javafx.scene.control.WeakListChangeListener;
 import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin;
 import javafx.beans.InvalidationListener;
@@ -355,7 +354,7 @@
     
     
     // --- Editor
-    private FocusableTextField textField;
+    private TextField textField;
     /**
      * The editor for the ComboBox. The editor is null if the ComboBox is not
      * {@link #editableProperty() editable}.
@@ -368,7 +367,7 @@
     public final ReadOnlyObjectProperty<TextField> editorProperty() { 
         if (editor == null) {
             editor = new ReadOnlyObjectWrapper<TextField>(this, "editor");
-            textField = new FocusableTextField();
+            textField = new TextField();
             editor.set(textField);
         }
         return editor.getReadOnlyProperty();