changeset 1759:f4a628d009e0 2.2.55-b04

RT-35138: Laminar flow for FX windows Reviewed-by: Anthony Petrov, Martin Sladecek, Mark Howe, Chris Ries, Alexander Fomin
author kcr
date Mon, 13 Jan 2014 13:52:00 -0800
parents 98f81487b039
children 5f24c0787b87
files javafx-ui-common/src/com/sun/javafx/stage/StageHelper.java javafx-ui-common/src/com/sun/javafx/tk/DummyToolkit.java javafx-ui-common/src/com/sun/javafx/tk/Toolkit.java javafx-ui-common/src/javafx/stage/Stage.java test-stub-toolkit/src/com/sun/javafx/pgstub/StubToolkit.java
diffstat 5 files changed, 56 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-common/src/com/sun/javafx/stage/StageHelper.java	Tue Jan 07 08:55:05 2014 -0800
+++ b/javafx-ui-common/src/com/sun/javafx/stage/StageHelper.java	Mon Jan 13 13:52:00 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, 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
@@ -37,7 +37,8 @@
     private static StageAccessor stageAccessor;
 
     public static interface StageAccessor {
-          public ObservableList<Stage> getStages();
+        public ObservableList<Stage> getStages();
+        public void initSecurityDialog(Stage stage, boolean securityDialog);
     }
 
     /**
@@ -60,6 +61,10 @@
         return stageAccessor.getStages();
     }
 
+    public static void initSecurityDialog(Stage stage, boolean securityDialog) {
+        stageAccessor.initSecurityDialog(stage, securityDialog);
+    }
+
     public static void setStageAccessor(StageAccessor a) {
         if (stageAccessor != null) {
             System.out.println("Warning: Stage accessor already set: " + stageAccessor);
--- a/javafx-ui-common/src/com/sun/javafx/tk/DummyToolkit.java	Tue Jan 07 08:55:05 2014 -0800
+++ b/javafx-ui-common/src/com/sun/javafx/tk/DummyToolkit.java	Mon Jan 13 13:52:00 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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
@@ -116,7 +116,7 @@
     }
 
     @Override
-    public TKStage createTKStage(StageStyle stageStyle, boolean primary, Modality modality, TKStage owner) {
+    public TKStage createTKStage(boolean securityDialog, StageStyle stageStyle, boolean primary, Modality modality, TKStage owner) {
         throw new UnsupportedOperationException("Not supported yet.");
     }
 
--- a/javafx-ui-common/src/com/sun/javafx/tk/Toolkit.java	Tue Jan 07 08:55:05 2014 -0800
+++ b/javafx-ui-common/src/com/sun/javafx/tk/Toolkit.java	Mon Jan 13 13:52:00 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, 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
@@ -325,7 +325,7 @@
     public abstract void exitNestedEventLoop(Object key, Object rval);
 
     public abstract TKStage createTKStage(StageStyle stageStyle);
-    public abstract TKStage createTKStage(StageStyle stageStyle, boolean primary,
+    public abstract TKStage createTKStage(boolean securityDialog, StageStyle stageStyle, boolean primary,
             Modality modality, TKStage owner);
 
     public abstract TKStage createTKPopupStage(StageStyle stageStyle, Object owner);
--- a/javafx-ui-common/src/javafx/stage/Stage.java	Tue Jan 07 08:55:05 2014 -0800
+++ b/javafx-ui-common/src/javafx/stage/Stage.java	Mon Jan 13 13:52:00 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, 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
@@ -168,6 +168,9 @@
             @Override public ObservableList<Stage> getStages() {
                 return stages;
             }
+            @Override public void initSecurityDialog(Stage stage, boolean securityDialog) {
+                stage.initSecurityDialog(securityDialog);
+            }
         });
     }
     
@@ -222,7 +225,7 @@
     @Override final public void setScene(Scene value) {
         super.setScene(value);
     }
-    
+
     /**
      * @inheritDoc
      */
@@ -232,6 +235,43 @@
     
     private boolean primary = false;
 
+    ////////////////////////////////////////////////////////////////////
+
+    // Flag indicating that this stage is being used to show a security dialog
+    private boolean securityDialog = false;
+
+    /**
+     * Sets a flag indicating that this stage is used for a security dialog and
+     * must always be on top. If set, this will cause the window to be always
+     * on top, regardless of the setting of the alwaysOnTop property, and
+     * whether or not all permissions are granted when the dialog is shown.
+     * NOTE: this flag must be set prior to showing the stage the first time.
+     *
+     * @param securityDialog flag indicating that this Stage is being used to
+     * show a security dialog that should be always-on-top
+     *
+     * @throws IllegalStateException if this property is set after the stage
+     * has ever been made visible.
+     *
+     * @defaultValue false
+     */
+    final void initSecurityDialog(boolean securityDialog) {
+        if (hasBeenVisible) {
+            throw new IllegalStateException("Cannot set securityDialog once stage has been set visible");
+        }
+
+        this.securityDialog = securityDialog;
+    }
+
+    /**
+     * Returns the state of the securityDialog flag.
+     *
+     * @return a flag indicating whether or not this is a security dialog
+     */
+    final boolean isSecurityDialog() {
+        return securityDialog;
+    }
+
     /**
      * sets this stage to be the primary stage.
      * When run as an applet, this stage will appear in the broswer
@@ -938,7 +978,7 @@
                     }
                 }
             }
-            impl_peer = toolkit.createTKStage(stageStyle, isPrimary(),
+            impl_peer = toolkit.createTKStage(isSecurityDialog(), stageStyle, isPrimary(),
                     getModality(), tkStage);
             peerListener = new StagePeerListener(this, STAGE_ACCESSOR);
             
--- a/test-stub-toolkit/src/com/sun/javafx/pgstub/StubToolkit.java	Tue Jan 07 08:55:05 2014 -0800
+++ b/test-stub-toolkit/src/com/sun/javafx/pgstub/StubToolkit.java	Mon Jan 13 13:52:00 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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
@@ -169,7 +169,7 @@
         return new StubStage();
     }
 
-    public TKStage createTKStage(StageStyle stageStyle, boolean primary,
+    public TKStage createTKStage(boolean securityDialog, StageStyle stageStyle, boolean primary,
             Modality modality, TKStage owner) {
 
         return new StubStage();