changeset 1413:d48861b45651

RT-23063: Nested SplitPand rendering issue.
author Kinsley Wong
date Thu, 05 Jul 2012 13:25:39 -0700
parents 9d0660e793f6
children 2e3e8a90f8c0 0122996d25d3
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/SplitPaneSkin.java javafx-ui-controls/test/javafx/scene/control/SplitPaneTest.java
diffstat 2 files changed, 38 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/SplitPaneSkin.java	Thu Jul 05 11:33:33 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/SplitPaneSkin.java	Thu Jul 05 13:25:39 2012 -0700
@@ -525,8 +525,10 @@
     private boolean resize = false;
     private boolean checkDividerPos = true;
 
-    @Override protected void layoutChildren() {     
-        if (!getSkinnable().isVisible() || (horizontal ? getWidth() == 0 : getHeight() == 0)) {
+    @Override protected void layoutChildren() {
+        if (!getSkinnable().isVisible() || 
+            (horizontal ? getWidth() == 0 : getHeight() == 0) ||
+            contentRegions.isEmpty()) {
             return;
         }
         
--- a/javafx-ui-controls/test/javafx/scene/control/SplitPaneTest.java	Thu Jul 05 11:33:33 2012 -0700
+++ b/javafx-ui-controls/test/javafx/scene/control/SplitPaneTest.java	Thu Jul 05 13:25:39 2012 -0700
@@ -9,6 +9,7 @@
 import com.sun.javafx.pgstub.StubToolkit;
 import com.sun.javafx.scene.control.skin.SplitPaneSkin;
 import com.sun.javafx.tk.Toolkit;
+import javafx.application.Platform;
 import javafx.beans.property.DoubleProperty;
 import javafx.beans.property.ObjectProperty;
 import javafx.beans.property.SimpleDoubleProperty;
@@ -1248,4 +1249,37 @@
         assertEquals(0, sp3.getLayoutBounds().getWidth(), 1e-100);
         assertEquals(190, sp4.getLayoutBounds().getWidth(), 1e-100);
     }    
+    
+    @Test public void addItemsInRunLater_RT23063() {
+        final SplitPane sp = new SplitPane();
+        Stage st = new Stage();
+        st.setScene(new Scene(sp, 2000, 2000));
+        st.show();
+           
+        Runnable runnable = new Runnable() {
+            @Override
+            public void run() {
+                StackPane rightsp = new StackPane();
+                Label right = new Label("right");
+                rightsp.getChildren().add(right);
+                
+                StackPane leftsp = new StackPane();
+                Label left = new Label("left");
+                leftsp.getChildren().add(left);
+                
+                sp.getItems().addAll(rightsp, leftsp);
+            }
+        };
+        Platform.runLater(runnable);
+                        
+        sp.impl_reapplyCSS();
+        sp.resize(400, 400);
+        sp.layout();
+        
+        assertEquals(1, sp.getDividerPositions().length);
+        
+        double pos[] = sp.getDividerPositions();
+        double p0 = convertDividerPostionToAbsolutePostion(pos[0], 398);
+        assertEquals(196, p0, 1e-100);        
+    }    
 }