changeset 6472:4b447b1a4130

RT-36159 [FlowPane, TitledPane] Preferred size of FlowPane with wrapped and unwrapped content seems to be the same if within TitledPane Reviewed by: jgiles
author Martin Sladecek <martin.sladecek@oracle.com>
date Thu, 13 Mar 2014 08:43:52 +0100
parents bdfad1c1aebe
children b873fbebaf0d
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TitledPaneSkin.java modules/controls/src/main/java/javafx/scene/control/TitledPane.java
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TitledPaneSkin.java	Thu Mar 13 08:41:34 2014 +0100
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TitledPaneSkin.java	Thu Mar 13 08:43:52 2014 +0100
@@ -240,7 +240,9 @@
     }
 
     @Override protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
-        return computePrefWidth(height, topInset, rightInset, bottomInset, leftInset);
+        double titleWidth = snapSize(titleRegion.prefWidth(height));
+        double contentWidth = snapSize(contentContainer.minWidth(height));
+        return Math.max(titleWidth, contentWidth) + leftInset + rightInset;
     }
 
     @Override protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
--- a/modules/controls/src/main/java/javafx/scene/control/TitledPane.java	Thu Mar 13 08:41:34 2014 +0100
+++ b/modules/controls/src/main/java/javafx/scene/control/TitledPane.java	Thu Mar 13 08:43:52 2014 +0100
@@ -33,6 +33,7 @@
 import javafx.beans.property.BooleanPropertyBase;
 import javafx.beans.property.ObjectProperty;
 import javafx.beans.property.SimpleObjectProperty;
+import javafx.geometry.Orientation;
 import javafx.scene.Node;
 
 import javafx.css.PseudoClass;
@@ -335,4 +336,9 @@
         return getClassCssMetaData();
     }
 
+    @Override
+    public Orientation getContentBias() {
+        final Node c = getContent();
+        return c == null ? super.getContentBias() : c.getContentBias();
+    }
 }