7081584: Specification for Window.isAlwaysOnTopSupported needs to be clarified
authormalenkov
Tue, 08 Oct 2013 18:10:13 +0400
changeset 20465 b08b3909ee92
parent 20464 e0f599d49ea8
child 20466 21c52a4c548b
7081584: Specification for Window.isAlwaysOnTopSupported needs to be clarified Reviewed-by: art, serb
jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java
jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java
jdk/src/share/classes/java/awt/Component.java
jdk/src/share/classes/java/awt/Window.java
jdk/src/share/classes/java/awt/peer/ComponentPeer.java
jdk/src/share/classes/sun/awt/NullComponentPeer.java
jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Tue Oct 08 17:00:44 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Tue Oct 08 18:10:13 2013 +0400
@@ -385,11 +385,6 @@
 
     // ---- PEER METHODS ---- //
 
-    @Override
-    public Toolkit getToolkit() {
-        return LWToolkit.getLWToolkit();
-    }
-
     // Just a helper method
     public LWToolkit getLWToolkit() {
         return LWToolkit.getLWToolkit();
@@ -1010,13 +1005,13 @@
     @Override
     public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
         // TODO: is it a right/complete implementation?
-        return getToolkit().prepareImage(img, w, h, o);
+        return Toolkit.getDefaultToolkit().prepareImage(img, w, h, o);
     }
 
     @Override
     public int checkImage(Image img, int w, int h, ImageObserver o) {
         // TODO: is it a right/complete implementation?
-        return getToolkit().checkImage(img, w, h, o);
+        return Toolkit.getDefaultToolkit().checkImage(img, w, h, o);
     }
 
     @Override
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java	Tue Oct 08 17:00:44 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java	Tue Oct 08 18:10:13 2013 +0400
@@ -327,11 +327,6 @@
     }
 
     @Override
-    public Toolkit getToolkit() {
-        return Toolkit.getDefaultToolkit();
-    }
-
-    @Override
     public void handleEvent(AWTEvent e) {
     }
 
--- a/jdk/src/share/classes/java/awt/Component.java	Tue Oct 08 17:00:44 2013 +0400
+++ b/jdk/src/share/classes/java/awt/Component.java	Tue Oct 08 18:10:13 2013 +0400
@@ -1223,10 +1223,6 @@
      * be called on the toolkit thread.
      */
     final Toolkit getToolkitImpl() {
-        ComponentPeer peer = this.peer;
-        if ((peer != null) && ! (peer instanceof LightweightPeer)){
-            return peer.getToolkit();
-        }
         Container parent = this.parent;
         if (parent != null) {
             return parent.getToolkitImpl();
--- a/jdk/src/share/classes/java/awt/Window.java	Tue Oct 08 17:00:44 2013 +0400
+++ b/jdk/src/share/classes/java/awt/Window.java	Tue Oct 08 18:10:13 2013 +0400
@@ -2197,8 +2197,8 @@
      * windows.  To detect if always-on-top windows are supported by the
      * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and
      * {@link Window#isAlwaysOnTopSupported()}.  If always-on-top mode
-     * isn't supported by the toolkit or for this window, calling this
-     * method has no effect.
+     * isn't supported for this window or this window's toolkit does not
+     * support always-on-top windows, calling this method has no effect.
      * <p>
      * If a SecurityManager is installed, the calling thread must be
      * granted the AWTPermission "setWindowAlwaysOnTop" in
@@ -2211,11 +2211,13 @@
      *        windows
      * @throws SecurityException if the calling thread does not have
      *         permission to set the value of always-on-top property
+     *
      * @see #isAlwaysOnTop
      * @see #toFront
      * @see #toBack
      * @see AWTPermission
      * @see #isAlwaysOnTopSupported
+     * @see #getToolkit
      * @see Toolkit#isAlwaysOnTopSupported
      * @since 1.5
      */
@@ -2248,11 +2250,13 @@
      * window. Some platforms may not support always-on-top windows, some
      * may support only some kinds of top-level windows; for example,
      * a platform may not support always-on-top modal dialogs.
-     * @return {@code true}, if the always-on-top mode is
-     *         supported by the toolkit and for this window,
-     *         {@code false}, if always-on-top mode is not supported
-     *         for this window or toolkit doesn't support always-on-top windows.
+     *
+     * @return {@code true}, if the always-on-top mode is supported for
+     *         this window and this window's toolkit supports always-on-top windows,
+     *         {@code false} otherwise
+     *
      * @see #setAlwaysOnTop(boolean)
+     * @see #getToolkit
      * @see Toolkit#isAlwaysOnTopSupported
      * @since 1.6
      */
--- a/jdk/src/share/classes/java/awt/peer/ComponentPeer.java	Tue Oct 08 17:00:44 2013 +0400
+++ b/jdk/src/share/classes/java/awt/peer/ComponentPeer.java	Tue Oct 08 18:10:13 2013 +0400
@@ -260,15 +260,6 @@
     ColorModel getColorModel();
 
     /**
-     * Returns the toolkit that is responsible for the component.
-     *
-     * @return the toolkit that is responsible for the component
-     *
-     * @see Component#getToolkit()
-     */
-    Toolkit getToolkit();
-
-    /**
      * Returns a graphics object to paint on the component.
      *
      * @return a graphics object to paint on the component
--- a/jdk/src/share/classes/sun/awt/NullComponentPeer.java	Tue Oct 08 17:00:44 2013 +0400
+++ b/jdk/src/share/classes/sun/awt/NullComponentPeer.java	Tue Oct 08 18:10:13 2013 +0400
@@ -141,10 +141,6 @@
         return new Dimension(1,1);
     }
 
-    public java.awt.Toolkit getToolkit() {
-        return null;
-    }
-
     public ColorModel getColorModel() {
         return null;
     }
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Tue Oct 08 17:00:44 2013 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Tue Oct 08 18:10:13 2013 +0400
@@ -607,10 +607,6 @@
 
     public void layout() {}
 
-    public java.awt.Toolkit getToolkit() {
-        return Toolkit.getDefaultToolkit();
-    }
-
     void updateMotifColors(Color bg) {
         int red = bg.getRed();
         int green = bg.getGreen();
@@ -745,11 +741,11 @@
     }
 
     public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
-        return getToolkit().prepareImage(img, w, h, o);
+        return Toolkit.getDefaultToolkit().prepareImage(img, w, h, o);
     }
 
     public int checkImage(Image img, int w, int h, ImageObserver o) {
-        return getToolkit().checkImage(img, w, h, o);
+        return Toolkit.getDefaultToolkit().checkImage(img, w, h, o);
     }
 
     public Dimension preferredSize() {
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Tue Oct 08 17:00:44 2013 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Tue Oct 08 18:10:13 2013 +0400
@@ -546,9 +546,6 @@
             return null;
         }
     }
-    public java.awt.Toolkit getToolkit() {
-        return Toolkit.getDefaultToolkit();
-    }
 
     // fallback default font object
     final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12);
@@ -739,11 +736,11 @@
     }
 
     public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
-        return getToolkit().prepareImage(img, w, h, o);
+        return Toolkit.getDefaultToolkit().prepareImage(img, w, h, o);
     }
 
     public int checkImage(Image img, int w, int h, ImageObserver o) {
-        return getToolkit().checkImage(img, w, h, o);
+        return Toolkit.getDefaultToolkit().checkImage(img, w, h, o);
     }
 
     // Object overrides