Java Code Examples for javafx.scene.layout.RowConstraints#setVgrow()

The following examples show how to use javafx.scene.layout.RowConstraints#setVgrow() . 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: EasyGridPane.java    From constellation with Apache License 2.0 5 votes vote down vote up
public void addRowConstraint(boolean fillHeight, VPos alignment, Priority grow, double maxHeight, double minHeight, double prefHeight, double percentHeight) {
    RowConstraints constraint = new RowConstraints();
    constraint.setFillHeight(fillHeight);
    constraint.setValignment(alignment);
    constraint.setVgrow(grow);
    constraint.setMaxHeight(maxHeight);
    constraint.setMinHeight(minHeight);
    constraint.setPrefHeight(prefHeight);

    if (percentHeight >= 0) {
        constraint.setPercentHeight(percentHeight);
    }

    getRowConstraints().add(constraint);
}
 
Example 2
Source File: PatientView.java    From WorkbenchFX with Apache License 2.0 5 votes vote down vote up
@Override
public void layoutParts() {
  setSpacing(20);

  GridPane dashboard = new GridPane();
  RowConstraints growingRow = new RowConstraints();
  growingRow.setVgrow(Priority.ALWAYS);
  ColumnConstraints growingCol = new ColumnConstraints();
  growingCol.setHgrow(Priority.ALWAYS);
  dashboard.getRowConstraints().setAll(growingRow, growingRow);
  dashboard.getColumnConstraints().setAll(growingCol, growingCol);

  dashboard.setVgap(60);

  dashboard.setPrefHeight(800);
  dashboard.addRow(0, bloodPressureSystolicControl, bloodPressureDiastolicControl);
  dashboard.addRow(1, weightControl, tallnessControl);


  setHgrow(dashboard, Priority.ALWAYS);

  GridPane form = new GridPane();
  form.setHgap(10);
  form.setVgap(25);
  form.setMaxWidth(410);

  GridPane.setVgrow(imageView, Priority.ALWAYS);
  GridPane.setValignment(imageView, VPos.BOTTOM);

  form.add(firstNameField, 0, 0);
  form.add(lastNameField, 1, 0);
  form.add(yearOfBirthField, 0, 1);
  form.add(genderField, 1, 1);
  form.add(imageView, 0, 2, 2, 1);
  form.add(imgURLField, 0, 3, 2, 1);

  getChildren().addAll(form, dashboard);

}
 
Example 3
Source File: IconEditorFactory.java    From constellation with Apache License 2.0 4 votes vote down vote up
@Override
protected Node createEditorControls() {
    final GridPane controls = new GridPane();
    controls.setAlignment(Pos.CENTER);
    controls.setVgap(CONTROLS_DEFAULT_VERTICAL_SPACING);

    final ColumnConstraints cc = new ColumnConstraints();
    cc.setHgrow(Priority.ALWAYS);
    controls.getColumnConstraints().add(cc);
    final RowConstraints rc = new RowConstraints();
    rc.setVgrow(Priority.ALWAYS);
    controls.getRowConstraints().add(rc);

    // build tree structure of icon
    final IconNode builtInNode = new IconNode("(Built-in)", IconManager.getIconNames(false));

    //convert structure to jfx treeview
    builtInItem = new TreeItem<>(builtInNode);
    addNode(builtInItem, builtInNode);

    // set listview factory to display icon
    listView = new ListView<>();
    listView.setCellFactory(param -> new IconNodeCell());
    listView.getStyleClass().add("rounded");
    listView.getSelectionModel().selectedItemProperty().addListener((v, o, n) -> {
        update();
    });

    treeRoot = new TreeItem<>(new IconNode("Icons", new HashSet<>()));
    treeRoot.setExpanded(true);

    treeView = new TreeView<>();
    treeView.setShowRoot(true);
    treeView.setRoot(treeRoot);
    treeView.getStyleClass().add("rounded");
    treeView.setOnMouseClicked((MouseEvent event) -> {
        refreshIconList();
    });

    final SplitPane splitPane = new SplitPane();
    splitPane.setId("hiddenSplitter");
    splitPane.setOrientation(Orientation.HORIZONTAL);
    splitPane.getItems().add(treeView);
    splitPane.getItems().add(listView);
    controls.addRow(0, splitPane);

    final HBox addRemoveBox = createAddRemoveBox();
    controls.addRow(1, addRemoveBox);

    return controls;
}
 
Example 4
Source File: StringEditorFactory.java    From constellation with Apache License 2.0 4 votes vote down vote up
@Override
protected Node createEditorControls() {
    final GridPane controls = new GridPane();
    controls.setAlignment(Pos.CENTER);
    controls.setVgap(CONTROLS_SPACING);

    final ColumnConstraints cc = new ColumnConstraints();
    cc.setHgrow(Priority.ALWAYS);
    controls.getColumnConstraints().add(cc);
    final RowConstraints rc = new RowConstraints();
    rc.setVgrow(Priority.ALWAYS);
    controls.getRowConstraints().add(rc);

    textArea = new TextArea();
    textArea.setWrapText(true);
    textArea.textProperty().addListener((o, n, v) -> {
        update();
    });
    textArea.addEventFilter(KeyEvent.KEY_PRESSED, e -> {
        if (e.getCode() == KeyCode.DELETE) {
            IndexRange selection = textArea.getSelection();
            if (selection.getLength() == 0) {
                textArea.deleteNextChar();
            } else {
                textArea.deleteText(selection);
            }
            e.consume();
        } else if (e.isShortcutDown() && e.isShiftDown() && (e.getCode() == KeyCode.RIGHT)) {
            textArea.selectNextWord();
            e.consume();
        } else if (e.isShortcutDown() && e.isShiftDown() && (e.getCode() == KeyCode.LEFT)) {
            textArea.selectPreviousWord();
            e.consume();
        } else if (e.isShortcutDown() && (e.getCode() == KeyCode.RIGHT)) {
            textArea.nextWord();
            e.consume();
        } else if (e.isShortcutDown() && (e.getCode() == KeyCode.LEFT)) {
            textArea.previousWord();
            e.consume();
        } else if (e.isShiftDown() && (e.getCode() == KeyCode.RIGHT)) {
            textArea.selectForward();
            e.consume();
        } else if (e.isShiftDown() && (e.getCode() == KeyCode.LEFT)) {
            textArea.selectBackward();
            e.consume();
        } else if (e.isShortcutDown() && (e.getCode() == KeyCode.A)) {
            textArea.selectAll();
            e.consume();
        } else if (e.getCode() == KeyCode.ESCAPE) {
            e.consume();
        }
    });

    noValueCheckBox = new CheckBox(NO_VALUE_LABEL);
    noValueCheckBox.setAlignment(Pos.CENTER);
    noValueCheckBox.selectedProperty().addListener((v, o, n) -> {
        textArea.setDisable(noValueCheckBox.isSelected());
        update();
    });

    controls.addRow(0, textArea);
    controls.addRow(1, noValueCheckBox);
    return controls;
}
 
Example 5
Source File: PluginParametersPane.java    From constellation with Apache License 2.0 4 votes vote down vote up
@Override
public Pane getParamPane(final PluginParametersNode node) {
    if (node.getChildren().isEmpty()) {
        return null;
    }

    final GridPane paramGroupPane = new PluginParametersPane();
    paramGroupPane.setMinHeight(0);
    GridPane.setHalignment(paramGroupPane, HPos.LEFT);
    paramGroupPane.setPadding(Insets.EMPTY);

    int row = 0;
    final DoubleProperty descriptionWidth = new SimpleDoubleProperty();
    DoubleProperty maxLabelWidth = new SimpleDoubleProperty();

    for (final PluginParametersNode child : node.getChildren()) {
        while (child.getFormatter().nextElement(child)) {
            final RowConstraints rowConstraints = new RowConstraints();
            rowConstraints.setVgrow(Priority.NEVER);
            rowConstraints.setFillHeight(true);
            paramGroupPane.getRowConstraints().addAll(rowConstraints);

            final LabelDescriptionBox label = child.getFormatter().getParamLabel(child);
            if (label != null) {
                paramGroupPane.add(label, 0, row);
                GridPane.setValignment(label, VPos.TOP);
                GridPane.setHgrow(label, Priority.ALWAYS);
                GridPane.setFillHeight(label, false);

                label.bindDescriptionToProperty(descriptionWidth);
                maxLabelWidth = label.updateBindingWithLabelWidth(maxLabelWidth);
            }

            final Pane paramPane = child.getFormatter().getParamPane(child);
            if (paramPane != null) {
                paramPane.setStyle("-fx-padding: " + PADDING);
                GridPane.setValignment(paramPane, VPos.TOP);
                GridPane.setFillHeight(paramPane, false);
                if (label == null) {
                    paramGroupPane.add(paramPane, 0, row, 2, 1);
                } else {
                    paramGroupPane.add(paramPane, 1, row);
                }
            }

            final Button paramHelp = child.getFormatter().getParamHelp(child);
            if (paramHelp != null) {
                paramGroupPane.add(paramHelp, 2, row);
                GridPane.setMargin(paramHelp, new Insets(PADDING, PADDING, 0, 0));
                GridPane.setValignment(paramHelp, VPos.TOP);
                GridPane.setFillHeight(paramHelp, false);
            }

            row++;
        }
    }

    descriptionWidth.bind(Bindings.max(50, maxLabelWidth));

    return paramGroupPane;
}
 
Example 6
Source File: UiEPXDetailsGrid.java    From EWItool with GNU General Public License v3.0 4 votes vote down vote up
UiEPXDetailsGrid( ) {
  // for vertically fixed rows in the GridPanes...
  RowConstraints fixedRC = new RowConstraints();
  fixedRC.setVgrow( Priority.NEVER );
  // for vertically growable rows in the GridPanes...
  RowConstraints vgrowRC = new RowConstraints();
  vgrowRC.setVgrow( Priority.ALWAYS );
  
  Label detailsSectionLabel = new Label( "Patch Details" );
  detailsSectionLabel.setId( "epx-section-label" );
  add( detailsSectionLabel, 0, 0 );
  getRowConstraints().add( fixedRC );
  
  add( new Label( "Name" ), 0, 1 );
  nameField = new TextField();  
  add( nameField, 1, 1 );
  getRowConstraints().add( vgrowRC );
  
  add( new Label( "Contributor" ), 0, 2 );
  contribField = new TextField();
  add( contribField, 1, 2 );
  getRowConstraints().add( vgrowRC );
  
  add( new Label( "Originator" ), 0, 3 );
  originField = new TextField();
  add( originField, 1,3 );
  getRowConstraints().add( vgrowRC );
  
  add( new Label( "Type" ), 0, 4 );
  typeField = new TextField();
  add( typeField, 1, 4 );
  getRowConstraints().add( vgrowRC );
  
  add( new Label( "Private" ), 0, 5 );
  privacyCheckBox = new CheckBox();
  add( privacyCheckBox, 1, 5 );
  getRowConstraints().add( vgrowRC );
  
  add( new Label( "Description" ), 0, 6 );
  descriptionArea = new TextArea();
  descriptionArea.setWrapText( true );
  add( descriptionArea, 0, 7 );
  GridPane.setColumnSpan( descriptionArea, 2 );
  getRowConstraints().add( vgrowRC );
  
  add( new Label( "Tags" ), 0, 8 );
  rTagsField = new TextField();
  add( rTagsField, 1, 8 );
  getRowConstraints().add( vgrowRC );
  
  add( new Label( "Added" ), 0, 9 );
  addedField = new TextField();
  add( addedField, 1, 9 );
  getRowConstraints().add( vgrowRC );
  

}