changeset 1335:f026710b45cb 2.2-b14

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/2.2/MASTER/jfx//rt
author Yao Wang <yao.w.wang@oracle.com>
date Tue, 19 Jun 2012 10:12:35 -0700
parents bdbc42e5a633 0af7b6ab244f
children 00bc2ee17e47 605a2c2253e5
files javafx-ui-common/src/com/sun/javafx/stage/PopupEventRedirector.java javafx-ui-common/src/javafx/scene/Node.java
diffstat 30 files changed, 491 insertions(+), 526 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-common/src/com/sun/javafx/stage/PopupEventRedirector.java	Mon Jun 18 16:54:00 2012 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 2011, 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.stage;
-
-import javafx.event.Event;
-import javafx.event.EventTarget;
-import javafx.event.EventType;
-import javafx.scene.Node;
-import javafx.scene.Scene;
-import javafx.scene.input.KeyCombination;
-import javafx.scene.input.KeyEvent;
-import javafx.scene.input.MouseEvent;
-import javafx.stage.PopupWindow;
-
-import com.sun.javafx.event.DirectEvent;
-import com.sun.javafx.event.EventRedirector;
-import com.sun.javafx.event.EventUtil;
-
-/**
- * Defines reaction of a popup to redirected events from its parent stage or
- * popup.
- */
-public final class PopupEventRedirector extends EventRedirector {
-    private static final KeyCombination ESCAPE_KEY_COMBINATION =
-            KeyCombination.keyCombination("Esc");
-
-    private final PopupWindow popupWindow;
-
-    public PopupEventRedirector(final PopupWindow popupWindow) {
-        super(popupWindow);
-        this.popupWindow = popupWindow;
-    }
-    
-    @Override
-    protected void handleRedirectedEvent(final Object eventSource,
-                                         final Event event) {
-        if (event instanceof KeyEvent) {
-            handleKeyEvent((KeyEvent) event);
-            return;
-        }
-
-        final EventType<?> eventType = event.getEventType();
-
-        if (eventType == MouseEvent.MOUSE_PRESSED) {
-            handleMousePressedEvent(eventSource, event);
-            return;
-        }
-
-        if (eventType == FocusUngrabEvent.FOCUS_UNGRAB) {
-            handleFocusUngrabEvent();
-            return;
-        }
-    }
-
-    private void handleKeyEvent(final KeyEvent event) {
-        if (event.isConsumed()) {
-            return;
-        }
-
-        final Scene scene = popupWindow.getScene();
-        if (scene != null) {
-            final Node sceneFocusOwner = scene.getFocusOwner();
-            final EventTarget eventTarget =
-                    (sceneFocusOwner != null) ? sceneFocusOwner : scene;
-            if (EventUtil.fireEvent(eventTarget, new DirectEvent(event))
-                    == null) {
-                event.consume();
-                return;
-            }
-        }
-
-        if ((event.getEventType() == KeyEvent.KEY_PRESSED)
-                && ESCAPE_KEY_COMBINATION.match(event)) {
-            handleEscapeKeyPressedEvent(event);
-        }
-    }
-
-    private void handleEscapeKeyPressedEvent(final Event event) {
-        if (popupWindow.isHideOnEscape()) {
-            popupWindow.doAutoHide();
-
-            if (popupWindow.getConsumeAutoHidingEvents()) {
-                event.consume();
-            }
-        }
-    }
-
-    private void handleMousePressedEvent(final Object eventSource,
-                                         final Event event) {
-        // we handle mouse pressed only for the immediate parent window,
-        // where we can check whether the mouse press is inside of the owner
-        // control or not, we will force possible child popups to close
-        // by sending the FOCUS_UNGRAB event
-        if (popupWindow.getOwnerWindow() != eventSource) {
-            return;
-        }
-
-        if (popupWindow.isAutoHide() && !isOwnerNodeEvent(event)) {
-            // the mouse press is outside of the owner control,
-            // fire FOCUS_UNGRAB to child popups
-            Event.fireEvent(popupWindow, new FocusUngrabEvent());
-
-            popupWindow.doAutoHide();
-
-            if (popupWindow.getConsumeAutoHidingEvents()) {
-                event.consume();
-            }
-        }
-    }
-
-    private void handleFocusUngrabEvent() {
-        if (popupWindow.isAutoHide()) {
-            popupWindow.doAutoHide();
-        }
-    }
-
-    private boolean isOwnerNodeEvent(final Event event) {
-        final Node ownerNode = popupWindow.getOwnerNode();
-        if (ownerNode == null) {
-            return false;
-        }
-
-        final EventTarget eventTarget = event.getTarget();
-        if (!(eventTarget instanceof Node)) {
-            return false;
-        }
-
-        Node node = (Node) eventTarget;
-        do {
-            if (node == ownerNode) {
-                return true;
-            }
-            node = node.getParent();
-        } while (node != null);
-
-        return false;
-    }
-}
--- a/javafx-ui-common/src/com/sun/javafx/tk/TKClipboard.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/com/sun/javafx/tk/TKClipboard.java	Tue Jun 19 10:12:35 2012 -0700
@@ -72,4 +72,10 @@
 
     // for DnD
     public Set<TransferMode> getTransferModes();
+    
+    /**
+     * Set up the security context to ensure that the clipboard access context
+     * is properly initialized.
+     */
+    public void initSecurityContext();
 }
--- a/javafx-ui-common/src/javafx/scene/Camera.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/Camera.java	Tue Jun 19 10:12:35 2012 -0700
@@ -49,45 +49,21 @@
 
     abstract CameraImpl createPlatformCamera();
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    protected abstract void impl_update();
+    abstract void update();
     private BooleanProperty dirty = new SimpleBooleanProperty(this, "dirty");
 
-    private void setDirty(boolean value) {
-        dirty.set(value);
-    }
+    final ObservableBooleanValue dirtyProperty() { return dirty; }
 
-    ObservableBooleanValue dirtyProperty() { return dirty; }
-
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    protected boolean impl_isDirty() {
+    final boolean isDirty() {
         return dirty.get();
     }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    protected final void impl_markDirty() {
-        setDirty(true);
+    final void markDirty() {
+        dirty.set(true);
     }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    protected final void impl_clearDirty() {
-        setDirty(false);
+    final void clearDirty() {
+        dirty.set(false);
     }
 
     Camera copy() {
--- a/javafx-ui-common/src/javafx/scene/Cursor.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/Cursor.java	Tue Jun 19 10:12:35 2012 -0700
@@ -170,12 +170,7 @@
         this.name = name;
     }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public abstract CursorFrame impl_getCurrentFrame();
+    abstract CursorFrame getCurrentFrame();
 
     /**
      * Activates the cursor. Cursor should be activated to make sure
@@ -287,12 +282,8 @@
             singleFrame = new StandardCursorFrame(type);
         }
 
-        /**
-         * @treatAsPrivate implementation detail
-         * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-         */
         @Override
-        public CursorFrame impl_getCurrentFrame() {
+        CursorFrame getCurrentFrame() {
             return singleFrame;
         }
     }
--- a/javafx-ui-common/src/javafx/scene/Group.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/Group.java	Tue Jun 19 10:12:35 2012 -0700
@@ -157,7 +157,7 @@
 
     @Override protected void layoutChildren() {
         if (isAutoSizeChildren()) {
-            impl_resizeChildren(true);
+            super.layoutChildren();
         }
     }
 }
--- a/javafx-ui-common/src/javafx/scene/ImageCursor.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/ImageCursor.java	Tue Jun 19 10:12:35 2012 -0700
@@ -286,12 +286,7 @@
         return imageCursor;
     }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    @Override public CursorFrame impl_getCurrentFrame() {
+    @Override CursorFrame getCurrentFrame() {
         if (currentCursorFrame != null) {
             return currentCursorFrame;
         }
@@ -299,13 +294,13 @@
         final Image cursorImage = getImage();
 
         if (cursorImage == null) {
-            currentCursorFrame = Cursor.DEFAULT.impl_getCurrentFrame();
+            currentCursorFrame = Cursor.DEFAULT.getCurrentFrame();
             return currentCursorFrame;
         }
 
         final Object cursorPlatformImage = cursorImage.impl_getPlatformImage();
         if (cursorPlatformImage == null) {
-            currentCursorFrame = Cursor.DEFAULT.impl_getCurrentFrame();
+            currentCursorFrame = Cursor.DEFAULT.getCurrentFrame();
             return currentCursorFrame;
         }
 
--- a/javafx-ui-common/src/javafx/scene/Node.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/Node.java	Tue Jun 19 10:12:35 2012 -0700
@@ -354,7 +354,7 @@
                 s.addToDirtyList(this);
         }
 
-        impl_setDirty(dirtyBit);
+        dirtyBits |= dirtyBit.getMask();
     }
 
     /**
@@ -369,17 +369,6 @@
     }
 
     /**
-     * Set the specified dirty bit.
-     *
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    private void impl_setDirty(DirtyBits dirtyBit) {
-        dirtyBits |= dirtyBit.getMask();
-    }
-
-    /**
      * Clear the specified dirty bit
      *
      * @treatAsPrivate implementation detail
@@ -679,11 +668,8 @@
 
     /**
      * Exists for Parent
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    void impl_sceneChanged(Scene old) { }
+     */
+    void sceneChanged(Scene old) { }
 
     public final ReadOnlyObjectProperty<Scene> sceneProperty() {
         return scenePropertyImpl().getReadOnlyProperty();
@@ -697,14 +683,6 @@
                 @Override
                 protected void invalidated() {
                     Scene _scene = get();
-                    if (oldScene != _scene) {
-                        //Note: no need to remove from scene's dirty list
-                        //Scene's is checking if the node's scene is correct
-                        impl_reapplyCSS();
-                        if (_scene != null && !impl_isDirtyEmpty()) {
-                            _scene.addToDirtyList(Node.this);
-                        }
-                    }
                     if (getClip() != null) {
                         getClip().setScene(_scene);
                     }
@@ -719,7 +697,15 @@
                     }
                     focusSetDirty(oldScene);
                     focusSetDirty(_scene);
-                    impl_sceneChanged(oldScene);
+                    sceneChanged(oldScene);
+                    if (oldScene != _scene) {
+                        //Note: no need to remove from scene's dirty list
+                        //Scene's is checking if the node's scene is correct
+                        impl_reapplyCSS();
+                        if (_scene != null && !impl_isDirtyEmpty()) {
+                            _scene.addToDirtyList(Node.this);
+                        }
+                    }
                     oldScene = _scene;
                 }
 
@@ -1940,7 +1926,7 @@
      */
     public Dragboard startDragAndDrop(TransferMode... transferModes) {
         if (getScene() != null) {
-            return getScene().impl_startDragAndDrop(this, transferModes);
+            return getScene().startDragAndDrop(this, transferModes);
         }
         
         throw new IllegalStateException("Cannot start drag and drop on node "
@@ -1961,7 +1947,7 @@
      */
     public void startFullDrag() {
         if (getScene() != null) {
-            getScene().impl_startFullDrag(this);
+            getScene().startFullDrag(this);
             return;
         }
 
@@ -1981,7 +1967,7 @@
     private Node clipParent;
     // Use a getter function instead of giving clipParent package access,
     // so that clipParent doesn't get turned into a Location.
-    final Node impl_getClipParent() {
+    final Node getClipParent() {
         return clipParent;
     }
 
@@ -2031,7 +2017,7 @@
     public PGNode impl_getPGNode() {
         if (Utils.assertionEnabled()) {
             // Assertion checking code
-            if (!Scene.impl_isPGAccessAllowed()) {
+            if (!Scene.isPGAccessAllowed()) {
                 java.lang.System.err.println();
                 java.lang.System.err.println("*** unexpected PG access");
                 java.lang.Thread.dumpStack();
@@ -6329,16 +6315,6 @@
     }
 
     /**
-     * Some nodes require a special handling to request focus.
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public final void impl_requestFocusImpl(Runnable r) {
-        r.run();
-    }
-
-    /**
      * Traverses from this node in the direction indicated. Note that this
      * node need not actually have the focus, nor need it be focusTraversable.
      * However, the node must be part of a scene, otherwise this request
@@ -7196,11 +7172,8 @@
 
     /**
      * Needed for testing.
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    final CSSFlags impl_getCSSFlags() { return cssFlag; }
+     */
+    final CSSFlags getCSSFlags() { return cssFlag; }
 
     /**
      * Used to specify that the list of which pseudoclasses apply to this
--- a/javafx-ui-common/src/javafx/scene/ParallelCamera.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/ParallelCamera.java	Tue Jun 19 10:12:35 2012 -0700
@@ -49,12 +49,8 @@
         return Toolkit.getToolkit().createParallelCamera();
     }
 
+    @Override
+    void update() {
+    }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    @Override protected void impl_update() {
-    }
 }
--- a/javafx-ui-common/src/javafx/scene/Parent.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/Parent.java	Tue Jun 19 10:12:35 2012 -0700
@@ -317,7 +317,7 @@
                                     constructExceptionMessage(
                                         "child node is null", null));
                         }
-                        if (node.impl_getClipParent() != null) {
+                        if (node.getClipParent() != null) {
                             throw new IllegalArgumentException(
                                     constructExceptionMessage(
                                         "node already used as a clip", node));
@@ -608,7 +608,7 @@
         }
     }
 
-    @Override void impl_sceneChanged(Scene old) {
+    @Override void sceneChanged(Scene old) {
         computeDirtyScene(old);
     }
 
@@ -1041,15 +1041,6 @@
      * Subclasses should override this function to layout content as needed.
      */
     protected void layoutChildren() {
-        impl_resizeChildren(true);
-    }
-
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    protected final void impl_resizeChildren(boolean snapToPixel) {
         int size = children.size();
         for (int i = 0; i < size; ++i) {
             Node node = children.get(i);
@@ -1770,41 +1761,6 @@
         return false;
     }
 
-    /** 
-     * temporary to help debug scene graph
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public final void impl_printBranch() {
-        final int nodecount = printBranch("");
-        System.out.println("total node count="+nodecount);
-    }
-
-    private int printBranch(String indent) {
-        int nodecount = 0;
-
-        print(this,indent);
-        nodecount++;
-        for (Node child: getChildren()) {
-            if (child instanceof Parent) {
-                nodecount += ((Parent)child).printBranch(indent+"  ");
-            } else {
-                print(child,indent);
-                nodecount++;
-            }
-        }
-
-        return nodecount;
-    }
-
-    private void print(Node node, String indent) {
-        javafx.geometry.Bounds lb = node.getLayoutBounds();
-        System.out.println(indent+node.getClass().getName()+" "+getId()+
-                " layout="+(lb.getMinX()+node.getLayoutX())+","+(lb.getMinY()+node.getLayoutY())+" "+
-                lb.getWidth()+"x"+lb.getHeight()+" needsLayout="+isNeedsLayout());
-    }
-
     /**
      * @treatAsPrivate implementation detail
      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
--- a/javafx-ui-common/src/javafx/scene/PerspectiveCamera.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/PerspectiveCamera.java	Tue Jun 19 10:12:35 2012 -0700
@@ -70,7 +70,7 @@
 
                 @Override
                 protected void invalidated() {
-                    impl_markDirty();
+                    markDirty();
                 }
 
                 @Override
@@ -88,7 +88,7 @@
     }
 
     public PerspectiveCamera() {
-        impl_markDirty();
+        markDirty();
     }
 
     @Override
@@ -96,16 +96,11 @@
         return Toolkit.getToolkit().createPerspectiveCamera();
     }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    @Override protected void impl_update() {
-        if (impl_isDirty()) {
+    @Override void update() {
+        if (isDirty()) {
             PerspectiveCameraImpl perspectiveCameraImpl = (PerspectiveCameraImpl) getPlatformCamera();
             perspectiveCameraImpl.setFieldOfView((float)getFieldOfView());
-            impl_clearDirty();
+            clearDirty();
         }
     }
 
--- a/javafx-ui-common/src/javafx/scene/Scene.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/Scene.java	Tue Jun 19 10:12:35 2012 -0700
@@ -110,6 +110,7 @@
 import javafx.beans.property.ReadOnlyDoubleWrapper;
 import javafx.beans.property.ReadOnlyObjectProperty;
 import javafx.beans.property.ReadOnlyObjectWrapper;
+import javafx.geometry.Bounds;
 import javafx.geometry.Orientation;
 import javafx.scene.image.WritableImage;
 import javafx.scene.input.GestureEvent;
@@ -343,11 +344,8 @@
          * mouse event code (picking) or the synchronizer, or if the scene is
          * not yet initialized,
          *
-         * @treatAsPrivate implementation detail
-         * @deprecated This is an internal API that is not intended for use and will be removed in the next version
          */
-        @Deprecated
-        public static boolean impl_isPGAccessAllowed() {
+        static boolean isPGAccessAllowed() {
             return inSynchronizer || inMousePick || allowPGAccess;
         }
 
@@ -884,7 +882,7 @@
             new AbstractNotifyListener() {
 
         @Override public void invalidated(Observable valueModel) {
-            if (getCamera().impl_isDirty()) {
+            if (getCamera().isDirty()) {
                 markDirty(DirtyBits.CAMERA_DIRTY);
             }
         }
@@ -977,7 +975,7 @@
                         throw new IllegalArgumentException(_value +
                                 "is already inside a scene-graph and cannot be set as root");
                     }
-                    if (_value.impl_getClipParent() != null) {
+                    if (_value.getClipParent() != null) {
                         if (isBound()) forceUnbind();
                         throw new IllegalArgumentException(_value +
                                 "is set as a clip on another node, so cannot be set as root");
@@ -1127,7 +1125,7 @@
         context.root = root.impl_getPGNode();
         context.platformPaint = fill == null ? null : tk.getPaint(fill);
         if (camera != null) {
-            camera.impl_update();
+            camera.update();
             context.camera = camera.getPlatformCamera();
         } else {
             context.camera = null;
@@ -1369,16 +1367,6 @@
     public final ObservableList<String> getStylesheets() { return stylesheets; }
 
     /**
-     * Invalidate all css styles in the scene, this will cause all css to be reapplied
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public void impl_invalidateCSS() {
-        getRoot().impl_reapplyCSS();
-    }
-
-    /**
      * Retrieves the depth buffer attribute for this scene.
      * @return the depth buffer attribute.
      */
@@ -1541,7 +1529,25 @@
         if (!isKeyboardTrigger) Scene.inMousePick = true;
         if (isKeyboardTrigger) {
             Node sceneFocusOwner = getFocusOwner();
-            eventTarget = sceneFocusOwner != null ? sceneFocusOwner : Scene.this;
+
+            // for keyboard triggers set coordinates inside focus owner
+            final double xOffset = xAbs - x2;
+            final double yOffset = yAbs - y2;
+            if (sceneFocusOwner != null) {
+                final Bounds bounds = sceneFocusOwner.localToScene(
+                        sceneFocusOwner.getBoundsInLocal());
+                x2 = bounds.getMinX() + bounds.getWidth() / 4;
+                y2 = bounds.getMinY() + bounds.getHeight() / 2;
+                eventTarget = sceneFocusOwner;
+            } else {
+                x2 = Scene.this.getWidth() / 4;
+                y2 = Scene.this.getWidth() / 2;
+                eventTarget = Scene.this;
+            }
+
+            xAbs = x2 + xOffset;
+            yAbs = y2 + yOffset;
+            
         } else {
             eventTarget = pick(x2, y2);
         }
@@ -1856,12 +1862,6 @@
             }
         }
 
-        // inform key listeners
-        int cnt = keyListeners.size();
-        for (int i = 0; i < cnt; i++) {
-            ((EventHandler<KeyEvent>)keyListeners.get(i)).handle(e);
-        }
-
         getKeyHandler().process(e);
 
         // our little secret...
@@ -1882,31 +1882,6 @@
         }
     }
 
-    private final ObservableList<EventHandler<KeyEvent>> keyListeners =
-            FXCollections.<EventHandler<KeyEvent>>observableArrayList();
-
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public void impl_addKeyListener(EventHandler<KeyEvent> listener) {
-        if (!keyListeners.contains(listener)) {
-            keyListeners.add(listener);
-        }
-    }
-
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public void impl_removeKeyListener(EventHandler<KeyEvent> listener) {
-        if (keyListeners.contains(listener)) {
-            keyListeners.remove(listener);
-        }
-    }
-
     void requestFocus(Node node) {
         getKeyHandler().requestFocus(node);
     }
@@ -1963,12 +1938,7 @@
         scenePulseListener.focusCleanup();
     }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public void impl_processInputMethodEvent(InputMethodEvent e) {
+    private void processInputMethodEvent(InputMethodEvent e) {
         Node node = getFocusOwner();
         if (node != null) {
             node.fireEvent(e);
@@ -2145,7 +2115,7 @@
             // new camera was set on the scene
             if (isDirty(DirtyBits.CAMERA_DIRTY)) {
                 if (getCamera() != null) {
-                    getCamera().impl_update();
+                    getCamera().update();
                     impl_peer.setCamera(getCamera().getPlatformCamera());
                     pickingCamera = getCamera();
                 } else {
@@ -2263,7 +2233,7 @@
 
         @Override
         public void inputMethodEvent(Object event) {
-            Scene.this.impl_processInputMethodEvent(Toolkit.getToolkit().convertInputMethodEventToFX(event));
+            Scene.this.processInputMethodEvent(Toolkit.getToolkit().convertInputMethodEventToFX(event));
         }
 
         public void menuEvent(double x, double y, double xAbs, double yAbs,
@@ -3434,8 +3404,8 @@
         public void updateCursorFrame() {
             final CursorFrame newCursorFrame =
                     (currCursor != null)
-                           ? currCursor.impl_getCurrentFrame()
-                           : Cursor.DEFAULT.impl_getCurrentFrame();
+                           ? currCursor.getCurrentFrame()
+                           : Cursor.DEFAULT.getCurrentFrame();
             if (currCursorFrame != newCursorFrame) {
                 if (Scene.this.impl_peer != null) {
                     Scene.this.impl_peer.setCursor(newCursorFrame);
@@ -3515,14 +3485,9 @@
             setFocusOwner(node);
 
             if (getFocusOwner() != null) {
-                getFocusOwner().impl_requestFocusImpl(new Runnable() {
-                    @Override
-                    public void run() {
-                        if (impl_peer != null) {
-                            impl_peer.requestFocus();
-                        }
-                    }
-                });
+                if (impl_peer != null) {
+                    impl_peer.requestFocus();
+                }
             }
         }
     }
@@ -5234,7 +5199,7 @@
      * moment (it's called outside of {@code DRAG_DETECTED} event handling).
      */
     public Dragboard startDragAndDrop(TransferMode... transferModes) {
-        return impl_startDragAndDrop(this, transferModes);
+        return startDragAndDrop(this, transferModes);
     }
 
     /**
@@ -5250,16 +5215,11 @@
      * {@code DRAG_DETECTED} event handling).
      */
     public void startFullDrag() {
-        impl_startFullDrag(this);
-    }
-
-
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public Dragboard impl_startDragAndDrop(EventTarget source,
+        startFullDrag(this);
+    }
+
+
+    Dragboard startDragAndDrop(EventTarget source,
             TransferMode... transferModes) {
 
         if (dndGesture.dragDetected != DragDetectedState.PROCESSING) {
@@ -5279,12 +5239,7 @@
                 + "mouse button is not pressed");
     }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public void impl_startFullDrag(EventTarget source) {
+    void startFullDrag(EventTarget source) {
 
         if (dndGesture.dragDetected != DragDetectedState.PROCESSING) {
             throw new IllegalStateException("Cannot start full drag " +
--- a/javafx-ui-common/src/javafx/scene/image/PixelFormat.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/image/PixelFormat.java	Tue Jun 19 10:12:35 2012 -0700
@@ -63,7 +63,7 @@
         /**
          * The opaque pixels are stored in adjacent bytes with the color
          * components stored in order of increasing index:
-         * red, gree, blue.
+         * red, green, blue.
          */
         BYTE_RGB,
         /**
--- a/javafx-ui-common/src/javafx/scene/image/PixelReader.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/image/PixelReader.java	Tue Jun 19 10:12:35 2012 -0700
@@ -54,8 +54,9 @@
      * 
      * @param x the X coordinate of the pixel color to read
      * @param y the Y coordinate of the pixel color to read
-     * @return a 32-bit representation of the color in a format described
-     *         by the {@link PixelFormat.Type.BYTE_ARGB} PixelFormat type.
+     * @return a 32-bit representation of the color in the format
+     *         described by the {@link PixelFormat.Type#INT_ARGB INT_ARGB}
+     *         PixelFormat type.
      */
     public int getArgb(int x, int y);
 
--- a/javafx-ui-common/src/javafx/scene/image/PixelWriter.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/image/PixelWriter.java	Tue Jun 19 10:12:35 2012 -0700
@@ -48,14 +48,14 @@
     /**
      * Stores pixel data for a color into the specified coordinates of the
      * surface.
-     * The 32-bit integer {@code argb} parameter will contain the 4 color
+     * The 32-bit integer {@code argb} parameter should contain the 4 color
      * components in separate 8-bit fields in ARGB order from the most
      * significant byte to the least significant byte.
      * 
      * @param x the X coordinate of the pixel color to write
      * @param y the Y coordinate of the pixel color to write
-     * @param argb the color information to write, specified in a format
-     *         described by the {@link PixelFormat.Type.BYTE_ARGB}
+     * @param argb the color information to write, specified in the format
+     *         described by the {@link PixelFormat.Type#INT_ARGB INT_ARGB}
      *         PixelFormat type.
      */
     public void setArgb(int x, int y, int argb);
--- a/javafx-ui-common/src/javafx/scene/input/Clipboard.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/input/Clipboard.java	Tue Jun 19 10:12:35 2012 -0700
@@ -151,13 +151,18 @@
      * the system will invoke the provided callback to stream the image data over to the client.
      */
 
+    private static Clipboard systemClipboard = null;
+    
     /**
      * Gets the current system clipboard, through which data can be stored and
      * retrieved. There is ever only one system clipboard for a JavaFX application.
      * @return The single system clipboard, used for cut / copy / paste operations
      */
     public static Clipboard getSystemClipboard() {
-        return new Clipboard(Toolkit.getToolkit().getSystemClipboard());
+        if (systemClipboard == null) {
+            systemClipboard = new Clipboard(Toolkit.getToolkit().getSystemClipboard());
+        }
+        return systemClipboard;
     }
 
     TKClipboard peer;
@@ -165,7 +170,10 @@
     // Only allow Dragboard to extend from this
     Clipboard(TKClipboard peer) {
         Toolkit.getToolkit().checkFxUserThread();
-        if (peer == null) throw new NullPointerException();
+        if (peer == null) {
+            throw new NullPointerException();
+        }
+        peer.initSecurityContext();
         this.peer = peer;
     }
 
--- a/javafx-ui-common/src/javafx/scene/input/ContextMenuEvent.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/input/ContextMenuEvent.java	Tue Jun 19 10:12:35 2012 -0700
@@ -40,6 +40,10 @@
  * menu is platform specific.  For example, on Windows, Shift+F10
  * requests a context menu.
  * <p>
+ * The event coordinates contain default position for the context menu.
+ * For mouse-triggered events it is the position of the
+ * mouse cursor, for keyboard-triggered events it is a point
+ * inside of bounds of current focus owner (which is the event's target).
  */
 public class ContextMenuEvent extends InputEvent {
 
@@ -55,7 +59,9 @@
 
     /**
      * @treatAsPrivate implementation detail
+     * @deprecated
      */
+    @Deprecated
     public static ContextMenuEvent impl_contextEvent(double _x, double _y,
           double _screenX, double _screenY, boolean _keyboardTrigger,
           EventType<? extends ContextMenuEvent> _eventType
@@ -110,20 +116,38 @@
 
     /**
      * Horizontal x position of the event relative to the
-     * origin of the MouseEvent's node.
+     * origin of the ContextMenuEvent's node.
      */
     private double x;
 
+    /**
+     * Horizontal position of the event relative to the
+     * origin of the ContextMenuEvent's source.
+     * For more information about this event's coordinate semantics please see
+     * the general description of {@link ContextMenuEvent}.
+     *
+     * @return horizontal position of the event relative to the
+     * origin of the ContextMenuEvent's source.
+     */
     public final double getX() {
         return x;
     }
 
     /**
      * Vertical y position of the event relative to the
-     * origin of the MouseEvent's node.
+     * origin of the ContextMenuEvent's node.
      */
     private double y;
 
+    /**
+     * Vertical position of the event relative to the
+     * origin of the ContextMenuEvent's source.
+     * For more information about this event's coordinate semantics please see
+     * the general description of {@link ContextMenuEvent}.
+     *
+     * @return vertical position of the event relative to the
+     * origin of the ContextMenuEvent's source.
+     */
     public final double getY() {
         return y;
     }
@@ -133,6 +157,12 @@
      */
     private double screenX;
 
+    /**
+     * Returns absolute horizontal position of the event.
+     * For more information about this event's coordinate semantics please see
+     * the general description of {@link ContextMenuEvent}.
+     * @return absolute horizontal position of the event
+     */
     public final double getScreenX() {
         return screenX;
     }
@@ -142,34 +172,66 @@
      */
     private double screenY;
 
+    /**
+     * Returns absolute vertical position of the event.
+     * For more information about this event's coordinate semantics please see
+     * the general description of {@link ContextMenuEvent}.
+     * @return absolute vertical position of the event
+     */
     public final double getScreenY() {
         return screenY;
     }
 
     /**
      * Horizontal x position of the event relative to the
-     * origin of the {@code Scene} that contains the MouseEvent's node.
+     * origin of the {@code Scene} that contains the ContextMenuEvent's node.
      * If the node is not in a {@code Scene}, then the value is relative to
-     * the boundsInParent of the root-most parent of the MouseEvent's node.
+     * the boundsInParent of the root-most parent of the ContextMenuEvent's node.
      */
     private double sceneX;
 
+    /**
+     * Returns horizontal position of the event relative to the
+     * origin of the {@code Scene} that contains the ContextMenuEvent's source.
+     * If the node is not in a {@code Scene}, then the value is relative to
+     * the boundsInParent of the root-most parent of the ContextMenuEvent's node.
+     * For more information about this event's coordinate semantics please see
+     * the general description of {@link ContextMenuEvent}.
+     *
+     * @return horizontal position of the event relative to the
+     * origin of the {@code Scene} that contains the ContextMenuEvent's source
+     */
     public final double getSceneX() {
         return sceneX;
     }
 
     /**
      * Vertical y position of the event relative to the
-     * origin of the {@code Scene} that contains the MouseEvent's node.
+     * origin of the {@code Scene} that contains the ContextMenuEvent's node.
      * If the node is not in a {@code Scene}, then the value is relative to
-     * the boundsInParent of the root-most parent of the MouseEvent's node.
+     * the boundsInParent of the root-most parent of the ContextMenuEvent's node.
      */
     private double sceneY;
 
+    /**
+     * Returns vertical position of the event relative to the
+     * origin of the {@code Scene} that contains the ContextMenuEvent's source.
+     * If the node is not in a {@code Scene}, then the value is relative to
+     * the boundsInParent of the root-most parent of the ContextMenuEvent's node.
+     * For more information about this event's coordinate semantics please see
+     * the general description of {@link ContextMenuEvent}.
+     *
+     * @return vertical position of the event relative to the
+     * origin of the {@code Scene} that contains the ContextMenuEvent's source
+     */
     public final double getSceneY() {
         return sceneY;
     }
 
+    /**
+     * Returns a string representation of this {@code ContextMenuEvent} object.
+     * @return a string representation of this {@code ContextMenuEvent} object.
+     */
     @Override public String toString() {
         final StringBuilder sb = new StringBuilder("ContextMenuEvent [");
 
--- a/javafx-ui-common/src/javafx/scene/layout/ConstraintsBase.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/ConstraintsBase.java	Tue Jun 19 10:12:35 2012 -0700
@@ -72,21 +72,11 @@
      ConstraintsBase() {
      }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-     public void impl_add(Node node) {
+     void add(Node node) {
          impl_nodes.add(node);
      }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public void impl_remove(Node node) {
+    void remove(Node node) {
         impl_nodes.remove(node);
     }
 
--- a/javafx-ui-common/src/javafx/scene/layout/GridPane.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/GridPane.java	Tue Jun 19 10:12:35 2012 -0700
@@ -828,12 +828,12 @@
             while (c.next()) {
                 for (RowConstraints constraints : c.getRemoved()) {
                     if (constraints != null && !rowConstraints.contains(constraints)) {
-                        constraints.impl_remove(GridPane.this);
+                        constraints.remove(GridPane.this);
                     }
                 }
                 for (RowConstraints constraints : c.getAddedSubList()) {
                     if (constraints != null) {
-                        constraints.impl_add(GridPane.this);
+                        constraints.add(GridPane.this);
                     }
                 }
             }
@@ -858,12 +858,12 @@
             while(c.next()) {
                 for (ColumnConstraints constraints : c.getRemoved()) {
                     if (constraints != null && !columnConstraints.contains(constraints)) {
-                        constraints.impl_remove(GridPane.this);
+                        constraints.remove(GridPane.this);
                     }
                 }
                 for (ColumnConstraints constraints : c.getAddedSubList()) {
                     if (constraints != null) {
-                        constraints.impl_add(GridPane.this);
+                        constraints.add(GridPane.this);
                     }
                 }
             }
--- a/javafx-ui-common/src/javafx/scene/layout/Region.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/Region.java	Tue Jun 19 10:12:35 2012 -0700
@@ -1506,17 +1506,6 @@
     }
 
     /**
-     * Invoked during the layout pass to layout the children in this region.
-     * By default it will only set the size of managed, resizable content to
-     * their preferred sizes and does not do any node positioning.
-     * <p>
-     * Subclasses should override this function to layout content as needed.
-     */
-    @Override protected void layoutChildren() {
-        impl_resizeChildren(isSnapToPixel());
-    }
-
-    /**
      * If this region's snapToPixel property is true, returns a value rounded
      * to the nearest pixel, else returns the same value.
      * @param value the space value to be snapped
--- a/javafx-ui-common/src/javafx/scene/paint/ImagePattern.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/paint/ImagePattern.java	Tue Jun 19 10:12:35 2012 -0700
@@ -39,8 +39,9 @@
  * then the anchor rectangle should be specified relative to the unit
  * square (0.0->1.0) and will be stretched across the shape.
  * If the {@code proportional} variable is set to false, then the anchor
- * rectangle should be specified as absolute pixel values and the image
- * will be stretched to fit the anchor rectangle.</p>
+ * rectangle should be specified in the local coordinate system of the shape 
+ * and the image will be stretched to fit the anchor rectangle. The anchor 
+ * rectangle will not be stretched across the shape.</p>
  *
  * <p>The example below demonstrates the use of the {@code proportional}
  * variable.  The shapes on the top row use proportional coordinates
--- a/javafx-ui-common/src/javafx/stage/PopupWindow.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/stage/PopupWindow.java	Tue Jun 19 10:12:35 2012 -0700
@@ -26,6 +26,7 @@
 package javafx.stage;
 
 import com.sun.javafx.Utils;
+import com.sun.javafx.event.DirectEvent;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -50,14 +51,20 @@
 
 import com.sun.javafx.event.EventHandlerManager;
 import com.sun.javafx.event.EventRedirector;
+import com.sun.javafx.event.EventUtil;
 import com.sun.javafx.perf.PerformanceTracker;
-import com.sun.javafx.stage.PopupEventRedirector;
+import com.sun.javafx.stage.FocusUngrabEvent;
 import com.sun.javafx.stage.PopupWindowPeerListener;
 import com.sun.javafx.stage.WindowCloseRequestHandler;
 import com.sun.javafx.stage.WindowEventDispatcher;
 import com.sun.javafx.tk.Toolkit;
 import javafx.beans.property.ReadOnlyObjectProperty;
 import javafx.beans.property.ReadOnlyObjectWrapper;
+import javafx.event.EventTarget;
+import javafx.event.EventType;
+import javafx.scene.input.KeyCombination;
+import javafx.scene.input.KeyEvent;
+import javafx.scene.input.MouseEvent;
 
 /**
  * PopupWindow is the parent for a variety of different types of popup
@@ -426,13 +433,13 @@
             bindOwnerFocusedProperty(ownerWindowValue);
             setFocused(ownerWindowValue.isFocused());
             handleAutofixActivation(true, isAutoFix());
-            rootWindow.impl_increaseFocusGrabCounter();
+            rootWindow.increaseFocusGrabCounter();
         } else {
             stopMonitorOwnerEvents(ownerWindowValue);
             unbindOwnerFocusedProperty(ownerWindowValue);
             setFocused(false);
             handleAutofixActivation(false, isAutoFix());
-            rootWindow.impl_decreaseFocusGrabCounter();
+            rootWindow.decreaseFocusGrabCounter();
             rootWindow = null;
         }
 
@@ -451,38 +458,34 @@
             rootNode.setTranslateX(-layoutBounds.getMinX());
             rootNode.setTranslateY(-layoutBounds.getMinY());
         }
-   }
-
-   /**
-    * Gets the root (non PopupWindow) Window for the provided window.
-    *
-    * @param win the Window for which to get the root window
-    */
-   private static Window getRootWindow(Window win) {
-       // should be enough to traverse PopupWindow hierarchy here to get to the
-       // first non-popup focusable window
-       while (win instanceof PopupWindow) {
-           win = ((PopupWindow) win).getOwnerWindow();
-       }
-       return win;
-   }
+    }
 
     /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
+     *
+     * Gets the root (non PopupWindow) Window for the provided window.
+     *
+     * @param win the Window for which to get the root window
      */
-    @Deprecated
-    public void doAutoHide() {
+    private static Window getRootWindow(Window win) {
+        // should be enough to traverse PopupWindow hierarchy here to get to the
+        // first non-popup focusable window
+        while (win instanceof PopupWindow) {
+            win = ((PopupWindow) win).getOwnerWindow();
+        }
+        return win;
+    }
+
+    void doAutoHide() {
         // There is a timing problem here. I would like to have this isVisible
         // check, such that we don't send an onAutoHide event if it was already
         // invisible. However, visible is already false by the time this method
         // gets called, when done by certain code paths.
 //        if (isVisible()) {
-            // hide this popup
-            hide();
-            if (getOnAutoHide() != null) {
-                getOnAutoHide().handle(new Event(this, this, Event.ANY));
-            }
+        // hide this popup
+        hide();
+        if (getOnAutoHide() != null) {
+            getOnAutoHide().handle(new Event(this, this, Event.ANY));
+        }
 //        }
     }
 
@@ -612,4 +615,121 @@
             setY(_y);
         }
     }
+
+    static class PopupEventRedirector extends EventRedirector {
+
+        private static final KeyCombination ESCAPE_KEY_COMBINATION =
+                KeyCombination.keyCombination("Esc");
+        private final PopupWindow popupWindow;
+
+        public PopupEventRedirector(final PopupWindow popupWindow) {
+            super(popupWindow);
+            this.popupWindow = popupWindow;
+        }
+
+        @Override
+        protected void handleRedirectedEvent(final Object eventSource,
+                final Event event) {
+            if (event instanceof KeyEvent) {
+                handleKeyEvent((KeyEvent) event);
+                return;
+            }
+
+            final EventType<?> eventType = event.getEventType();
+
+            if (eventType == MouseEvent.MOUSE_PRESSED) {
+                handleMousePressedEvent(eventSource, event);
+                return;
+            }
+
+            if (eventType == FocusUngrabEvent.FOCUS_UNGRAB) {
+                handleFocusUngrabEvent();
+                return;
+            }
+        }
+
+        private void handleKeyEvent(final KeyEvent event) {
+            if (event.isConsumed()) {
+                return;
+            }
+
+            final Scene scene = popupWindow.getScene();
+            if (scene != null) {
+                final Node sceneFocusOwner = scene.getFocusOwner();
+                final EventTarget eventTarget =
+                        (sceneFocusOwner != null) ? sceneFocusOwner : scene;
+                if (EventUtil.fireEvent(eventTarget, new DirectEvent(event))
+                        == null) {
+                    event.consume();
+                    return;
+                }
+            }
+
+            if ((event.getEventType() == KeyEvent.KEY_PRESSED)
+                    && ESCAPE_KEY_COMBINATION.match(event)) {
+                handleEscapeKeyPressedEvent(event);
+            }
+        }
+
+        private void handleEscapeKeyPressedEvent(final Event event) {
+            if (popupWindow.isHideOnEscape()) {
+                popupWindow.doAutoHide();
+
+                if (popupWindow.getConsumeAutoHidingEvents()) {
+                    event.consume();
+                }
+            }
+        }
+
+        private void handleMousePressedEvent(final Object eventSource,
+                final Event event) {
+            // we handle mouse pressed only for the immediate parent window,
+            // where we can check whether the mouse press is inside of the owner
+            // control or not, we will force possible child popups to close
+            // by sending the FOCUS_UNGRAB event
+            if (popupWindow.getOwnerWindow() != eventSource) {
+                return;
+            }
+
+            if (popupWindow.isAutoHide() && !isOwnerNodeEvent(event)) {
+                // the mouse press is outside of the owner control,
+                // fire FOCUS_UNGRAB to child popups
+                Event.fireEvent(popupWindow, new FocusUngrabEvent());
+
+                popupWindow.doAutoHide();
+
+                if (popupWindow.getConsumeAutoHidingEvents()) {
+                    event.consume();
+                }
+            }
+        }
+
+        private void handleFocusUngrabEvent() {
+            if (popupWindow.isAutoHide()) {
+                popupWindow.doAutoHide();
+            }
+        }
+
+        private boolean isOwnerNodeEvent(final Event event) {
+            final Node ownerNode = popupWindow.getOwnerNode();
+            if (ownerNode == null) {
+                return false;
+            }
+
+            final EventTarget eventTarget = event.getTarget();
+            if (!(eventTarget instanceof Node)) {
+                return false;
+            }
+
+            Node node = (Node) eventTarget;
+            do {
+                if (node == ownerNode) {
+                    return true;
+                }
+                node = node.getParent();
+            } while (node != null);
+
+            return false;
+        }
+    }
 }
--- a/javafx-ui-common/src/javafx/stage/Window.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/src/javafx/stage/Window.java	Tue Jun 19 10:12:35 2012 -0700
@@ -992,23 +992,13 @@
 
     private int focusGrabCounter;
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public void impl_increaseFocusGrabCounter() {
+    void increaseFocusGrabCounter() {
         if ((++focusGrabCounter == 1) && (impl_peer != null) && isFocused()) {
             impl_peer.grabFocus();
         }
     }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public void impl_decreaseFocusGrabCounter() {
+    void decreaseFocusGrabCounter() {
         if ((--focusGrabCounter == 0) && (impl_peer != null)) {
             impl_peer.ungrabFocus();
         }
--- a/javafx-ui-common/test/unit/javafx/scene/ImageCursor_getCurrentFrame_Test.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/test/unit/javafx/scene/ImageCursor_getCurrentFrame_Test.java	Tue Jun 19 10:12:35 2012 -0700
@@ -47,13 +47,13 @@
     @Test
     public void specialCasesTest() {
         final Object defaultCursorFrame =
-                Cursor.DEFAULT.impl_getCurrentFrame();
+                Cursor.DEFAULT.getCurrentFrame();
 
         assertEquals(defaultCursorFrame,
-                     new ImageCursor(null).impl_getCurrentFrame());
+                     new ImageCursor(null).getCurrentFrame());
 
         assertEquals(defaultCursorFrame,
-                     new ImageCursor(TEST_ERROR_IMAGE).impl_getCurrentFrame());
+                     new ImageCursor(TEST_ERROR_IMAGE).getCurrentFrame());
     }
 
     @Test
@@ -72,28 +72,28 @@
 
         animatedImageCursor.activate();
 
-        lastCursorFrame = animatedImageCursor.impl_getCurrentFrame();
+        lastCursorFrame = animatedImageCursor.getCurrentFrame();
 
         toolkit.setAnimationTime(1000);
-        currCursorFrame = animatedImageCursor.impl_getCurrentFrame();
+        currCursorFrame = animatedImageCursor.getCurrentFrame();
         assertSame(lastCursorFrame, currCursorFrame);
         
         lastCursorFrame = currCursorFrame;
 
         toolkit.setAnimationTime(2500);
-        currCursorFrame = animatedImageCursor.impl_getCurrentFrame();
+        currCursorFrame = animatedImageCursor.getCurrentFrame();
         assertNotSame(lastCursorFrame, currCursorFrame);
         
         lastCursorFrame = currCursorFrame;
 
         toolkit.setAnimationTime(4500);
-        currCursorFrame = animatedImageCursor.impl_getCurrentFrame();
+        currCursorFrame = animatedImageCursor.getCurrentFrame();
         assertNotSame(lastCursorFrame, currCursorFrame);
 
         lastCursorFrame = currCursorFrame;
 
         toolkit.setAnimationTime(7000);
-        currCursorFrame = animatedImageCursor.impl_getCurrentFrame();
+        currCursorFrame = animatedImageCursor.getCurrentFrame();
         assertNotSame(lastCursorFrame, currCursorFrame);
 
         animatedImageCursor.deactivate();
@@ -116,27 +116,27 @@
 
         toolkit.setAnimationTime(1000);
         final Object time1000CursorFrame =
-                animatedImageCursor.impl_getCurrentFrame();
+                animatedImageCursor.getCurrentFrame();
 
         toolkit.setAnimationTime(2500);
         final Object time2500CursorFrame =
-                animatedImageCursor.impl_getCurrentFrame();
+                animatedImageCursor.getCurrentFrame();
 
         toolkit.setAnimationTime(4500);
         final Object time4500CursorFrame =
-                animatedImageCursor.impl_getCurrentFrame();
+                animatedImageCursor.getCurrentFrame();
 
         toolkit.setAnimationTime(6000 + 1000);
         assertSame(time1000CursorFrame,
-                   animatedImageCursor.impl_getCurrentFrame());
+                   animatedImageCursor.getCurrentFrame());
 
         toolkit.setAnimationTime(6000 + 2500);
         assertSame(time2500CursorFrame,
-                   animatedImageCursor.impl_getCurrentFrame());
+                   animatedImageCursor.getCurrentFrame());
 
         toolkit.setAnimationTime(6000 + 4500);
         assertSame(time4500CursorFrame,
-                   animatedImageCursor.impl_getCurrentFrame());
+                   animatedImageCursor.getCurrentFrame());
 
         animatedImageCursor.deactivate();
 
--- a/javafx-ui-common/test/unit/javafx/scene/MouseTest.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/test/unit/javafx/scene/MouseTest.java	Tue Jun 19 10:12:35 2012 -0700
@@ -493,17 +493,17 @@
         scene.processEvent(generator.generateMouseEvent(
                 MouseEvent.MOUSE_MOVED, 250, 250));
 
-        assertSame(Cursor.HAND.impl_getCurrentFrame(), scene.getCursorFrame());
+        assertSame(Cursor.HAND.getCurrentFrame(), scene.getCursorFrame());
 
         scene.processEvent(generator.generateMouseEvent(
                 MouseEvent.MOUSE_MOVED, 150, 150));
 
-        assertSame(Cursor.TEXT.impl_getCurrentFrame(), scene.getCursorFrame());
+        assertSame(Cursor.TEXT.getCurrentFrame(), scene.getCursorFrame());
 
         scene.processEvent(generator.generateMouseEvent(
                 MouseEvent.MOUSE_MOVED, 50, 50));
 
-        assertSame(Cursor.DEFAULT.impl_getCurrentFrame(),
+        assertSame(Cursor.DEFAULT.getCurrentFrame(),
                    scene.getCursorFrame());
     }
 
--- a/javafx-ui-common/test/unit/javafx/scene/ParentTest.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/test/unit/javafx/scene/ParentTest.java	Tue Jun 19 10:12:35 2012 -0700
@@ -481,6 +481,25 @@
 
     }
 
+    @Test
+    public void nodeCanBeAddedDuringLayout() {
+        final Rectangle rect = new Rectangle(100, 100);
+        final Group g = new Group(rect);
+
+        Group root = new Group() {
+            @Override protected void layoutChildren() {
+                getChildren().setAll(g);
+            }
+        };
+
+        Scene scene = new Scene(root);
+
+        stage.setScene(scene);
+        stage.show();
+
+        // there are assertions tested down the stack (see RT-21746)
+    }
+
     public static class MockParent extends Parent {
         public MockParent(Node... children) {
             getChildren().addAll(children);
--- a/javafx-ui-common/test/unit/javafx/scene/Scene_properties_Test.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/test/unit/javafx/scene/Scene_properties_Test.java	Tue Jun 19 10:12:35 2012 -0700
@@ -71,7 +71,7 @@
             config(testScene, "fill", null, Color.TRANSPARENT),
             config(testScene, "root", new Group(), new Pane()),
             config(testScene, "cursor", null, new Cursor("TestCursor") {
-                @Override public CursorFrame impl_getCurrentFrame() {
+                @Override public CursorFrame getCurrentFrame() {
                     throw new UnsupportedOperationException("Not supported yet.");
                 }
             }),
--- a/javafx-ui-common/test/unit/javafx/scene/StructureTest.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/test/unit/javafx/scene/StructureTest.java	Tue Jun 19 10:12:35 2012 -0700
@@ -150,7 +150,7 @@
     public void testOrphan() {
         Node n = new StubNode();
 
-        assertNull("clipParent is null", n.impl_getClipParent());
+        assertNull("clipParent is null", n.getClipParent());
         assertNull("parent is null", n.getParent());
         assertNull("scene is null", n.getScene());
     }
@@ -162,7 +162,7 @@
         parent.setClip(child);
 
         assertSame("parent.clip is child", child, parent.getClip());
-        assertSame("child.clipParent is parent", parent, child.impl_getClipParent());
+        assertSame("child.clipParent is parent", parent, child.getClipParent());
         assertNull("child.parent is null", child.getParent());
         assertNull("scene is null", child.getScene());
     }
@@ -174,7 +174,7 @@
 
         assertNull("group.clip is null", group.getClip());
         assertTrue("isChild of group", isChild(child, group));
-        assertNull("child.clipParent is null", child.impl_getClipParent());
+        assertNull("child.clipParent is null", child.getClipParent());
         assertSame("child.parent is parent", group, child.getParent());
         assertNull("child.getScene() is null", child.getScene());
     }
@@ -185,7 +185,7 @@
         Scene scene = new Scene(root);
 
         assertTrue("isChild of scene", isRoot(root, scene));
-        assertNull("child.clipParent is null", root.impl_getClipParent());
+        assertNull("child.clipParent is null", root.getClipParent());
         assertSame("child.getScene() is scene", scene, root.getScene());
     }
 
@@ -219,7 +219,7 @@
         parent.setClip(null);
 
         assertNull("parent.clip is null", parent.getClip());
-        assertNull("child.clipParent is null", child.impl_getClipParent());
+        assertNull("child.clipParent is null", child.getClipParent());
     }
 
     @Test public void testUnparentG() {
@@ -253,7 +253,7 @@
             assertSame("p1.clip is child", child, p1.getClip());
             assertNull("p2.clip is null", p2.getClip());
             assertSame("child.clipParent is p1",
-                       p1, child.impl_getClipParent());
+                       p1, child.getClipParent());
             assertNull("child.parent is null", child.getParent());
             assertNull("child.getScene() is null", child.getScene());
             throw e;
@@ -276,7 +276,7 @@
         assertSame("p1.clip is child", child, p1.getClip());
         assertNull("p2.clip is null", p2.getClip());
         assertTrue("notChild of p2", notChild(child, p2));
-        assertSame("child.clipParent is p1", p1, child.impl_getClipParent());
+        assertSame("child.clipParent is p1", p1, child.getClipParent());
         assertNull("child.parent is null", child.getParent());
         assertNull("child.getScene() is null", child.getScene());
     }
@@ -292,7 +292,7 @@
             //expected
         }
         assertSame("p1.clip is child", clipNode, p1.getClip());
-        assertSame("child.clipParent is p1", p1, clipNode.impl_getClipParent());
+        assertSame("child.clipParent is p1", p1, clipNode.getClipParent());
         assertNull("child.parent is null", clipNode.getParent());
         assertNull("child.getScene() is null", clipNode.getScene());
     }
@@ -308,7 +308,7 @@
             assertNull("p1.clip is null", p1.getClip());
             assertTrue("isChild of p1", isChild(child, p1));
             assertNull("p2.clip is null", p2.getClip());
-            assertNull("child.clipParent is null", child.impl_getClipParent());
+            assertNull("child.clipParent is null", child.getClipParent());
             assertSame("child.parent is p1", p1, child.getParent());
             assertNull("child.getScene() is null", child.getScene());
             throw e;
@@ -328,7 +328,7 @@
 //        assertTrue("isChild of p1", isChild(child, p1));
 //        assertNull("p2.clip is null", p2.clip);
 //        assertTrue("notChild of p2", notChild(child, p2));
-//        assertNull("child.clipParent is null", child.impl_getClipParent());
+//        assertNull("child.clipParent is null", child.getClipParent());
 //        assertSame("child.parent is p1", p1, child.parent);
 //        assertNull("child.getScene() is null", child.getScene());
 //    }
@@ -345,7 +345,7 @@
 //        assertNull("p1.clip is null", p1.clip);
 //        assertTrue("isChild of p1", isChild(child, p1));
 //        assertTrue("notChild of p2", notChild(child, p2));
-//        assertNull("child.clipParent is null", child.impl_getClipParent());
+//        assertNull("child.clipParent is null", child.getClipParent());
 //        assertSame("child.parent is p1", p1, child.parent);
 //        assertNull("child.getScene() is null", child.getScene());
 //    }
@@ -372,7 +372,7 @@
         } catch (final IllegalArgumentException e) {
             assertTrue("isRoot of scene", isRoot(root, scene));
             assertNull("p2.clip is null", p2.getClip());
-            assertNull("root.clipParent is null", root.impl_getClipParent());
+            assertNull("root.clipParent is null", root.getClipParent());
             assertSame("root.getScene() is scene", scene, root.getScene());
             throw e;
         }
@@ -391,7 +391,7 @@
 //        assertTrue("isChild of p1", isChild(child, p1));
 //        assertNull("p2.clip is null", p2.clip);
 //        assertTrue("notChild of p2", notChild(child, p2));
-//        assertNull("child.clipParent is null", child.impl_getClipParent());
+//        assertNull("child.clipParent is null", child.getClipParent());
 //        assertSame("child.parent is p1.impl_root", p1.impl_root, child.parent);
 //        assertSame("child.getScene() is p1", p1, child.getScene());
 //    }
@@ -406,7 +406,7 @@
 //
 //        assertTrue("isChild of p1", isChild(child, p1));
 //        assertTrue("notChild of p2", notChild(child, p2));
-//        assertNull("child.clipParent is null", child.impl_getClipParent());
+//        assertNull("child.clipParent is null", child.getClipParent());
 //        assertSame("child.parent is p1.impl_root", p1.impl_root, child.parent);
 //        assertSame("child.getScene() is p1", p1, child.getScene());
 //    }
@@ -524,9 +524,9 @@
             assertNull("node1.clip is null", node1.getClip());
             assertSame("node1.clipParent is node2",
                        node2,
-                       node1.impl_getClipParent());
+                       node1.getClipParent());
             assertSame("node2.clip is node1", node1, node2.getClip());
-            assertNull("node2.clipParent is null", node2.impl_getClipParent());
+            assertNull("node2.clipParent is null", node2.getClipParent());
             throw e;
         }
     }
@@ -539,10 +539,10 @@
             node1.setClip(node2);
         } catch (final IllegalArgumentException e) {
             assertNull("node1.clip is null", node1.getClip());
-            assertNull("node1.clipParent is null", node1.impl_getClipParent());
+            assertNull("node1.clipParent is null", node1.getClipParent());
             assertSame("node1.parent is node2", node2, node1.getParent());
             assertNull("node2.clip is null", node2.getClip());
-            assertNull("node2.clipParent is null", node2.impl_getClipParent());
+            assertNull("node2.clipParent is null", node2.getClipParent());
             assertTrue("node1 is child of node2", isChild(node1, node2));
             throw e;
         }
@@ -562,10 +562,10 @@
         }
 
         assertNull("node1.clip is null", node1.getClip());
-        assertSame("node1.clipParent is node2", node2, node1.impl_getClipParent());
+        assertSame("node1.clipParent is node2", node2, node1.getClipParent());
         assertTrue("node2 is not child of node1", notChild(node2, node1));
         assertSame("node2.clip is node1", node1, node2.getClip());
-        assertNull("node2.clipParent is null", node2.impl_getClipParent());
+        assertNull("node2.clipParent is null", node2.getClipParent());
         assertNull("node2.parent is null", node2.getParent());
     }
 
@@ -594,7 +594,7 @@
             node1.setClip(node1);
         } catch (final IllegalArgumentException e) {
             assertNull("node1.clip is null", node1.getClip());
-            assertNull("node1.clipParent is null", node1.impl_getClipParent());
+            assertNull("node1.clipParent is null", node1.getClipParent());
             throw e;
         }
     }
@@ -639,7 +639,7 @@
 //        println("c = {c}");
 //        println("p1.clip = {p1.clip}");
 //        println("p2.clip = {p2.clip}");
-//        println("c.clipParent = {c.impl_getClipParent()}");
+//        println("c.clipParent = {c.getClipParent()}");
 //    }
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/test/unit/javafx/scene/input/ContextMenuEventTest.java	Tue Jun 19 10:12:35 2012 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2010, 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 javafx.scene.input;
+
+import com.sun.javafx.pgstub.StubScene;
+import javafx.scene.Group;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import javafx.scene.Node;
+import javafx.scene.Scene;
+import javafx.scene.shape.Rectangle;
+import javafx.event.EventHandler;
+import javafx.stage.Stage;
+
+import org.junit.Test;
+
+public class ContextMenuEventTest {
+
+    @Test public void mouseTriggerKeepsCoordinates() {
+        Rectangle rect = new Rectangle(100, 100);
+        rect.setTranslateX(100);
+        rect.setTranslateY(100);
+        Group root = new Group(rect);
+        Scene scene = new Scene(root);
+        Stage stage = new Stage();
+        stage.setScene(scene);
+        stage.show();
+        rect.requestFocus();
+
+        rect.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() {
+            @Override public void handle(ContextMenuEvent event) {
+                assertEquals(1.0, event.getX(), 0.0001);
+                assertEquals(101, event.getSceneX(), 0.0001);
+                assertEquals(201, event.getScreenX(), 0.0001);
+                assertEquals(2.0, event.getY(), 0.0001);
+                assertEquals(102, event.getSceneY(), 0.0001);
+                assertEquals(202, event.getScreenY(), 0.0001);
+                assertFalse(event.isKeyboardTrigger());
+            }
+        });
+
+        ((StubScene) scene.impl_getPeer()).getListener().menuEvent(
+                101, 102, 201, 202, false);
+    }
+
+    @Test public void keyTriggerSetsCoordinatesToFocusOwner() {
+        Rectangle rect = new Rectangle(100, 100);
+        rect.setTranslateX(100);
+        rect.setTranslateY(100);
+        Group root = new Group(rect);
+        Scene scene = new Scene(root);
+        Stage stage = new Stage();
+        stage.setScene(scene);
+        stage.show();
+        rect.requestFocus();
+
+        rect.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() {
+            @Override public void handle(ContextMenuEvent event) {
+                assertEquals(25.0, event.getX(), 0.0001);
+                assertEquals(125, event.getSceneX(), 0.0001);
+                assertEquals(225, event.getScreenX(), 0.0001);
+                assertEquals(50.0, event.getY(), 0.0001);
+                assertEquals(150, event.getSceneY(), 0.0001);
+                assertEquals(250, event.getScreenY(), 0.0001);
+                assertTrue(event.isKeyboardTrigger());
+            }
+        });
+
+        ((StubScene) scene.impl_getPeer()).getListener().menuEvent(
+                101, 102, 201, 202, true);
+    }
+}
--- a/javafx-ui-common/test/unit/javafx/scene/input/DragAndDropTest.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/javafx-ui-common/test/unit/javafx/scene/input/DragAndDropTest.java	Tue Jun 19 10:12:35 2012 -0700
@@ -1191,6 +1191,8 @@
             return true;
         }
         
+        @Override public void initSecurityContext() {
+        }
     }
     
     private class DndToolkit implements StubToolkit.DndDelegate {
--- a/test-stub-toolkit/src/com/sun/javafx/pgstub/StubToolkit.java	Mon Jun 18 16:54:00 2012 -0700
+++ b/test-stub-toolkit/src/com/sun/javafx/pgstub/StubToolkit.java	Tue Jun 19 10:12:35 2012 -0700
@@ -475,6 +475,9 @@
             modes.add(TransferMode.COPY);
             return modes;
         }
+    
+        @Override public void initSecurityContext() {
+        }
     };