/** * Returns the component's unconstrained preferred height. */ public int getPreferredHeight() { return getPreferredHeight(-1); }
/** * Returns the component's unconstrained preferred height. */ public int getPreferredHeight() { return getPreferredHeight(-1); }
@Override public int getPreferredHeight(int width) { int preferredHeight = 0; StackPane stackPane = (StackPane)getComponent(); for (Component component : stackPane) { preferredHeight = Math.max(preferredHeight, component.getPreferredHeight(width)); } preferredHeight += (padding.top + padding.bottom); return preferredHeight; }
@Override public int getPreferredHeight(int width) { int preferredHeight = 0; StackPane stackPane = (StackPane)getComponent(); for (Component component : stackPane) { preferredHeight = Math.max(preferredHeight, component.getPreferredHeight(width)); } preferredHeight += (padding.top + padding.bottom); return preferredHeight; }
preferredHeight = selectedCard.getPreferredHeight(width); previousHeight = 0; } else { previousHeight = selectionChangeTransition.fromCard.getPreferredHeight(width); height = 0; } else { height = selectionChangeTransition.toCard.getPreferredHeight(width); preferredHeight = Math.max(preferredHeight, card.getPreferredHeight(width));
preferredHeight = selectedCard.getPreferredHeight(width); previousHeight = 0; } else { previousHeight = selectionChangeTransition.fromCard.getPreferredHeight(width); height = 0; } else { height = selectionChangeTransition.toCard.getPreferredHeight(width); preferredHeight = Math.max(preferredHeight, card.getPreferredHeight(width));
@Override public int getPreferredHeight(int width) { Window window = (Window)getComponent(); Component content = window.getContent(); return (content != null) ? content.getPreferredHeight(width) : 0; }
@Override public int getPreferredHeight(int width) { Window window = (Window)getComponent(); Component content = window.getContent(); return (content != null) ? content.getPreferredHeight(width) : 0; }
@Override public int getPreferredHeight(int width) { int preferredHeight = 0; Border border = (Border)getComponent(); int topThickness = thickness; String title = border.getTitle(); if (title != null && title.length() > 0) { FontRenderContext fontRenderContext = Platform.getFontRenderContext(); LineMetrics lm = font.getLineMetrics(title, fontRenderContext); topThickness = Math.max((int)Math.ceil(lm.getHeight()), topThickness); } Component content = border.getContent(); if (content != null) { if (width != -1) { width = Math.max(width - (thickness * 2) - padding.left - padding.right, 0); } preferredHeight = content.getPreferredHeight(width); } preferredHeight += (padding.top + padding.bottom) + (topThickness + thickness); return preferredHeight; }
@Override public int getPreferredHeight(int width) { int preferredHeight = 0; Border border = (Border)getComponent(); int topThickness = thickness; String title = border.getTitle(); if (title != null && title.length() > 0) { FontRenderContext fontRenderContext = Platform.getFontRenderContext(); LineMetrics lm = font.getLineMetrics(title, fontRenderContext); topThickness = Math.max((int)Math.ceil(lm.getHeight()), topThickness); } Component content = border.getContent(); if (content != null) { int widthUpdated = width; if (widthUpdated != -1) { widthUpdated = Math.max(widthUpdated - (thickness * 2) - padding.left - padding.right, 0); } preferredHeight = content.getPreferredHeight(widthUpdated); } preferredHeight += (padding.top + padding.bottom) + (topThickness + thickness); return preferredHeight; }
@Override public Dimensions getPreferredSize(int breakWidth) { ComponentNode componentNode = (ComponentNode) getNode(); Component component = componentNode.getComponent(); if (component == null) { return new Dimensions(0, 0); } return new Dimensions(component.getPreferredWidth(), component.getPreferredHeight()); }
@Override public Dimensions getPreferredSize(int breakWidth) { ComponentNode componentNode = (ComponentNode) getNode(); Component component = componentNode.getComponent(); if (component == null) { return new Dimensions(0, 0); } else { return new Dimensions(component.getPreferredWidth(), component.getPreferredHeight()); } }
@Override protected void childLayout(int breakWidth) { ComponentNode componentNode = (ComponentNode) getNode(); Component component = componentNode.getComponent(); if (component == null) { setSize(0, 0); } else { component.validate(); component.setSize(component.getPreferredWidth(), component.getPreferredHeight()); setSize(component.getWidth(), component.getHeight()); } }
@Override protected void childLayout(int breakWidth) { ComponentNode componentNode = (ComponentNode) getNode(); Component component = componentNode.getComponent(); if (component == null) { setSize(0, 0); } else { component.validate(); component.setSize(component.getPreferredWidth(), component.getPreferredHeight()); setSize(component.getWidth(), component.getHeight()); } }
@Override public int getPreferredHeight(int width) { GridPane gridPane = (GridPane)getComponent(); GridPane.RowSequence rows = gridPane.getRows(); int columnCount = gridPane.getColumnCount(); int rowCount = rows.getLength(); Metadata metadata = new Metadata(); int cellWidthLocal = getCellWidth(width, metadata); int preferredCellHeight = 0; for (int i = 0; i < rowCount; i++) { GridPane.Row row = rows.get(i); for (int j = 0, n = row.getLength(); j < n && j < columnCount; j++) { Component component = row.get(j); if (component != null && component.isVisible()) { preferredCellHeight = Math.max(preferredCellHeight, component.getPreferredHeight(cellWidthLocal)); } } } // The preferred height of the grid pane is the sum of the row // heights, plus padding and spacing int preferredHeight = padding.top + padding.bottom + metadata.visibleRowCount * preferredCellHeight; if (metadata.visibleRowCount > 1) { preferredHeight += (metadata.visibleRowCount - 1) * verticalSpacing; } return preferredHeight; }
@Override public int getPreferredHeight(int width) { GridPane gridPane = (GridPane)getComponent(); GridPane.RowSequence rows = gridPane.getRows(); int columnCount = gridPane.getColumnCount(); int rowCount = rows.getLength(); Metadata metadata = new Metadata(); int cellWidth = getCellWidth(width, metadata); int preferredCellHeight = 0; for (int i = 0; i < rowCount; i++) { GridPane.Row row = rows.get(i); for (int j = 0, n = row.getLength(); j < n && j < columnCount; j++) { Component component = row.get(j); if (component != null && component.isVisible()) { preferredCellHeight = Math.max(preferredCellHeight, component.getPreferredHeight(cellWidth)); } } } // The preferred height of the grid pane is the sum of the row // heights, plus padding and spacing int preferredHeight = padding.top + padding.bottom + metadata.visibleRowCount * preferredCellHeight; if (metadata.visibleRowCount > 1) { preferredHeight += (metadata.visibleRowCount - 1) * verticalSpacing; } return preferredHeight; }
columnHeaderHeight = columnHeader.getPreferredHeight(-1); clientHeight -= columnHeaderHeight;
columnHeaderHeight = columnHeader.getPreferredHeight(-1); clientHeight -= columnHeaderHeight;
@Override public Dimensions getPreferredSize() { ScrollPane scrollPane = (ScrollPane)getComponent(); int preferredWidth = 0; int preferredHeight = 0; Component view = scrollPane.getView(); if (view != null) { Dimensions preferredViewSize = view.getPreferredSize(); preferredWidth += preferredViewSize.width; preferredHeight += preferredViewSize.height; Component rowHeader = scrollPane.getRowHeader(); if (rowHeader != null) { preferredWidth += rowHeader.getPreferredWidth(-1); } Component columnHeader = scrollPane.getColumnHeader(); if (columnHeader != null) { preferredHeight += columnHeader.getPreferredHeight(-1); } if (scrollPane.getHorizontalScrollBarPolicy() == ScrollBarPolicy.ALWAYS) { preferredHeight += horizontalScrollBar.getPreferredHeight(-1); } if (scrollPane.getVerticalScrollBarPolicy() == ScrollBarPolicy.ALWAYS) { preferredWidth += verticalScrollBar.getPreferredWidth(-1); } } return new Dimensions(preferredWidth, preferredHeight); }
@Override public Dimensions getPreferredSize() { ScrollPane scrollPane = (ScrollPane)getComponent(); int preferredWidth = 0; int preferredHeight = 0; Component view = scrollPane.getView(); if (view != null) { Dimensions preferredViewSize = view.getPreferredSize(); preferredWidth += preferredViewSize.width; preferredHeight += preferredViewSize.height; Component rowHeader = scrollPane.getRowHeader(); if (rowHeader != null) { preferredWidth += rowHeader.getPreferredWidth(-1); } Component columnHeader = scrollPane.getColumnHeader(); if (columnHeader != null) { preferredHeight += columnHeader.getPreferredHeight(-1); } if (scrollPane.getHorizontalScrollBarPolicy() == ScrollBarPolicy.ALWAYS) { preferredHeight += horizontalScrollBar.getPreferredHeight(-1); } if (scrollPane.getVerticalScrollBarPolicy() == ScrollBarPolicy.ALWAYS) { preferredWidth += verticalScrollBar.getPreferredWidth(-1); } } return new Dimensions(preferredWidth, preferredHeight); }