modules/javafx.controls/src/main/java/javafx/scene/control/skin/TitledPaneSkin.java
Print this page
@@ -230,11 +230,11 @@
/** {@inheritDoc} */
@Override protected void layoutChildren(final double x, double y,
final double w, final double h) {
// header
- double headerHeight = snapSize(titleRegion.prefHeight(-1));
+ double headerHeight = snapSizeY(titleRegion.prefHeight(-1));
titleRegion.resize(w, headerHeight);
positionInArea(titleRegion, x, y,
w, headerHeight, 0, HPos.LEFT, VPos.CENTER);
titleRegion.requestLayout();
@@ -244,45 +244,47 @@
if (isInsideAccordion()) {
if (prefHeightFromAccordion != 0) {
contentHeight = (prefHeightFromAccordion - headerHeight) * getTransition();
}
}
- contentHeight = snapSize(contentHeight);
+ contentHeight = snapSizeY(contentHeight);
- y += snapSize(headerHeight);
+ // Header height was already snapped above. Is this just in case
+ // mods are made to the intervening code? Or is it just redundant?
+ y += snapSizeY(headerHeight);
contentContainer.resize(w, contentHeight);
clipRect.setHeight(contentHeight);
positionInArea(contentContainer, x, y,
w, contentHeight, /*baseline ignored*/0, HPos.CENTER, VPos.CENTER);
}
/** {@inheritDoc} */
@Override protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
- double titleWidth = snapSize(titleRegion.prefWidth(height));
- double contentWidth = snapSize(contentContainer.minWidth(height));
+ double titleWidth = snapSizeX(titleRegion.prefWidth(height));
+ double contentWidth = snapSizeX(contentContainer.minWidth(height));
return Math.max(titleWidth, contentWidth) + leftInset + rightInset;
}
/** {@inheritDoc} */
@Override protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
- double headerHeight = snapSize(titleRegion.prefHeight(width));
+ double headerHeight = snapSizeY(titleRegion.prefHeight(width));
double contentHeight = contentContainer.minHeight(width) * getTransition();
- return headerHeight + snapSize(contentHeight) + topInset + bottomInset;
+ return headerHeight + snapSizeY(contentHeight) + topInset + bottomInset;
}
/** {@inheritDoc} */
@Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
- double titleWidth = snapSize(titleRegion.prefWidth(height));
- double contentWidth = snapSize(contentContainer.prefWidth(height));
+ double titleWidth = snapSizeX(titleRegion.prefWidth(height));
+ double contentWidth = snapSizeX(contentContainer.prefWidth(height));
return Math.max(titleWidth, contentWidth) + leftInset + rightInset;
}
/** {@inheritDoc} */
@Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
- double headerHeight = snapSize(titleRegion.prefHeight(width));
+ double headerHeight = snapSizeY(titleRegion.prefHeight(width));
double contentHeight = contentContainer.prefHeight(width) * getTransition();
- return headerHeight + snapSize(contentHeight) + topInset + bottomInset;
+ return headerHeight + snapSizeY(contentHeight) + topInset + bottomInset;
}
/** {@inheritDoc} */
@Override protected double computeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
return Double.MAX_VALUE;
@@ -327,22 +329,22 @@
private boolean isInsideAccordion() {
return getSkinnable().getParent() != null && getSkinnable().getParent() instanceof Accordion;
}
double getTitleRegionSize(double width) {
- return snapSize(titleRegion.prefHeight(width)) + snappedTopInset() + snappedBottomInset();
+ return snapSizeY(titleRegion.prefHeight(width)) + snappedTopInset() + snappedBottomInset();
}
private double prefHeightFromAccordion = 0;
void setMaxTitledPaneHeightForAccordion(double height) {
this.prefHeightFromAccordion = height;
}
double getTitledPaneHeightForAccordion() {
- double headerHeight = snapSize(titleRegion.prefHeight(-1));
+ double headerHeight = snapSizeY(titleRegion.prefHeight(-1));
double contentHeight = (prefHeightFromAccordion - headerHeight) * getTransition();
- return headerHeight + snapSize(contentHeight) + snappedTopInset() + snappedBottomInset();
+ return headerHeight + snapSizeY(contentHeight) + snappedTopInset() + snappedBottomInset();
}
private void doAnimationTransition() {
if (content == null) {
return;