changeset 7924:f8b58635d604

[SCENEBUILDER] Some other preparatory work to ease migration to SubScene. Added Deprecation.localToLocal() routines and use them everywhere possible. This routine shields the rootScene / not rootScene question.
author Eric Le Ponner <eric.le.ponner@oracle.com>
date Fri, 05 Sep 2014 12:32:05 +0200
parents 24cc8bd39913
children 0d65ca9c3cef
files apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/AbstractDecoration.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TabPaneDesignInfoX.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TableViewDesignInfoX.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TreeTableViewDesignInfoX.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/handles/TabHandles.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/tring/GenericParentTring.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/inspector/InspectorPanelController.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/util/Deprecation.java
diffstat 8 files changed, 28 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/AbstractDecoration.java	Fri Sep 05 10:39:44 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/AbstractDecoration.java	Fri Sep 05 12:32:05 2014 +0200
@@ -32,6 +32,7 @@
 package com.oracle.javafx.scenebuilder.kit.editor.panel.content;
 
 import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject;
+import com.oracle.javafx.scenebuilder.kit.util.Deprecation;
 
 import javafx.beans.value.ChangeListener;
 import javafx.geometry.Bounds;
@@ -164,7 +165,7 @@
     
     public Point2D sceneGraphObjectToDecoration(double x, double y) {
         final Node proxy = getSceneGraphObjectProxy();
-        return getRootNode().sceneToLocal(proxy.localToScene(x, y, true /* rootScene */));
+        return Deprecation.localToLocal(proxy, x, y, getRootNode());
     }
             
     protected void startListeningToLayoutBounds(Node node) {
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TabPaneDesignInfoX.java	Fri Sep 05 10:39:44 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TabPaneDesignInfoX.java	Fri Sep 05 12:32:05 2014 +0200
@@ -31,6 +31,7 @@
  */
 package com.oracle.javafx.scenebuilder.kit.editor.panel.content.driver;
 
+import com.oracle.javafx.scenebuilder.kit.util.Deprecation;
 import com.sun.javafx.scene.control.skin.TabPaneSkin;
 import java.util.Iterator;
 import java.util.Set;
@@ -178,8 +179,8 @@
         final Bounds b = tabNode.getLayoutBounds();
 
         // Convert b from tabNode local space to tabPane local space
-        final Point2D min = tabPane.sceneToLocal(tabNode.localToScene(b.getMinX(), b.getMinY()));
-        final Point2D max = tabPane.sceneToLocal(tabNode.localToScene(b.getMaxX(), b.getMaxY()));
+        final Point2D min = Deprecation.localToLocal(tabNode, b.getMinX(), b.getMinY(), tabPane);
+        final Point2D max = Deprecation.localToLocal(tabNode, b.getMaxX(), b.getMaxY(), tabPane);
         return makeBoundingBox(min, max);
     }
     
@@ -190,8 +191,8 @@
         final Bounds b = contentNode.getLayoutBounds();
         
         // Convert b from contentNode local space to tabPane local space
-        final Point2D min = tabPane.sceneToLocal(contentNode.localToScene(b.getMinX(), b.getMinY()));
-        final Point2D max = tabPane.sceneToLocal(contentNode.localToScene(b.getMaxX(), b.getMaxY()));
+        final Point2D min = Deprecation.localToLocal(contentNode, b.getMinX(), b.getMinY(), tabPane);
+        final Point2D max = Deprecation.localToLocal(contentNode, b.getMaxX(), b.getMaxY(), tabPane);
         return makeBoundingBox(min, max);
     }
     
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TableViewDesignInfoX.java	Fri Sep 05 10:39:44 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TableViewDesignInfoX.java	Fri Sep 05 12:32:05 2014 +0200
@@ -31,6 +31,7 @@
  */
 package com.oracle.javafx.scenebuilder.kit.editor.panel.content.driver;
 
+import com.oracle.javafx.scenebuilder.kit.util.Deprecation;
 import com.sun.javafx.scene.control.skin.TableColumnHeader;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -85,7 +86,7 @@
     public Bounds getColumnHeaderBounds(TableColumn<?,?> tableColumn) {
         final TableView<?> tv = tableColumn.getTableView();
         final Node hn = getColumnNode(tableColumn);
-        return tv.sceneToLocal(hn.localToScene(hn.getLayoutBounds()));
+        return Deprecation.localToLocal(hn, hn.getLayoutBounds(), tv);
     }
     
     
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TreeTableViewDesignInfoX.java	Fri Sep 05 10:39:44 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TreeTableViewDesignInfoX.java	Fri Sep 05 12:32:05 2014 +0200
@@ -31,6 +31,7 @@
  */
 package com.oracle.javafx.scenebuilder.kit.editor.panel.content.driver;
 
+import com.oracle.javafx.scenebuilder.kit.util.Deprecation;
 import com.sun.javafx.scene.control.skin.TableColumnHeader;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -85,7 +86,7 @@
     public Bounds getColumnHeaderBounds(TreeTableColumn<?,?> treeTableColumn) {
         final TreeTableView<?> tv = treeTableColumn.getTreeTableView();
         final Node hn = getColumnNode(treeTableColumn);
-        return tv.sceneToLocal(hn.localToScene(hn.getLayoutBounds()));
+        return Deprecation.localToLocal(hn, hn.getLayoutBounds(), tv);
     }
     
     
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/handles/TabHandles.java	Fri Sep 05 10:39:44 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/handles/TabHandles.java	Fri Sep 05 12:32:05 2014 +0200
@@ -43,6 +43,7 @@
 import com.oracle.javafx.scenebuilder.kit.editor.panel.content.driver.TabPaneDesignInfoX;
 import com.oracle.javafx.scenebuilder.kit.editor.panel.content.util.BoundsUtils;
 import com.oracle.javafx.scenebuilder.kit.fxom.FXOMInstance;
+import com.oracle.javafx.scenebuilder.kit.util.Deprecation;
 
 /**
  *
@@ -95,8 +96,8 @@
 
         // Convert tabNode bounds from tabNode local space to tabPane local space
         final Bounds b = tabNode.getLayoutBounds();
-        final Point2D min = tabPane.sceneToLocal(tabNode.localToScene(b.getMinX(), b.getMinY()));
-        final Point2D max = tabPane.sceneToLocal(tabNode.localToScene(b.getMaxX(), b.getMaxY()));
+        final Point2D min = Deprecation.localToLocal(tabNode, b.getMinX(), b.getMinY(), tabPane);
+        final Point2D max = Deprecation.localToLocal(tabNode, b.getMaxX(), b.getMaxY(), tabPane);
         
         return BoundsUtils.makeBounds(min, max);
     }
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/tring/GenericParentTring.java	Fri Sep 05 10:39:44 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/tring/GenericParentTring.java	Fri Sep 05 12:32:05 2014 +0200
@@ -35,6 +35,7 @@
 import com.oracle.javafx.scenebuilder.kit.fxom.FXOMInstance;
 import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject;
 import com.oracle.javafx.scenebuilder.kit.metadata.util.DesignHierarchyMask;
+import com.oracle.javafx.scenebuilder.kit.util.Deprecation;
 import com.oracle.javafx.scenebuilder.kit.util.MathUtils;
 import javafx.geometry.BoundingBox;
 import javafx.geometry.Bounds;
@@ -261,8 +262,8 @@
             // m.getFxomObject() is a skinned component : so its fxom children
             // are not the direct Node children.
             if (skinParent != null) {
-                final Point2D p0 = parent.sceneToLocal(skinParent.localToScene(crackX, crackY0));
-                final Point2D p1 = parent.sceneToLocal(skinParent.localToScene(crackX, crackY1));
+                final Point2D p0 = Deprecation.localToLocal(skinParent, crackX, crackY0, parent);
+                final Point2D p1 = Deprecation.localToLocal(skinParent, crackX, crackY1, parent);
                 assert MathUtils.equals(p0.getX(), p1.getX());
                 pCrackX = p0.getX();
                 pCrackY0 = p0.getY();
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/inspector/InspectorPanelController.java	Fri Sep 05 10:39:44 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/inspector/InspectorPanelController.java	Fri Sep 05 12:32:05 2014 +0200
@@ -2232,7 +2232,7 @@
         // Position the scrollBar such as the editor is centered in the TitledPane (when possible)
         final ScrollPane scrollPane = sp;
         double editorHeight = valueEditorNode.getLayoutBounds().getHeight();
-        final Point2D pt = scrollPane.getContent().sceneToLocal(valueEditorNode.localToScene(0, 0));
+        final Point2D pt = Deprecation.localToLocal(valueEditorNode, 0, 0, scrollPane.getContent());
         // viewport height
         double vpHeight = scrollPane.getViewportBounds().getHeight();
         // Position of the editor in the scrollPane content
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/util/Deprecation.java	Fri Sep 05 10:39:44 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/util/Deprecation.java	Fri Sep 05 12:32:05 2014 +0200
@@ -261,5 +261,15 @@
     // using it would break ability to compile over JDK 8 GA, not an option for now.
     public static int getNodeLevel(TreeItem<?> item) {
         return TreeView.getNodeLevel(item);
+    } 
+    
+    public static Point2D localToLocal(Node source, double sourceX, double sourceY, Node target) {
+        final Point2D sceneXY = source.localToScene(sourceX, sourceY, true /* rootScene */);
+        return target.sceneToLocal(sceneXY, true /* rootScene */);
+    }
+    
+    public static Bounds localToLocal(Node source, Bounds sourceBounds, Node target) {
+        final Bounds sceneBounds = source.localToScene(sourceBounds, true /* rootScene */);
+        return target.sceneToLocal(sceneBounds, true /* rootScene */);
     }
 }