javafx.scene.layout.RowConstraints Java Examples

The following examples show how to use javafx.scene.layout.RowConstraints. 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: JFXHelper.java    From Schillsaver with MIT License 6 votes vote down vote up
/**
 * Creates a GridPane with only one column, but where there are as many rows as there are controls passed
 * to the function.
 *
 * Ex:
 *      If you pass in two controls, then there will be one column with two rows where each row uses 50%
 *      of the height.
 *
 * Ex:
 *      If you pass in four controls, then there will be one column with four rows where each row uses 25%
 *      of the height.
 *
 * @param controls
 *          The controls.
 *
 * @return
 *          The pane.
 */
public static GridPane createVerticalGridPane(final Control... controls) {
    if (controls.length == 0) {
        return new GridPane();
    }

    final GridPane pane = new GridPane();
    final double sectionHeight = 100.0 / controls.length;

    for (final Control ignored : controls) {
        final RowConstraints constraints = new RowConstraints();
        constraints.setPercentHeight(sectionHeight);

        pane.getRowConstraints().add(constraints);
    }

    for (int i = 0 ; i < controls.length ; i++) {
        pane.add(controls[i], 0, i);
    }

    return pane;
}
 
Example #2
Source File: ChartsController.java    From trex-stateless-gui with Apache License 2.0 6 votes vote down vote up
public LayoutConfiguration(int columnsCount, int rowsCount) {
    this.columnsCount = columnsCount;
    this.rowsCount = rowsCount;

    columnConstraints = new ColumnConstraints[this.columnsCount];
    double columnPercentWidth = 100.0/this.columnsCount;
    for (int i = 0; i < this.columnsCount; ++i) {
        columnConstraints[i] = new ColumnConstraints();
        columnConstraints[i].setPercentWidth(columnPercentWidth);
    }

    rowConstraints = new RowConstraints[this.rowsCount];
    double rowPercentHeight = 100.0/this.rowsCount;
    for (int i = 0; i < this.rowsCount; ++i) {
        rowConstraints[i] = new RowConstraints();
        rowConstraints[i].setPercentHeight(rowPercentHeight);
    }
}
 
Example #3
Source File: GridPaneDetailPaneInfo.java    From scenic-view with GNU General Public License v3.0 6 votes vote down vote up
private void updateRowConstraints() {
    final GridPane gridpane = (GridPane) getTarget();

    final ObservableList<RowConstraints> rows = gridpane != null ? gridpane.getRowConstraints() : null;
    rowConstraintsDetail.setConstraints(rows);

    if (rows != null) {
        for (int rowIndex = 1; rowIndex <= rows.size(); rowIndex++) {
            final RowConstraints rc = rows.get(rowIndex - 1);
            int colIndex = 0;
            rowConstraintsDetail.add(Integer.toString(rowIndex - 1), colIndex++, rowIndex);
            rowConstraintsDetail.addSize(rc.getMinHeight(), rowIndex, colIndex++);
            rowConstraintsDetail.addSize(rc.getPrefHeight(), rowIndex, colIndex++);
            rowConstraintsDetail.addSize(rc.getMaxHeight(), rowIndex, colIndex++);
            rowConstraintsDetail.add(rc.getPercentHeight() != -1 ? f.format(rc.getPercentHeight()) : "-", colIndex++, rowIndex);
            rowConstraintsDetail.addObject(rc.getVgrow(), rowIndex, colIndex++);
            rowConstraintsDetail.addObject(rc.getValignment(), rowIndex, colIndex++);
            rowConstraintsDetail.add(Boolean.toString(rc.isFillHeight()), colIndex, rowIndex);
        }
    }
}
 
Example #4
Source File: ConversationBox.java    From constellation with Apache License 2.0 5 votes vote down vote up
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 #5
Source File: DisplayImageController.java    From Augendiagnose with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Show or hide the comment pane.
 *
 * @param visible
 *            Indicator if the pane should be visible.
 */
public final void showCommentPane(final boolean visible) {
	mDisplayImageView.storePosition();
	mCommentPane.setVisible(visible);
	mCommentPane.setManaged(visible);
	if (mCommentConstraints instanceof ColumnConstraints) {
		((ColumnConstraints) mCommentConstraints).setPercentWidth(visible ? 20 : 0); // MAGIC_NUMBER
	}
	if (mCommentConstraints instanceof RowConstraints) {
		((RowConstraints) mCommentConstraints).setPercentHeight(visible ? 20 : 0); // MAGIC_NUMBER
	}
	mDisplayImage.layout();
	mDisplayImageView.retrievePosition();
}
 
Example #6
Source File: RuleContainer.java    From G-Earth with MIT License 5 votes vote down vote up
private void initialize() {

        RowConstraints rowConstraints = new RowConstraints(23);
        getRowConstraints().addAll(rowConstraints);

        for (int i = 0; i < columnWidths.length; i++) {
            ColumnConstraints columnConstraints = new ColumnConstraints(20);
            columnConstraints.setPercentWidth(columnWidths[i]);
            getColumnConstraints().add(columnConstraints);
        }

        Label optionLabel = initNewLabelColumn(item.option().name());
        Label typeLabel = initNewLabelColumn(item.type().name());
        Label valueLabel = initNewLabelColumn(item.value());
        Label replacementLabel = initNewLabelColumn(item.replacement());
        Label destinationLabel = initNewLabelColumn(item.side().name());

        add(optionLabel, 0, 0);
        add(typeLabel, 1, 0);
        add(valueLabel, 2, 0);
        add(replacementLabel, 3,  0);
        add(destinationLabel, 4, 0);

        DeleteButton deleteButton = new DeleteButton();
        deleteButton.setAlignment(Pos.CENTER);
        deleteButton.show();

        RuleContainer thiss = this;
        item.onDelete(observable -> parent.getChildren().remove(thiss));
        deleteButton.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> item.delete());

        add(deleteButton, 5, 0);


        parent.getChildren().add(this);
    }
 
Example #7
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 #8
Source File: GridPaneDetailPaneInfo.java    From scenic-view with GNU General Public License v3.0 5 votes vote down vote up
@Override protected void createDetails() {
    gapDetail = addDetail("gap", "hgap/vgap:");
    alignmentDetail = addDetail("alignment", "alignment:");
    gridLinesVisibleDetail = addDetail("gridLinesVisible", "gridLinesVisible:");
    rowConstraintsDetail = addDetail("rows", "rowConstraints:", ValueType.GRID_CONSTRAINTS);
    columnConstraintsDetail = addDetail("columns", "columnConstraints:", ValueType.GRID_CONSTRAINTS);

    rowListener = new ListChangeListener<RowConstraints>() {
        @Override public void onChanged(final Change<? extends RowConstraints> change) {
            updateRowConstraints();
        }
    };
}
 
Example #9
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 #10
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 #11
Source File: ScatterPlot3DFXDemo3.java    From jfree-fxdemos with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Returns a panel containing the content for the demo.  This method is
 * used across all the individual demo applications to allow aggregation 
 * into a single "umbrella" demo (OrsonChartsDemo).
 * 
 * @return A panel containing the content for the demo.
 */
public static Node createDemoNode() {
    
    XYZDataset[] datasets = createDatasets();
    Chart3D chart1 = createChart(
            "Iris Dataset : Combination 1", datasets[0], "Sepal Length", 
            "Sepal Width", "Petal Length");
    chart1.setViewPoint(ViewPoint3D.createAboveLeftViewPoint(120));
    Chart3DViewer viewer1 = new Chart3DViewer(chart1);
    Chart3D chart2 = createChart(
            "Iris Dataset : Combination 2", datasets[1], 
            "Sepal Length", "Sepal Width", "Petal Width");
    chart2.setViewPoint(ViewPoint3D.createAboveLeftViewPoint(120));
    Chart3DViewer viewer2 = new Chart3DViewer(chart2);
    Chart3D chart3 = createChart(
            "Iris Dataset : Combination 3", datasets[2], 
            "Sepal Length", "Petal Width", "Petal Length");
    chart3.setViewPoint(ViewPoint3D.createAboveLeftViewPoint(120));
    Chart3DViewer viewer3 = new Chart3DViewer(chart3);
    Chart3D chart4 = createChart(
            "Iris Dataset : Combination 4", datasets[3], 
            "Sepal Width", "Petal Width", "Petal Length");
    chart4.setViewPoint(ViewPoint3D.createAboveLeftViewPoint(120));
    Chart3DViewer viewer4 = new Chart3DViewer(chart4);
    GridPane pane = new GridPane();
    ColumnConstraints c1 = new ColumnConstraints();
    c1.setPercentWidth(50);
    ColumnConstraints c2 = new ColumnConstraints();
    c2.setPercentWidth(50);
    pane.getColumnConstraints().addAll(c1, c2);
    RowConstraints r1 = new RowConstraints();
    r1.setPercentHeight(50);
    RowConstraints r2 = new RowConstraints();
    r2.setPercentHeight(50);
    pane.getRowConstraints().addAll(r1, r2);
    pane.add(viewer1, 0, 0);
    pane.add(viewer2, 0, 1);
    pane.add(viewer3, 1, 0);
    pane.add(viewer4, 1, 1);
    return pane;
}
 
Example #12
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 #13
Source File: OverviewDemo.java    From medusademo with Apache License 2.0 4 votes vote down vote up
@Override public void start(Stage stage) {
    GridPane pane = new GridPane();
    pane.add(framedGauge1, 0, 0);
    pane.add(framedGauge2, 1, 0);
    pane.add(gauge3, 2, 0);
    pane.add(gauge4, 3, 0);
    pane.add(gauge5, 4, 0);
    pane.add(clock1, 5, 0);
    pane.add(clock5, 6, 0);
    pane.add(gauge22, 7, 0);
    pane.add(gauge29, 8, 0);

    pane.add(gauge6, 0, 1);
    pane.add(gauge7, 1, 1);
    pane.add(gauge8, 2, 1);
    pane.add(gauge9, 3, 1);
    pane.add(gauge10, 4, 1);
    pane.add(clock2, 5, 1);
    pane.add(gauge21, 6, 1);
    pane.add(gauge23, 7, 1);
    pane.add(gauge30, 8, 1);

    pane.add(gauge11, 0, 2);
    pane.add(gauge12, 1, 2);
    pane.add(gauge13, 2, 2);
    pane.add(gauge14, 3, 2);
    pane.add(gauge15, 4, 2);
    pane.add(clock3, 5, 2);
    pane.add(clock6, 6, 2);
    pane.add(clock8, 7, 2);
    pane.add(gauge31, 8, 2);

    pane.add(gauge16, 0, 3);
    pane.add(gauge17, 1, 3);
    pane.add(gauge18, 2, 3);
    pane.add(gauge19, 3, 3);
    pane.add(gauge20, 4, 3);
    pane.add(clock4, 5, 3);
    pane.add(clock7, 6, 3);
    pane.add(gauge24, 7, 3);
    pane.add(clock12, 8, 3);

    pane.add(gauge25, 0, 4);
    pane.add(gauge26, 1, 4);
    pane.add(gauge27, 2, 4);
    pane.add(gauge28, 4, 4);
    pane.add(clock9, 5, 4);
    pane.add(clock10, 6, 4);
    pane.add(clock11, 7, 4);
    pane.setHgap(10);
    pane.setVgap(10);
    pane.setPadding(new Insets(10));
    for (int i = 0 ; i < 9 ; i++) {
        pane.getColumnConstraints().add(new ColumnConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE));
    }
    for (int i = 0 ; i < 5 ; i++) {
        pane.getRowConstraints().add(new RowConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE));
    }
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(90, 90, 90), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("Medusa Gauges and Clocks");
    stage.setScene(scene);
    stage.show();

    timer.start();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example #14
Source File: DhSettingsWidget.java    From BowlerStudio with GNU General Public License v3.0 4 votes vote down vote up
public DhSettingsWidget(DHLink dhLink,DHParameterKinematics device2,IOnEngineeringUnitsChange externalListener ){
	this.dhLink = dhLink;
	this.device2 = device2;

	this.externalListener = externalListener;
	
	delta= new EngineeringUnitsSliderWidget(this,
			0,
			200,
			dhLink.getDelta(),
			180," mm ");
	
	theta = new EngineeringUnitsSliderWidget(this,
			-180,
			180,
			Math.toDegrees(dhLink.getTheta()),
			180,"degrees");
	

	
	radius= new EngineeringUnitsSliderWidget(this,
			0,
			200,
			dhLink.getRadius(),
			180," mm ");
	
	alpha = new EngineeringUnitsSliderWidget(this,
													-180,
													180,
													Math.toDegrees(dhLink.getAlpha()),
													180,"degrees");
	
	GridPane gridpane = new GridPane();
	gridpane.getColumnConstraints().add(new ColumnConstraints(120)); // column 1 is 75 wide
    gridpane.getColumnConstraints().add(new ColumnConstraints(320)); // column 2 is 300 wide
    gridpane.getColumnConstraints().add(new ColumnConstraints(100)); // column 2 is 100 wide
    gridpane.getRowConstraints().add(new RowConstraints(50)); // 
    gridpane.getRowConstraints().add(new RowConstraints(50)); // 
    gridpane.getRowConstraints().add(new RowConstraints(50)); // 
    gridpane.getRowConstraints().add(new RowConstraints(50)); // 
	gridpane.add(new Text("Delta (Height)"), 0, 0);
	gridpane.add(delta, 1, 0);
	gridpane.add(new Text("Radius (Length)"), 0, 1);
	gridpane.add(radius, 1, 1);

	gridpane.getColumnConstraints().add(new ColumnConstraints(120)); // column 1 is 75 wide
    gridpane.getColumnConstraints().add(new ColumnConstraints(320)); // column 2 is 300 wide
    gridpane.getColumnConstraints().add(new ColumnConstraints(100)); // column 2 is 100 wide
    gridpane.getRowConstraints().add(new RowConstraints(50)); // 
    gridpane.getRowConstraints().add(new RowConstraints(50)); // 
	gridpane.add(new Text("Theta"), 0, 2);
	gridpane.add(theta, 1, 2);
	gridpane.add(new Text("Alpha"), 0, 3);
	gridpane.add(alpha, 1, 3);
	
	getChildren().add(gridpane);
}
 
Example #15
Source File: Demo.java    From Medusa with Apache License 2.0 4 votes vote down vote up
@Override public void start(Stage stage) {
    GridPane pane = new GridPane();
    pane.add(gauge1, 0, 0);
    pane.add(gauge2, 1, 0);
    pane.add(gauge3, 2, 0);
    pane.add(gauge4, 3, 0);
    pane.add(gauge5, 4, 0);
    pane.add(clock1, 5, 0);
    pane.add(clock5, 6, 0);
    pane.add(gauge22, 7, 0);
    pane.add(gauge29, 8, 0);

    pane.add(gauge6, 0, 1);
    pane.add(gauge7, 1, 1);
    pane.add(gauge8, 2, 1);
    pane.add(gauge9, 3, 1);
    pane.add(gauge10, 4, 1);
    pane.add(clock2, 5, 1);
    pane.add(gauge21, 6, 1);
    pane.add(gauge23, 7, 1);
    pane.add(gauge30, 8, 1);

    pane.add(gauge11, 0, 2);
    pane.add(gauge12, 1, 2);
    pane.add(gauge13, 2, 2);
    pane.add(gauge14, 3, 2);
    pane.add(gauge15, 4, 2);
    pane.add(clock3, 5, 2);
    pane.add(clock6, 6, 2);
    pane.add(clock8, 7, 2);
    pane.add(gauge31, 8, 2);

    pane.add(gauge16, 0, 3);
    pane.add(gauge17, 1, 3);
    pane.add(gauge18, 2, 3);
    pane.add(gauge19, 3, 3);
    pane.add(gauge20, 4, 3);
    pane.add(clock4, 5, 3);
    pane.add(clock7, 6, 3);
    pane.add(gauge24, 7, 3);
    pane.add(clock12, 8, 3);

    pane.add(gauge25, 0, 4);
    pane.add(gauge26, 1, 4);
    pane.add(gauge27, 2, 4);
    pane.add(gauge28, 4, 4);
    pane.add(clock9, 5, 4);
    pane.add(clock10, 6, 4);
    pane.add(clock11, 7, 4);
    pane.setHgap(10);
    pane.setVgap(10);
    pane.setPadding(new Insets(10));
    for (int i = 0 ; i < 9 ; i++) {
        pane.getColumnConstraints().add(new ColumnConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE));
    }
    for (int i = 0 ; i < 5 ; i++) {
        pane.getRowConstraints().add(new RowConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE));
    }
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(90, 90, 90), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("Medusa Gauges and Clocks");
    stage.setScene(scene);
    stage.show();

    timer.start();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example #16
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 );
  

}
 
Example #17
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 #18
Source File: FXStockChart.java    From Rails with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a {@link RowConstraints} object with the given height factor.
 * The height factor defines, how much higher the row is compared to other columns.
 * A factor of 2 means, that the row is twice as high as a row with the factor 1
 *
 * @param factor The height factor
 * @return The created constraint
 */
private RowConstraints createRow(int factor) {
    RowConstraints constraints = new RowConstraints();

    constraints.setPercentHeight(100d / ((market.getNumberOfRows() * 2) + 1) * factor);

    return constraints;
}
 
Example #19
Source File: ChartsController.java    From trex-stateless-gui with Apache License 2.0 votes vote down vote up
public RowConstraints[] getRowConstraints() { return rowConstraints; }