changeset 7967:4fd7ffb45afb

[SCENEBUILDER] Fix for DTL-6817 (SB should resolve lookups defined in a .root style class).
author Eric Le Ponner <eric.le.ponner@oracle.com>
date Thu, 11 Sep 2014 12:16:47 +0200
parents ee31427caf20
children 4b422b9d2145
files apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMRefresher.java
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMRefresher.java	Wed Sep 10 13:06:51 2014 -0600
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMRefresher.java	Thu Sep 11 12:16:47 2014 +0200
@@ -41,6 +41,7 @@
 import java.io.PrintWriter;
 import java.util.List;
 import java.util.Set;
+import javafx.scene.Parent;
 import javafx.scene.control.SplitPane;
 
 /**
@@ -90,11 +91,18 @@
      */
     
     private void refreshDocument(FXOMDocument currentDocument, FXOMDocument newDocument) {
-//        if (currentDocument.getSceneGraphRoot() instanceof Parent) {
-//            reloadStylesheets((Parent)currentDocument.getRootObject());
-//        }
+        
+        // Transfers scene graph object from newDocument to currentDocument
         currentDocument.setSceneGraphRoot(newDocument.getSceneGraphRoot());
         
+        // Simulates Scene's behavior : automatically adds "root" styleclass if
+        // if the scene graph root is a Parent instance
+        if (currentDocument.getSceneGraphRoot() instanceof Parent) {
+            final Parent rootParent = (Parent) currentDocument.getSceneGraphRoot();
+            rootParent.getStyleClass().add(0, "root");
+        }
+        
+        // Recurses
         if (currentDocument.getFxomRoot() != null) {
             refreshFxomObject(currentDocument.getFxomRoot(), newDocument.getFxomRoot());
         }