/** * Adds a new editor item to the layout. New items are added at the * bottom. * * @param item the item */ void addItem(PropertyEditor.Item item){ final Node label = item.createLabel(); label.getStyleClass().add("property-label"); GridPane.setValignment(label, VPos.TOP); final Node editor = item.createEditor(); editor.getStyleClass().add("property-editor"); GridPane.setValignment(editor, VPos.CENTER); addRow(index.getAndIncrement(), label, editor); items.add(item); }
protected static Label createTitleLabel(String text) { Label ret = new Label(DefaultI18nContext.getInstance().i18n(text) + ":"); ret.getStyleClass().add("info-property"); GridPane.setHalignment(ret, HPos.RIGHT); GridPane.setValignment(ret, VPos.TOP); return ret; }
public void addRow(RadioButton radio, Region field, Text helpIcon) { requireNotNull(radio, "Cannot add a null radio"); requireNotNull(field, "Cannot add a null field"); GridPane.setValignment(radio, VPos.BOTTOM); GridPane.setValignment(field, VPos.BOTTOM); GridPane.setHalignment(radio, HPos.LEFT); GridPane.setHalignment(field, HPos.LEFT); GridPane.setFillWidth(field, true); field.setPrefWidth(300); field.setDisable(true); radio.selectedProperty().addListener((o, oldVal, newVal) -> { field.setDisable(!newVal); if (newVal) { field.requestFocus(); } }); radio.setToggleGroup(group); add(radio, 0, rows); add(field, 1, rows); if (nonNull(helpIcon)) { add(helpIcon, 2, rows); } rows++; }
/** * Adds a new editor item to the layout. New items are added at the * bottom. * * @param item the item */ void addItem(PropertyEditor.Item item){ final Node label = item.createLabel(); label.getStyleClass().add("property-label"); GridPane.setValignment(label, VPos.TOP); final Node editor = item.createEditor(); editor.getStyleClass().add("property-editor"); GridPane.setValignment(editor, VPos.CENTER); addRow(index.getAndIncrement(), label, editor); items.add(item); }
/** * Adds the shortcut name input to the given {@link GridPane} * * @param gridPane The grid pane to which the shortcut name input should be added * @return The {@link TextField} containing the shortcut name */ private TextField addName(final GridPane gridPane) { final int row = gridPane.getRowCount(); final Label nameLabel = new Label(tr("Name:")); nameLabel.getStyleClass().add("captionTitle"); GridPane.setValignment(nameLabel, VPos.TOP); final TextField name = new TextField(); gridPane.addRow(row, nameLabel, name); return name; }
/** * Adds the description input to the given {@link GridPane} * * @param gridPane The grid pane to which the description input should be added * @return The {@link TextArea} containing the description */ private TextArea addDescription(final GridPane gridPane) { final int row = gridPane.getRowCount(); final Label descriptionLabel = new Label(tr("Description:")); descriptionLabel.getStyleClass().add("captionTitle"); GridPane.setValignment(descriptionLabel, VPos.TOP); final TextArea description = new TextArea(); gridPane.addRow(row, descriptionLabel, description); return description; }
/** * Adds the category input to the given {@link GridPane} * * @param gridPane The grid pane to which the category input should be added * @return The {@link TextField} containing the category */ private TextField addCategory(final GridPane gridPane) { final int row = gridPane.getRowCount(); final Label categoryLabel = new Label(tr("Category:")); categoryLabel.getStyleClass().add("captionTitle"); GridPane.setValignment(categoryLabel, VPos.TOP); final TextField category = new TextField(); gridPane.addRow(row, categoryLabel, category); return category; }
/** * {@inheritDoc} */ @Override public void layoutParts() { super.layoutParts(); int columns = field.getSpan(); container.getChildren().add(checkBox); Node labelDescription = field.getLabelDescription(); Node valueDescription = field.getValueDescription(); add(fieldLabel, 0, 0, 2, 1); if (labelDescription != null) { GridPane.setValignment(labelDescription, VPos.TOP); add(labelDescription, 0, 1, 2, 1); } add(container, 2, 0, columns - 2, 1); if (valueDescription != null) { GridPane.setValignment(valueDescription, VPos.TOP); add(valueDescription, 2, 1, columns - 2, 1); } }
/** * Updates the shortcutProperties of the shortcut in the given {@link GridPane propertiesGrid} * * @param propertiesGrid The shortcutProperties grid */ private void updateProperties(final GridPane propertiesGrid) { propertiesGrid.getChildren().clear(); for (Map.Entry<String, Object> entry : shortcutProperties.entrySet()) { final int row = propertiesGrid.getRowCount(); final Label keyLabel = new Label(tr(decamelize(entry.getKey())) + ":"); keyLabel.getStyleClass().add("captionTitle"); GridPane.setValignment(keyLabel, VPos.TOP); final Label valueLabel = new Label(entry.getValue().toString()); valueLabel.setWrapText(true); propertiesGrid.addRow(row, keyLabel, valueLabel); } }
/** * {@inheritDoc} */ @Override public void layoutParts() { super.layoutParts(); int columns = field.getSpan(); box.setSpacing(5); Node labelDescription = field.getLabelDescription(); Node valueDescription = field.getValueDescription(); add(fieldLabel, 0, 0, 2, 1); if (labelDescription != null) { GridPane.setValignment(labelDescription, VPos.TOP); add(labelDescription, 0, 1, 2, 1); } add(box, 2, 0, columns - 2, 1); if (valueDescription != null) { GridPane.setValignment(valueDescription, VPos.TOP); add(valueDescription, 2, 1, columns - 2, 1); } }
/** * {@inheritDoc} */ @Override public void layoutParts() { super.layoutParts(); int columns = field.getSpan(); box.setSpacing(5); Node labelDescription = field.getLabelDescription(); Node valueDescription = field.getValueDescription(); add(fieldLabel, 0, 0, 2, 1); if (labelDescription != null) { GridPane.setValignment(labelDescription, VPos.TOP); add(labelDescription, 0, 1, 2, 1); } add(box, 2, 0, columns - 2, 1); if (valueDescription != null) { GridPane.setValignment(valueDescription, VPos.TOP); add(valueDescription, 2, 1, columns - 2, 1); } }
/** * {@inheritDoc} */ @Override public void layoutParts() { super.layoutParts(); int columns = field.getSpan(); listView.setPrefHeight(200); Node labelDescription = field.getLabelDescription(); Node valueDescription = field.getValueDescription(); add(fieldLabel, 0, 0, 2, 1); if (labelDescription != null) { GridPane.setValignment(labelDescription, VPos.TOP); add(labelDescription, 0, 1, 2, 1); } add(listView, 2, 0, columns - 2, 1); if (valueDescription != null) { GridPane.setValignment(valueDescription, VPos.TOP); add(valueDescription, 2, 1, columns - 2, 1); } }
add(fieldLabel, 0, rowIndex++, columns, 1); if (labelDescription != null) { GridPane.setValignment(labelDescription, VPos.TOP); add(labelDescription, 0, rowIndex++, columns, 1); GridPane.setValignment(valueDescription, VPos.TOP); add(valueDescription, 0, rowIndex, columns, 1); add(fieldLabel, 0, 0, 2, 1); if (labelDescription != null) { GridPane.setValignment(labelDescription, VPos.TOP); add(labelDescription, 0, 1, 2, 1); GridPane.setValignment(valueDescription, VPos.TOP); add(valueDescription, 2, 1, columns - 2, 1);
add(fieldLabel, 0, rowIndex++, columns, 1); if (labelDescription != null) { GridPane.setValignment(labelDescription, VPos.TOP); add(labelDescription, 0, rowIndex++, columns, 1); GridPane.setValignment(valueDescription, VPos.TOP); add(valueDescription, 0, rowIndex, columns, 1); add(fieldLabel, 0, 0, 2, 1); if (labelDescription != null) { GridPane.setValignment(labelDescription, VPos.TOP); add(labelDescription, 0, 1, 2, 1); GridPane.setValignment(valueDescription, VPos.TOP); add(valueDescription, 2, 1, columns - 2, 1);
@Override public void layoutParts() { super.layoutParts(); int columns = field.getSpan(); readOnlyLabel.getStyleClass().add("read-only-label"); picker.setMaxWidth(Double.MAX_VALUE); stack.setAlignment(Pos.CENTER_LEFT); stack.getChildren().addAll(picker, readOnlyLabel); Node labelDescription = field.getLabelDescription(); Node valueDescription = field.getValueDescription(); add(fieldLabel, 0, 0, 2, 1); if (labelDescription != null) { GridPane.setValignment(labelDescription, VPos.TOP); add(labelDescription, 0, 1, 2, 1); } add(stack, 2, 0, columns - 2, 1); if (valueDescription != null) { GridPane.setValignment(valueDescription, VPos.TOP); add(valueDescription, 2, 1, columns - 2, 1); } }
/** * {@inheritDoc} */ @Override public void layoutParts() { super.layoutParts(); int columns = field.getSpan(); readOnlyLabel.getStyleClass().add("read-only-label"); comboBox.setMaxWidth(Double.MAX_VALUE); comboBox.setVisibleRowCount(4); stack.setAlignment(Pos.CENTER_LEFT); stack.getChildren().addAll(comboBox, readOnlyLabel); Node labelDescription = field.getLabelDescription(); Node valueDescription = field.getValueDescription(); add(fieldLabel, 0, 0, 2, 1); if (labelDescription != null) { GridPane.setValignment(labelDescription, VPos.TOP); add(labelDescription, 0, 1, 2, 1); } add(stack, 2, 0, columns - 2, 1); if (valueDescription != null) { GridPane.setValignment(valueDescription, VPos.TOP); add(valueDescription, 2, 1, columns - 2, 1); } }
/** * * @param node */ protected void apply(Node node) { // sanatize the node super.apply(node); // apply constraints if (row < 0) throw new IllegalArgumentException("You must set the row index"); javafx.scene.layout.GridPane.setRowIndex(node, row); if (col < 0) throw new IllegalArgumentException("You must set the col index"); javafx.scene.layout.GridPane.setColumnIndex(node, col); javafx.scene.layout.GridPane.setRowSpan(node, rowSpan); javafx.scene.layout.GridPane.setColumnSpan(node, colSpan); javafx.scene.layout.GridPane.setMargin(node, margin != null ? margin : marginReset); if (hgrow != null) GenericLayoutConstraints.overrideMaxWidth(node, this); javafx.scene.layout.GridPane.setHalignment(node, halignment != null ? halignment : halignmentReset); javafx.scene.layout.GridPane.setHgrow(node, hgrow != null ? hgrow : hgrowReset); javafx.scene.layout.GridPane.setValignment(node, valignment != null ? valignment : valignmentReset); if (vgrow != null) GenericLayoutConstraints.overrideMaxHeight(node, this); javafx.scene.layout.GridPane.setVgrow(node, vgrow != null ? vgrow : vgrowReset); } }
executableLabel.getStyleClass().add("captionTitle"); GridPane.setValignment(executableLabel, VPos.TOP);
miniatureLabel.getStyleClass().add("captionTitle"); GridPane.setValignment(miniatureLabel, VPos.TOP);
GridPane.setValignment(node, VPos.CENTER);