changeset 4864:cb91a18c5738

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/8.0/scrum/controls/jfx/rt
author jgiles
date Tue, 03 Sep 2013 17:08:25 +1200
parents 3f656fbd508f 74c06be0319b
children e7d52acb03ee 673a1107114b
files
diffstat 2 files changed, 40 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Mon Sep 02 13:44:19 2013 +0100
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Tue Sep 03 17:08:25 2013 +1200
@@ -50,9 +50,7 @@
 import javafx.scene.control.SelectionMode;
 import javafx.scene.control.SelectionModel;
 import javafx.scene.control.TextField;
-import javafx.scene.input.KeyCode;
-import javafx.scene.input.KeyEvent;
-import javafx.scene.input.MouseEvent;
+import javafx.scene.input.*;
 import javafx.util.Callback;
 import javafx.util.StringConverter;
 
@@ -191,6 +189,25 @@
                 }
             }
         });
+
+        // Fix for RT-31093 - drag events from the textfield were not surfacing
+        // properly for the ComboBox.
+        if (textField != null) {
+            textField.addEventFilter(MouseEvent.DRAG_DETECTED, new EventHandler<MouseEvent>() {
+                @Override public void handle(MouseEvent event) {
+                    if (event.getTarget().equals(comboBox)) return;
+                    comboBox.fireEvent(event.copyFor(comboBox, comboBox));
+                    event.consume();
+                }
+            });
+            textField.addEventFilter(DragEvent.ANY, new EventHandler<DragEvent>() {
+                @Override public void handle(DragEvent event) {
+                    if (event.getTarget().equals(comboBox)) return;
+                        comboBox.fireEvent(event.copyFor(comboBox, comboBox));
+                        event.consume();
+                }
+            });
+        }
         
         // Fix for RT-19431 (also tested via ComboBoxListViewSkinTest)
         updateValue();
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/DatePickerSkin.java	Mon Sep 02 13:44:19 2013 +0100
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/DatePickerSkin.java	Tue Sep 03 17:08:25 2013 +1200
@@ -41,6 +41,7 @@
 import javafx.scene.Node;
 import javafx.scene.control.DatePicker;
 import javafx.scene.control.TextField;
+import javafx.scene.input.DragEvent;
 import javafx.scene.input.KeyCode;
 import javafx.scene.input.KeyEvent;
 import javafx.scene.input.MouseEvent;
@@ -130,6 +131,25 @@
             }
         });
 
+        // Fix for RT-31093 - drag events from the textfield were not surfacing
+        // properly for the DatePicker.
+        if (textField != null) {
+            textField.addEventFilter(MouseEvent.DRAG_DETECTED, new EventHandler<MouseEvent>() {
+                @Override public void handle(MouseEvent event) {
+                    if (event.getTarget().equals(datePicker)) return;
+                    datePicker.fireEvent(event.copyFor(datePicker, datePicker));
+                    event.consume();
+                }
+            });
+            textField.addEventFilter(DragEvent.ANY, new EventHandler<DragEvent>() {
+                @Override public void handle(DragEvent event) {
+                    if (event.getTarget().equals(datePicker)) return;
+                    datePicker.fireEvent(event.copyFor(datePicker, datePicker));
+                    event.consume();
+                }
+            });
+        }
+
         registerChangeListener(datePicker.chronologyProperty(), "CHRONOLOGY");
         registerChangeListener(datePicker.converterProperty(), "CONVERTER");
         registerChangeListener(datePicker.dayCellFactoryProperty(), "DAY_CELL_FACTORY");