modules/javafx.controls/src/main/java/javafx/scene/control/skin/TabPaneSkin.java

Print this page

        

*** 272,308 **** /** {@inheritDoc} */ @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { // The TabPane can only be as wide as it widest content width. double maxw = 0.0; for (TabContentRegion contentRegion: tabContentRegions) { ! maxw = Math.max(maxw, snapSize(contentRegion.prefWidth(-1))); } final boolean isHorizontal = isHorizontal(); ! final double tabHeaderAreaSize = snapSize(isHorizontal ? ! tabHeaderArea.prefWidth(-1) : tabHeaderArea.prefHeight(-1)); double prefWidth = isHorizontal ? Math.max(maxw, tabHeaderAreaSize) : maxw + tabHeaderAreaSize; ! return snapSize(prefWidth) + rightInset + leftInset; } /** {@inheritDoc} */ @Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { // The TabPane can only be as high as it highest content height. double maxh = 0.0; for (TabContentRegion contentRegion: tabContentRegions) { ! maxh = Math.max(maxh, snapSize(contentRegion.prefHeight(-1))); } final boolean isHorizontal = isHorizontal(); ! final double tabHeaderAreaSize = snapSize(isHorizontal ? ! tabHeaderArea.prefHeight(-1) : tabHeaderArea.prefWidth(-1)); double prefHeight = isHorizontal ? ! maxh + snapSize(tabHeaderAreaSize) : Math.max(maxh, tabHeaderAreaSize); ! return snapSize(prefHeight) + topInset + bottomInset; } /** {@inheritDoc} */ @Override public double computeBaselineOffset(double topInset, double rightInset, double bottomInset, double leftInset) { Side tabPosition = getSkinnable().getSide(); --- 272,310 ---- /** {@inheritDoc} */ @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { // The TabPane can only be as wide as it widest content width. double maxw = 0.0; for (TabContentRegion contentRegion: tabContentRegions) { ! maxw = Math.max(maxw, snapSizeX(contentRegion.prefWidth(-1))); } final boolean isHorizontal = isHorizontal(); ! final double tabHeaderAreaSize = isHorizontal ! ? snapSizeX(tabHeaderArea.prefWidth(-1)) ! : snapSizeY(tabHeaderArea.prefHeight(-1)); double prefWidth = isHorizontal ? Math.max(maxw, tabHeaderAreaSize) : maxw + tabHeaderAreaSize; ! return snapSizeX(prefWidth) + rightInset + leftInset; } /** {@inheritDoc} */ @Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { // The TabPane can only be as high as it highest content height. double maxh = 0.0; for (TabContentRegion contentRegion: tabContentRegions) { ! maxh = Math.max(maxh, snapSizeY(contentRegion.prefHeight(-1))); } final boolean isHorizontal = isHorizontal(); ! final double tabHeaderAreaSize = isHorizontal ! ? snapSizeY(tabHeaderArea.prefHeight(-1)) ! : snapSizeX(tabHeaderArea.prefWidth(-1)); double prefHeight = isHorizontal ? ! maxh + snapSizeY(tabHeaderAreaSize) : Math.max(maxh, tabHeaderAreaSize); ! return snapSizeY(prefHeight) + topInset + bottomInset; } /** {@inheritDoc} */ @Override public double computeBaselineOffset(double topInset, double rightInset, double bottomInset, double leftInset) { Side tabPosition = getSkinnable().getSide();
*** 316,332 **** @Override protected void layoutChildren(final double x, final double y, final double w, final double h) { TabPane tabPane = getSkinnable(); Side tabPosition = tabPane.getSide(); ! double headerHeight = snapSize(tabHeaderArea.prefHeight(-1)); double tabsStartX = tabPosition.equals(Side.RIGHT)? x + w - headerHeight : x; double tabsStartY = tabPosition.equals(Side.BOTTOM)? y + h - headerHeight : y; final double leftInset = snappedLeftInset(); final double topInset = snappedTopInset(); - final double rightInset = snappedRightInset(); if (tabPosition == Side.TOP) { tabHeaderArea.resize(w, headerHeight); tabHeaderArea.relocate(tabsStartX, tabsStartY); tabHeaderArea.getTransforms().clear(); --- 318,335 ---- @Override protected void layoutChildren(final double x, final double y, final double w, final double h) { TabPane tabPane = getSkinnable(); Side tabPosition = tabPane.getSide(); ! double headerHeight = tabPosition.isHorizontal() ! ? snapSizeY(tabHeaderArea.prefHeight(-1)) ! : snapSizeX(tabHeaderArea.prefHeight(-1)); double tabsStartX = tabPosition.equals(Side.RIGHT)? x + w - headerHeight : x; double tabsStartY = tabPosition.equals(Side.BOTTOM)? y + h - headerHeight : y; final double leftInset = snappedLeftInset(); final double topInset = snappedTopInset(); if (tabPosition == Side.TOP) { tabHeaderArea.resize(w, headerHeight); tabHeaderArea.relocate(tabsStartX, tabsStartY); tabHeaderArea.getTransforms().clear();