changeset 7074:90b67c9a7eb2

7161575: [macosx] On MacOSX port java.awt.Toolkit.is/setDynamicLayout() are not consistent Reviewed-by: anthony, art
author serb
date Mon, 06 May 2013 16:23:36 +0400
parents c357c11f076f
children 7982299cd11c
files src/macosx/classes/sun/lwawt/LWToolkit.java
diffstat 1 files changed, 39 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/LWToolkit.java	Wed May 01 09:20:08 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/LWToolkit.java	Mon May 06 16:23:36 2013 +0400
@@ -53,7 +53,12 @@
     private Clipboard clipboard;
     private MouseInfoPeer mouseInfoPeer;
 
-    public LWToolkit() {
+    /**
+     * Dynamic Layout Resize client code setting.
+     */
+    private volatile boolean dynamicLayoutSetting = true;
+
+    protected LWToolkit() {
     }
 
     /*
@@ -561,4 +566,37 @@
             ((LWWindowPeer)w.getPeer()).ungrab(false);
         }
     }
+
+    @Override
+    protected final Object lazilyLoadDesktopProperty(final String name) {
+        if (name.equals("awt.dynamicLayoutSupported")) {
+            return isDynamicLayoutSupported();
+        }
+        return super.lazilyLoadDesktopProperty(name);
+    }
+
+    @Override
+    public final void setDynamicLayout(final boolean dynamic) {
+        dynamicLayoutSetting = dynamic;
+    }
+
+    @Override
+    protected final boolean isDynamicLayoutSet() {
+        return dynamicLayoutSetting;
+    }
+
+    @Override
+    public final boolean isDynamicLayoutActive() {
+        // "Live resizing" is active by default and user's data is ignored.
+        return isDynamicLayoutSupported();
+    }
+
+    /**
+     * Returns true if dynamic layout of Containers on resize is supported by
+     * the underlying operating system and/or window manager.
+     */
+    protected final boolean isDynamicLayoutSupported() {
+        // "Live resizing" is supported by default.
+        return true;
+    }
 }