Java Code Examples for javafx.scene.layout.ColumnConstraints#setFillWidth()
The following examples show how to use
javafx.scene.layout.ColumnConstraints#setFillWidth() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActivityItemCell.java From PeerWasp with MIT License | 7 votes |
private void initializeGrid() { grid.setHgap(10); grid.setVgap(5); grid.setPadding(new Insets(0, 10, 0, 10)); // icon column ColumnConstraints col1 = new ColumnConstraints(); col1.setFillWidth(false); col1.setHgrow(Priority.NEVER); grid.getColumnConstraints().add(col1); // title column: grows ColumnConstraints col2 = new ColumnConstraints(); col2.setFillWidth(true); col2.setHgrow(Priority.ALWAYS); grid.getColumnConstraints().add(col2); // date column ColumnConstraints col3 = new ColumnConstraints(); col3.setFillWidth(false); col3.setHgrow(Priority.NEVER); grid.getColumnConstraints().add(col3); }
Example 2
Source File: EasyGridPane.java From constellation with Apache License 2.0 | 6 votes |
public void addColumnConstraint(boolean fillWidth, HPos alignment, Priority grow, double maxWidth, double minWidth, double prefWidth, double percentWidth) { ColumnConstraints constraint = new ColumnConstraints(); constraint.setFillWidth(fillWidth); constraint.setHalignment(alignment); constraint.setHgrow(grow); constraint.setMaxWidth(maxWidth); constraint.setMinWidth(minWidth); constraint.setPrefWidth(prefWidth); if (percentWidth >= 0) { constraint.setPercentWidth(percentWidth); } getColumnConstraints().add(constraint); }
Example 3
Source File: ConversationBox.java From constellation with Apache License 2.0 | 5 votes |
public BubbleBox(final ConversationMessage message) { setVgap(3); final ColumnConstraints spaceColumn = new ColumnConstraints(); spaceColumn.setHgrow(Priority.ALWAYS); spaceColumn.setMinWidth(50); spaceColumn.setPrefWidth(50); final ColumnConstraints contentColumn = new ColumnConstraints(); contentColumn.setHalignment(message.getConversationSide() == ConversationSide.LEFT ? HPos.LEFT : HPos.RIGHT); contentColumn.setFillWidth(false); contentColumn.setHgrow(Priority.NEVER); final RowConstraints contentRow = new RowConstraints(); contentRow.setFillHeight(true); contentRow.setMaxHeight(Double.MAX_VALUE); contentRow.setValignment(VPos.TOP); getRowConstraints().addAll(contentRow); if (message.getConversationSide() == ConversationSide.LEFT) { contentColumnIndex = 0; getColumnConstraints().addAll(contentColumn, spaceColumn); } else { contentColumnIndex = 1; getColumnConstraints().addAll(spaceColumn, contentColumn); } update(message); }
Example 4
Source File: AttributeEditorPanel.java From constellation with Apache License 2.0 | 4 votes |
private Node createAttributeValueNode(final Object[] values, final AttributeData attribute, final AttributeTitledPane parent, final boolean multiValue) { boolean noneSelected = values == null; boolean isNull = !noneSelected && (values[0] == null); parent.setAttribute(attribute); AbstractAttributeInteraction<?> interaction = AbstractAttributeInteraction.getInteraction(attribute.getDataType()); final String displayText; final List<Node> displayNodes; if (multiValue) { displayText = "<Multiple Values>"; displayNodes = Collections.emptyList(); } else if (isNull) { displayText = NO_VALUE_TEXT; displayNodes = Collections.emptyList(); } else if (noneSelected) { displayText = "<Nothing Selected>"; displayNodes = Collections.emptyList(); } else { displayText = interaction.getDisplayText(values[0]); displayNodes = interaction.getDisplayNodes(values[0], -1, CELL_ITEM_HEIGHT); } parent.setAttributeValue(displayText); final TextField attributeValueText = new TextField(displayText); attributeValueText.setEditable(false); if (noneSelected || isNull || multiValue) { attributeValueText.getStyleClass().add("undisplayedValue"); } if (displayNodes.isEmpty()) { return attributeValueText; } GridPane gridPane = new GridPane(); gridPane.setAlignment(Pos.CENTER_RIGHT); gridPane.setPadding(Insets.EMPTY); gridPane.setHgap(CELL_ITEM_SPACING); ColumnConstraints displayNodeConstraint = new ColumnConstraints(CELL_ITEM_HEIGHT); displayNodeConstraint.setHalignment(HPos.LEFT); ColumnConstraints displayTextConstraint = new ColumnConstraints(); displayTextConstraint.setHalignment(HPos.RIGHT); displayTextConstraint.setHgrow(Priority.ALWAYS); displayTextConstraint.setFillWidth(true); for (int i = 0; i < displayNodes.size(); i++) { final Node displayNode = displayNodes.get(i); gridPane.add(displayNode, i, 0); gridPane.getColumnConstraints().add(displayNodeConstraint); } gridPane.add(attributeValueText, displayNodes.size(), 0); gridPane.getColumnConstraints().add(displayTextConstraint); return gridPane; }
Example 5
Source File: TilingPane.java From chart-fx with Apache License 2.0 | 4 votes |
protected void layoutNormal() { if (getChildren().isEmpty()) { return; } final int colsCount = getColumnsCount(); if (getColumnConstraints().size() != colsCount) { final List<ColumnConstraints> colConstraintList = new ArrayList<>(); for (int i = 0; i < colsCount; i++) { final ColumnConstraints colConstraints = new ColumnConstraints(); // NOPMD colConstraints.setPercentWidth(100.0 / colsCount); colConstraints.setFillWidth(true); colConstraintList.add(colConstraints); } getColumnConstraints().setAll(colConstraintList); } int rowIndex = 0; int colIndex = 0; int childCount = 0; final int nChildren = getChildren().size(); int nColSpan = Math.max(1, colsCount / (nChildren - childCount)); for (final Node child : getChildren()) { GridPane.setFillWidth(child, true); GridPane.setFillHeight(child, true); GridPane.setColumnIndex(child, colIndex); GridPane.setRowIndex(child, rowIndex); if ((colIndex == 0) && ((nChildren - childCount) < colsCount)) { nColSpan = Math.max(1, colsCount / (nChildren - childCount)); } // last window fills up row if (((nChildren - childCount) == 1) && (colIndex < colsCount)) { nColSpan = colsCount - colIndex; } GridPane.setColumnSpan(child, nColSpan); colIndex += nColSpan; if (colIndex >= colsCount) { colIndex = 0; rowIndex++; } childCount++; } }