modules/graphics/src/main/java/javafx/scene/layout/VBox.java

Print this page

        

*** 385,402 **** adjustAreaHeights(managed, prefHeights, height, -1); contentWidth = computeMaxMinAreaWidth(managed, marginAccessor, prefHeights[0], false); } else { contentWidth = computeMaxMinAreaWidth(managed, marginAccessor); } ! return snapSpace(insets.getLeft()) + contentWidth + snapSpace(insets.getRight()); } @Override protected double computeMinHeight(double width) { Insets insets = getInsets(); ! return snapSpace(insets.getTop()) + computeContentHeight(getManagedChildren(), width, true) + ! snapSpace(insets.getBottom()); } @Override protected double computePrefWidth(double height) { Insets insets = getInsets(); List<Node>managed = getManagedChildren(); --- 385,402 ---- adjustAreaHeights(managed, prefHeights, height, -1); contentWidth = computeMaxMinAreaWidth(managed, marginAccessor, prefHeights[0], false); } else { contentWidth = computeMaxMinAreaWidth(managed, marginAccessor); } ! return snapSpaceX(insets.getLeft()) + contentWidth + snapSpaceX(insets.getRight()); } @Override protected double computeMinHeight(double width) { Insets insets = getInsets(); ! return snapSpaceY(insets.getTop()) + computeContentHeight(getManagedChildren(), width, true) + ! snapSpaceY(insets.getBottom()); } @Override protected double computePrefWidth(double height) { Insets insets = getInsets(); List<Node>managed = getManagedChildren();
*** 406,432 **** adjustAreaHeights(managed, prefHeights, height, -1); contentWidth = computeMaxPrefAreaWidth(managed, marginAccessor, prefHeights[0], false); } else { contentWidth = computeMaxPrefAreaWidth(managed, marginAccessor); } ! return snapSpace(insets.getLeft()) + contentWidth + snapSpace(insets.getRight()); } @Override protected double computePrefHeight(double width) { Insets insets = getInsets(); ! double d = snapSpace(insets.getTop()) + computeContentHeight(getManagedChildren(), width, false) + ! snapSpace(insets.getBottom()); return d; } private double[][] getAreaHeights(List<Node>managed, double width, boolean minimum) { // width could be -1 double[][] temp = getTempArray(managed.size()); final double insideWidth = width == -1? -1 : width - ! snapSpace(getInsets().getLeft()) - snapSpace(getInsets().getRight()); final boolean isFillWidth = isFillWidth(); for (int i = 0, size = managed.size(); i < size; i++) { Node child = managed.get(i); Insets margin = getMargin(child); if (minimum) { --- 406,432 ---- adjustAreaHeights(managed, prefHeights, height, -1); contentWidth = computeMaxPrefAreaWidth(managed, marginAccessor, prefHeights[0], false); } else { contentWidth = computeMaxPrefAreaWidth(managed, marginAccessor); } ! return snapSpaceX(insets.getLeft()) + contentWidth + snapSpaceX(insets.getRight()); } @Override protected double computePrefHeight(double width) { Insets insets = getInsets(); ! double d = snapSpaceY(insets.getTop()) + computeContentHeight(getManagedChildren(), width, false) + ! snapSpaceY(insets.getBottom()); return d; } private double[][] getAreaHeights(List<Node>managed, double width, boolean minimum) { // width could be -1 double[][] temp = getTempArray(managed.size()); final double insideWidth = width == -1? -1 : width - ! snapSpaceX(getInsets().getLeft()) - snapSpaceX(getInsets().getRight()); final boolean isFillWidth = isFillWidth(); for (int i = 0, size = managed.size(); i < size; i++) { Node child = managed.get(i); Insets margin = getMargin(child); if (minimum) {
*** 446,461 **** return temp; } private double adjustAreaHeights(List<Node>managed, double areaHeights[][], double height, double width) { Insets insets = getInsets(); ! double left = snapSpace(insets.getLeft()); ! double right = snapSpace(insets.getRight()); ! double contentHeight = sum(areaHeights[0], managed.size()) + (managed.size()-1)*snapSpace(getSpacing()); double extraHeight = height - ! snapSpace(insets.getTop()) - snapSpace(insets.getBottom()) - contentHeight; if (extraHeight != 0) { final double refWidth = isFillWidth()&& width != -1? width - left - right : -1; double remaining = growOrShrinkAreaHeights(managed, areaHeights, Priority.ALWAYS, extraHeight, refWidth); remaining = growOrShrinkAreaHeights(managed, areaHeights, Priority.SOMETIMES, remaining, refWidth); --- 446,461 ---- return temp; } private double adjustAreaHeights(List<Node>managed, double areaHeights[][], double height, double width) { Insets insets = getInsets(); ! double left = snapSpaceX(insets.getLeft()); ! double right = snapSpaceX(insets.getRight()); ! double contentHeight = sum(areaHeights[0], managed.size()) + (managed.size()-1)*snapSpaceY(getSpacing()); double extraHeight = height - ! snapSpaceY(insets.getTop()) - snapSpaceY(insets.getBottom()) - contentHeight; if (extraHeight != 0) { final double refWidth = isFillWidth()&& width != -1? width - left - right : -1; double remaining = growOrShrinkAreaHeights(managed, areaHeights, Priority.ALWAYS, extraHeight, refWidth); remaining = growOrShrinkAreaHeights(managed, areaHeights, Priority.SOMETIMES, remaining, refWidth);
*** 490,500 **** } } double available = extraHeight; // will be negative in shrinking case outer: while (Math.abs(available) > 1 && adjustingNumber > 0) { ! final double portion = snapPortion(available / adjustingNumber); // negative in shrinking case for (int i = 0, size = managed.size(); i < size; i++) { if (temp[i] == -1) { continue; } final double limit = temp[i] - usedHeights[i]; // negative in shrinking case --- 490,500 ---- } } double available = extraHeight; // will be negative in shrinking case outer: while (Math.abs(available) > 1 && adjustingNumber > 0) { ! final double portion = snapPortionY(available / adjustingNumber); // negative in shrinking case for (int i = 0, size = managed.size(); i < size; i++) { if (temp[i] == -1) { continue; } final double limit = temp[i] - usedHeights[i]; // negative in shrinking case
*** 514,524 **** return available; // might be negative in shrinking case } private double computeContentHeight(List<Node> managedChildren, double width, boolean minimum) { return sum(getAreaHeights(managedChildren, width, minimum)[0], managedChildren.size()) ! + (managedChildren.size()-1)*snapSpace(getSpacing()); } private static double sum(double[] array, int size) { int i = 0; double res = 0; --- 514,524 ---- return available; // might be negative in shrinking case } private double computeContentHeight(List<Node> managedChildren, double width, boolean minimum) { return sum(getAreaHeights(managedChildren, width, minimum)[0], managedChildren.size()) ! + (managedChildren.size()-1)*snapSpaceY(getSpacing()); } private static double sum(double[] array, int size) { int i = 0; double res = 0;
*** 541,555 **** performingLayout = true; List<Node> managed = getManagedChildren(); Insets insets = getInsets(); double width = getWidth(); double height = getHeight(); ! double top = snapSpace(insets.getTop()); ! double left = snapSpace(insets.getLeft()); ! double bottom = snapSpace(insets.getBottom()); ! double right = snapSpace(insets.getRight()); ! double space = snapSpace(getSpacing()); HPos hpos = getAlignmentInternal().getHpos(); VPos vpos = getAlignmentInternal().getVpos(); boolean isFillWidth = isFillWidth(); double[][] actualAreaHeights = getAreaHeights(managed, width, false); --- 541,555 ---- performingLayout = true; List<Node> managed = getManagedChildren(); Insets insets = getInsets(); double width = getWidth(); double height = getHeight(); ! double top = snapSpaceY(insets.getTop()); ! double left = snapSpaceX(insets.getLeft()); ! double bottom = snapSpaceY(insets.getBottom()); ! double right = snapSpaceX(insets.getRight()); ! double space = snapSpaceY(getSpacing()); HPos hpos = getAlignmentInternal().getHpos(); VPos vpos = getAlignmentInternal().getVpos(); boolean isFillWidth = isFillWidth(); double[][] actualAreaHeights = getAreaHeights(managed, width, false);