changeset 7990:0d65ca9c3cef

[SCENEBUILDER] Last (?) preparatory work to ease migration to SubScene. Transforms calls to Node.localToScene(Bounds) as calls to Node.localToScene(Bounds, Boolean).
author Eric Le Ponner <eric.le.ponner@oracle.com>
date Fri, 05 Sep 2014 12:47:32 +0200
parents f8b58635d604
children 331e07041d90
files apps/scenebuilder/SceneBuilderApp/src/com/oracle/javafx/scenebuilder/app/SceneBuilderTest.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/job/atomic/RelocateNodeJob.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/AbstractNodeDriver.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TabDriver.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TableColumnDriver.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TreeTableColumnDriver.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/gesture/DragGesture.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/guides/MovingGuideController.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/guides/MovingGuideRenderer.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/guides/ResizingGuideController.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/treeview/HierarchyTreeCell.java
diffstat 12 files changed, 19 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/apps/scenebuilder/SceneBuilderApp/src/com/oracle/javafx/scenebuilder/app/SceneBuilderTest.java	Fri Sep 05 12:32:05 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderApp/src/com/oracle/javafx/scenebuilder/app/SceneBuilderTest.java	Fri Sep 05 12:47:32 2014 +0200
@@ -186,7 +186,7 @@
             final Bounds b = node.getLayoutBounds();
             final double midX = (b.getMinX() + b.getMaxX()) / 2.0;
             final double midY = (b.getMinY() + b.getMaxY()) / 2.0;
-            final Point2D nodeCenter = node.localToScene(midX, midY);
+            final Point2D nodeCenter = node.localToScene(midX, midY, true /* rootScene */);
             
             final ContentPanelController cpc = dwc.getContentPanelController();
             result = cpc.searchWithNode(node, nodeCenter.getX(), nodeCenter.getY());
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/job/atomic/RelocateNodeJob.java	Fri Sep 05 12:32:05 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/job/atomic/RelocateNodeJob.java	Fri Sep 05 12:47:32 2014 +0200
@@ -77,8 +77,8 @@
         assert fxomInstance.getSceneGraphObject() instanceof Node;
         
         this.fxomInstance = fxomInstance;
-        this.newLayoutX = newLayoutX;
-        this.newLayoutY = newLayoutY;
+        this.newLayoutX = newLayoutX; // Root scene coordinates
+        this.newLayoutY = newLayoutY; // Root scene coordinates
         
         final Metadata metadata = Metadata.getMetadata();
         final Class<?> sgoClass = fxomInstance.getSceneGraphObject().getClass();
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java	Fri Sep 05 12:32:05 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java	Fri Sep 05 12:47:32 2014 +0200
@@ -123,6 +123,8 @@
 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 javafx.geometry.BoundingBox;
+import javafx.geometry.Point2D;
 
 /**
  * This class creates and controls the <b>Content Panel</b> of Scene Builder Kit.
@@ -365,14 +367,14 @@
                 final FXOMObject nodeFxomObject = mask.getClosestFxNode();
                 if (nodeFxomObject != null) {
                     final Node node = (Node) nodeFxomObject.getSceneGraphObject();
-                    union.add(node.localToScene(node.getLayoutBounds()));
+                    union.add(node.localToScene(node.getLayoutBounds(), true /* rootScene */));
                 }
             }
         }
 
         if (union.getResult() != null) {
             final Node content = scrollPane.getContent();
-            final Bounds enclosing = content.sceneToLocal(union.getResult());
+            final Bounds enclosing = content.sceneToLocal(union.getResult(), true /* rootScene */);
             final ScrollPaneBooster spb = new ScrollPaneBooster(scrollPane);
             spb.scrollTo(enclosing);
         }
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/AbstractNodeDriver.java	Fri Sep 05 12:32:05 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/AbstractNodeDriver.java	Fri Sep 05 12:47:32 2014 +0200
@@ -198,10 +198,11 @@
     public boolean intersectsBounds(FXOMObject fxomObject, Bounds bounds) {
         assert fxomObject.getSceneGraphObject() instanceof Node;
         
+        // Note: bounds are in root scene coordinates
         final Node sceneGraphNode 
                 = (Node) fxomObject.getSceneGraphObject();
         final Bounds sceneGraphNodeBounds 
-                = sceneGraphNode.localToScene(sceneGraphNode.getLayoutBounds());
+                = sceneGraphNode.localToScene(sceneGraphNode.getLayoutBounds(), true /* rootScene */);
 
         return sceneGraphNodeBounds.intersects(bounds);
     }
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TabDriver.java	Fri Sep 05 12:32:05 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TabDriver.java	Fri Sep 05 12:47:32 2014 +0200
@@ -119,7 +119,7 @@
             final TabPane tabPane
                     = tab.getTabPane();
             final Bounds sceneGraphNodeBounds 
-                    = tabPane.localToScene(tabPane.getLayoutBounds());
+                    = tabPane.localToScene(tabPane.getLayoutBounds(), true /* rootScene */);
             result = sceneGraphNodeBounds.intersects(bounds);
         } else {
             result = false;
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TableColumnDriver.java	Fri Sep 05 12:32:05 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TableColumnDriver.java	Fri Sep 05 12:47:32 2014 +0200
@@ -117,7 +117,7 @@
         final TableColumn<?,?> tc = (TableColumn<?,?>) fxomObject.getSceneGraphObject();
         final TableView<?> tv = tc.getTableView();
         final TableViewDesignInfoX di = new TableViewDesignInfoX();
-        final Bounds tcBounds = tv.localToScene(di.getColumnBounds(tc));
+        final Bounds tcBounds = tv.localToScene(di.getColumnBounds(tc), true /* rootScene */);
         
         return tcBounds.intersects(bounds);
     }
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TreeTableColumnDriver.java	Fri Sep 05 12:32:05 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/TreeTableColumnDriver.java	Fri Sep 05 12:47:32 2014 +0200
@@ -121,7 +121,7 @@
         final TreeTableViewDesignInfoX di 
                 = new TreeTableViewDesignInfoX();
         final Bounds tcBounds 
-                = tv.localToScene(di.getColumnBounds(tc));
+                = tv.localToScene(di.getColumnBounds(tc), true /* rootScene */);
         
         return tcBounds.intersects(bounds);
     }
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/gesture/DragGesture.java	Fri Sep 05 12:32:05 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/gesture/DragGesture.java	Fri Sep 05 12:47:32 2014 +0200
@@ -346,7 +346,7 @@
         if (movingGuideController.hasSampleBounds() && (guidesDisabled == false)) {
             updateShadow(hitX, hitY);
             final Bounds shadowBounds = shadow.getLayoutBounds();
-            final Bounds shadowBoundsInScene = shadow.localToScene(shadowBounds);
+            final Bounds shadowBoundsInScene = shadow.localToScene(shadowBounds, true /* rootScene */);
             movingGuideController.match(shadowBoundsInScene);
             
             guidedX = hitX + movingGuideController.getSuggestedDX();
@@ -472,7 +472,7 @@
     
     private void setupMovingGuideController() {
         final Bounds scope = contentPanelController.getWorkspacePane().getLayoutBounds();
-        final Bounds scopeInScene = contentPanelController.getWorkspacePane().localToScene(scope);
+        final Bounds scopeInScene = contentPanelController.getWorkspacePane().localToScene(scope, true /* rootScene */);
         this.movingGuideController = new MovingGuideController(
                 contentPanelController.getGuidesColor(), scopeInScene);
         final Group rudderLayer = contentPanelController.getRudderLayer();
@@ -507,7 +507,7 @@
         final Bounds hitParentBounds = hitParentNode.getLayoutBounds();
         final Bounds insetBounds = BoundsUtils.inset(hitParentBounds, MARGIN, MARGIN);
         if (insetBounds.isEmpty() == false) {
-            final Bounds insetBoundsInScene = hitParentNode.localToScene(insetBounds);
+            final Bounds insetBoundsInScene = hitParentNode.localToScene(insetBounds, true /* rootScene */);
             movingGuideController.addSampleBounds(insetBoundsInScene, false /* addMiddle */);
         }
     }    
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/guides/MovingGuideController.java	Fri Sep 05 12:32:05 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/guides/MovingGuideController.java	Fri Sep 05 12:47:32 2014 +0200
@@ -62,7 +62,7 @@
         assert node.getScene() != null;
         
         final Bounds layoutBounds = node.getLayoutBounds();
-        final Bounds boundsInScene = node.localToScene(layoutBounds);
+        final Bounds boundsInScene = node.localToScene(layoutBounds, true /* rootScene */);
         addSampleBounds(boundsInScene, true /* addMiddle */);
     }
     
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/guides/MovingGuideRenderer.java	Fri Sep 05 12:32:05 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/guides/MovingGuideRenderer.java	Fri Sep 05 12:47:32 2014 +0200
@@ -88,7 +88,7 @@
             chrome.setVisible(false);
         }
         
-        final Bounds scope = guideGroup.sceneToLocal(scopeInScene);
+        final Bounds scope = guideGroup.sceneToLocal(scopeInScene, true /* rootScene */);
         for (AbstractSegment s : newLines) {
             final Line chrome;
             if (reusableChromes.isEmpty()) {
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/guides/ResizingGuideController.java	Fri Sep 05 12:32:05 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/guides/ResizingGuideController.java	Fri Sep 05 12:47:32 2014 +0200
@@ -74,7 +74,7 @@
         assert node.getScene() != null;
         
         final Bounds layoutBounds = node.getLayoutBounds();
-        final Bounds boundsInScene = node.localToScene(layoutBounds);
+        final Bounds boundsInScene = node.localToScene(layoutBounds, true /* rootScene */);
         final double minX = boundsInScene.getMinX();
         final double minY = boundsInScene.getMinY();
         final double maxX = boundsInScene.getMaxX();
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/treeview/HierarchyTreeCell.java	Fri Sep 05 12:32:05 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/treeview/HierarchyTreeCell.java	Fri Sep 05 12:47:32 2014 +0200
@@ -231,7 +231,7 @@
             final TreeItem<HierarchyItem> treeItem
                     = HierarchyTreeCell.this.getTreeItem();
             final Bounds bounds = HierarchyTreeCell.this.getLayoutBounds();
-            final Point2D point = HierarchyTreeCell.this.localToScene(bounds.getMinX(), bounds.getMinY());
+            final Point2D point = HierarchyTreeCell.this.localToScene(bounds.getMinX(), bounds.getMinY(), true /* rootScene */);
             final DroppingMouseLocation location;
             if (event.getSceneY() <= point.getY()) {
                 location = DroppingMouseLocation.TOP;