changeset 7407:1efcff018597

RT-37758 Relax restriction on creating Scene only on FX App thread Reviewed by: kcr, anthony, snorthov
author Martin Sladecek <martin.sladecek@oracle.com>
date Thu, 03 Jul 2014 09:08:28 +0200
parents a99bffdb9f5d
children fe8653e9d681
files modules/graphics/src/main/java/javafx/scene/Node.java modules/graphics/src/main/java/javafx/scene/Parent.java modules/graphics/src/main/java/javafx/scene/Scene.java modules/graphics/src/main/java/javafx/scene/SubScene.java
diffstat 4 files changed, 8 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/javafx/scene/Node.java	Thu Jul 03 09:05:30 2014 +0200
+++ b/modules/graphics/src/main/java/javafx/scene/Node.java	Thu Jul 03 09:08:28 2014 +0200
@@ -209,8 +209,8 @@
  * doesn't explicitly remove it.
  * <p>
  * Node objects may be constructed and modified on any thread as long they are
- * not yet attached to a {@link Scene}. An application must attach nodes to a
- * Scene, and modify nodes that are already attached to a Scene, on the JavaFX
+ * not yet attached to a {@code Scene} in a {@code Window} that is showing.
+ * An application must attach nodes to such a Scene or modify them on the JavaFX
  * Application Thread.
  *
  * <h4>String ID</h4>
--- a/modules/graphics/src/main/java/javafx/scene/Parent.java	Thu Jul 03 09:05:30 2014 +0200
+++ b/modules/graphics/src/main/java/javafx/scene/Parent.java	Thu Jul 03 09:08:28 2014 +0200
@@ -546,7 +546,8 @@
      * restored. An {@link IllegalArgumentException} is thrown in this case.
      *
      * <p>
-     * If this {@link Parent} node is attached to a {@link Scene}, then its
+     * If this {@link Parent} node is attached to a {@link Scene} attached to a {@link Window}
+     * that is showning ({@link javafx.stage.Window#isShowing()}), then its
      * list of children must only be modified on the JavaFX Application Thread.
      * An {@link IllegalStateException} is thrown if this restriction is
      * violated.
--- a/modules/graphics/src/main/java/javafx/scene/Scene.java	Thu Jul 03 09:05:30 2014 +0200
+++ b/modules/graphics/src/main/java/javafx/scene/Scene.java	Thu Jul 03 09:08:28 2014 +0200
@@ -174,8 +174,6 @@
      *
      * @param root The root node of the scene graph
      *
-     * @throws IllegalStateException if this constructor is called on a thread
-     * other than the JavaFX Application Thread.
      * @throws NullPointerException if root is null
      */
     public Scene(@NamedArg("root") Parent root) {
@@ -205,8 +203,6 @@
      * @param width The width of the scene
      * @param height The height of the scene
      *
-     * @throws IllegalStateException if this constructor is called on a thread
-     * other than the JavaFX Application Thread.
      * @throws NullPointerException if root is null
      */
     public Scene(@NamedArg("root") Parent root, @NamedArg("width") double width, @NamedArg("height") double height) {
@@ -219,8 +215,6 @@
      * @param root The parent
      * @param fill The fill
      *
-     * @throws IllegalStateException if this constructor is called on a thread
-     * other than the JavaFX Application Thread.
      * @throws NullPointerException if root is null
      */
     public Scene(@NamedArg("root") Parent root, @NamedArg(value="fill", defaultValue="WHITE") Paint fill) {
@@ -235,8 +229,6 @@
      * @param height The height of the scene
      * @param fill The fill
      *
-     * @throws IllegalStateException if this constructor is called on a thread
-     * other than the JavaFX Application Thread.
      * @throws NullPointerException if root is null
      */
     public Scene(@NamedArg("root") Parent root, @NamedArg("width") double width, @NamedArg("height") double height,
@@ -258,8 +250,6 @@
      * {@link javafx.application.ConditionalFeature#SCENE3D ConditionalFeature.SCENE3D}
      * for more information.
      *
-     * @throws IllegalStateException if this constructor is called on a thread
-     * other than the JavaFX Application Thread.
      * @throws NullPointerException if root is null
      *
      * @see javafx.scene.Node#setDepthTest(DepthTest)
@@ -272,6 +262,10 @@
      * Constructs a scene consisting of a root, with a dimension of width and
      * height, specifies whether a depth buffer is created for this scene and
      * specifies whether scene anti-aliasing is requested.
+     * <p>
+     * A Scene can be created and modified on any thread until it is attached to a {@code Window} that is showing
+     * ({@link javafx.stage.Window#isShowing()}. This does not mean the Scene is thread-safe,
+     * so manipulation from multiple threads at the same time is illegal, may lead to unexpected results and must be avoided.
      *
      * @param root The root node of the scene graph
      * @param width The width of the scene
@@ -285,8 +279,6 @@
      * {@link javafx.application.ConditionalFeature#SCENE3D ConditionalFeature.SCENE3D}
      * for more information.
      *
-     * @throws IllegalStateException if this constructor is called on a thread
-     * other than the JavaFX Application Thread.
      * @throws NullPointerException if root is null
      *
      * @see javafx.scene.Node#setDepthTest(DepthTest)
--- a/modules/graphics/src/main/java/javafx/scene/SubScene.java	Thu Jul 03 09:05:30 2014 +0200
+++ b/modules/graphics/src/main/java/javafx/scene/SubScene.java	Thu Jul 03 09:08:28 2014 +0200
@@ -93,8 +93,6 @@
      * @param width The width of the sub-scene
      * @param height The height of the sub-scene
      *
-     * @throws IllegalStateException if this constructor is called on a thread
-     * other than the JavaFX Application Thread.
      * @throws NullPointerException if root is null
      */
     public SubScene(@NamedArg("root") Parent root, @NamedArg("width") double width, @NamedArg("height") double height) {
@@ -118,8 +116,6 @@
      * See {@link javafx.application.ConditionalFeature#SCENE3D ConditionalFeature.SCENE3D}
      * for more information.
      *
-     * @throws IllegalStateException if this constructor is called on a thread
-     * other than the JavaFX Application Thread.
      * @throws NullPointerException if root is null
      *
      * @see javafx.scene.Node#setDepthTest(DepthTest)