private double getPrefSize(double prefSize) { if (isPreferred(prefSize)) { return prefSize; } else { return FLEXIBLE_PREF; } }
public static boolean isFlexible(double size) { return !isPreferred(size); }
if (parentSize > 0) { for (int i = 0; i < prefs.length; i++) { if (LayoutConstraintsDescriptor.isPreferred(prefs[i])) { relativeSizes[i] = prefs[i] / parentSize; requiredRelativeSize += relativeSizes[i];
@Override public void updateLayoutConstraints() { if (LayoutConstraintsDescriptor.isPreferred(getLayoutConstraints().getPrefWidth())) { getLayoutConstraints().setPrefWidth(getWidth()); } if (LayoutConstraintsDescriptor.isPreferred(getLayoutConstraints().getPrefHeight())) { getLayoutConstraints().setPrefHeight(getHeight()); } }
private void configureChild(DockingSplitPaneChildBase child, RegionDimension dimension, double prefSize, boolean addListeners) { if (LayoutConstraintsDescriptor.isPreferred(prefSize)) { dimension.setPrefSize(child, prefSize); // dimension.setMinSize(child, prefSize); SplitPane.setResizableWithParent(child, Boolean.FALSE); } else { dimension.setPrefSize(child, Region.USE_COMPUTED_SIZE); SplitPane.setResizableWithParent(child, Boolean.TRUE); } dimension.setMaxSize(child, Double.MAX_VALUE); if (addListeners) { addChildListeners(child); } }
private void recalculateLayoutConstraints() { double prefWidth = 0; double prefHeight = 0; for (DockingSplitPaneChildBase child : dockingSplitPaneChildren) { LayoutConstraintsDescriptor childLayoutConstraints = child.getLayoutConstraints(); if (LayoutConstraintsDescriptor.isPreferred(prefWidth) && (LayoutConstraintsDescriptor.isFlexible(childLayoutConstraints.getPrefWidth()) || childLayoutConstraints.getPrefWidth() > prefWidth)) { prefWidth = childLayoutConstraints.getPrefWidth(); } if (LayoutConstraintsDescriptor.isPreferred(prefHeight) && (LayoutConstraintsDescriptor.isFlexible(childLayoutConstraints.getPrefHeight()) || childLayoutConstraints.getPrefHeight() > prefHeight)) { prefHeight = childLayoutConstraints.getPrefHeight(); } if (LayoutConstraintsDescriptor.isFlexible(prefWidth) && LayoutConstraintsDescriptor.isFlexible(prefHeight)) { break; } } final LayoutConstraintsDescriptor layoutConstraintsDescriptor = LayoutConstraintsDescriptor.getLayoutConstraints(prefWidth, prefHeight); setLayoutConstraints(layoutConstraintsDescriptor); }