changeset 7102:674e7c021c37 8u20-b15

RT-37201 [Accordion] SceneBuilder side panel not fully visible (reverted fix for RT-36868) Summary: Backed out changeset 7756cb66a166
author kcr
date Mon, 19 May 2014 12:43:37 -0700
parents 90e00dc08fe1
children 75850c2771bc b965ad2d71cf 3afb6e3979d5
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/AccordionSkin.java modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TitledPaneSkin.java
diffstat 2 files changed, 14 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/AccordionSkin.java	Mon May 19 14:31:54 2014 +0200
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/AccordionSkin.java	Mon May 19 12:43:37 2014 -0700
@@ -102,32 +102,32 @@
         }
     }
 
-
     @Override protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
-        return computePrefHeight(width, topInset, rightInset, bottomInset, leftInset);
+        double h = 0;
+        for (Node child: getChildren()) {
+            h += snapSize(child.minHeight(width));
+        }
+        return h;
     }
 
     @Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
         double h = 0;
 
         if (expandedPane != null) {
-            h += expandedPane.prefHeight(width);
+            h += expandedPane.prefHeight(-1);
         }
 
         if (previousPane != null && !previousPane.equals(expandedPane)) {
-            h += previousPane.prefHeight(width);
+            h += previousPane.prefHeight(-1);
         }
 
         for (Node child: getChildren()) {
             TitledPane pane = (TitledPane)child;
             if (!pane.equals(expandedPane) && !pane.equals(previousPane)) {
-                final Skin<?> skin = ((TitledPane)child).getSkin();
-                if (skin instanceof TitledPaneSkin) {
-                    TitledPaneSkin childSkin = (TitledPaneSkin) skin;
-                    h += childSkin.getTitleRegionSize(width);
-                } else {
-                    h += pane.prefHeight(width);
-                }
+                // The min height is the height of the TitledPane's title bar.
+                // We use the sum of all the TitledPane's title bars
+                // to compute the pref height of the accordion.
+                h += snapSize(pane.minHeight(width));
             }
         }
 
@@ -144,8 +144,8 @@
         double collapsedPanesHeight = 0;
         for (TitledPane tp : getSkinnable().getPanes()) {
             if (!tp.equals(expandedPane)) {
-                TitledPaneSkin childSkin = (TitledPaneSkin) ((TitledPane)tp).getSkin();
-                collapsedPanesHeight += snapSize(childSkin.getTitleRegionSize(w));
+                // min height is the TitledPane's title bar height.
+                collapsedPanesHeight += snapSize(tp.minHeight(-1));
             }
         }
         final double maxTitledPaneHeight = h - collapsedPanesHeight;
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TitledPaneSkin.java	Mon May 19 14:31:54 2014 +0200
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TitledPaneSkin.java	Mon May 19 12:43:37 2014 -0700
@@ -235,7 +235,7 @@
     }
 
     @Override protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
-        return computePrefHeight(width, topInset, rightInset, bottomInset, leftInset);
+        return snapSize(titleRegion.prefHeight(width));
     }
 
     @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
@@ -254,10 +254,6 @@
         return Double.MAX_VALUE;
     }
 
-    double getTitleRegionSize(double width) {
-        return snapSize(titleRegion.prefHeight(width)) + snappedTopInset() + snappedBottomInset();
-    }
-
     private double prefHeightFromAccordion = 0;
     void setMaxTitledPaneHeightForAccordion(double height) {
         this.prefHeightFromAccordion = height;