changeset 7750:124e9a2ae6d9

RT-37490: [Accessibility] SHOW_MENU action should be handled in Node
author Felipe Heidrich <felipe.heidrich@oracle.com>
date Fri, 15 Aug 2014 09:47:54 -0700
parents a63ebe7c34f2
children 5e4e957c51a6
files modules/controls/src/main/java/javafx/scene/control/Control.java modules/graphics/src/main/java/javafx/scene/Node.java
diffstat 2 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/javafx/scene/control/Control.java	Fri Aug 15 12:21:47 2014 -0400
+++ b/modules/controls/src/main/java/javafx/scene/control/Control.java	Fri Aug 15 09:47:54 2014 -0700
@@ -940,15 +940,6 @@
 
     @Override
     public void executeAccessibleAction(AccessibleAction action, Object... parameters) {
-        switch (action) {
-            case SHOW_MENU:
-                ContextMenu menu = getContextMenu();
-                if (menu != null) {
-                    menu.show(this, Side.RIGHT, 0, 0);
-                }
-                break;
-            default:
-        }
         if (skinBase != null) {
             skinBase.executeAccessibleAction(action, parameters);
         }
--- a/modules/graphics/src/main/java/javafx/scene/Node.java	Fri Aug 15 12:21:47 2014 -0400
+++ b/modules/graphics/src/main/java/javafx/scene/Node.java	Fri Aug 15 09:47:54 2014 -0700
@@ -88,6 +88,7 @@
 import javafx.scene.input.KeyEvent;
 import javafx.scene.input.MouseDragEvent;
 import javafx.scene.input.MouseEvent;
+import javafx.scene.input.PickResult;
 import javafx.scene.input.RotateEvent;
 import javafx.scene.input.ScrollEvent;
 import javafx.scene.input.SwipeEvent;
@@ -9338,6 +9339,16 @@
                     requestFocus();
                 }
                 break;
+            case SHOW_MENU: {
+                Bounds b = getBoundsInLocal();
+                Point2D pt = localToScreen(b.getMaxX(), b.getMaxY());
+                ContextMenuEvent event =
+                    new ContextMenuEvent(ContextMenuEvent.CONTEXT_MENU_REQUESTED,
+                    b.getMaxX(), b.getMaxY(), pt.getX(), pt.getY(),
+                    false, new PickResult(this, b.getMaxX(), b.getMaxY()));
+                Event.fireEvent(this, event);
+                break;
+            }
             default:
         }
     }