Java Code Examples for javafx.scene.layout.ColumnConstraints

The following examples show how to use javafx.scene.layout.ColumnConstraints. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: constellation   Source File: PluginParametersPane.java    License: Apache License 2.0 6 votes vote down vote up
private void addElements(final PluginParametersNode node, final Region... elements) {
    final HBox singleParam = new HBox();
    singleParam.setSpacing(10);
    for (Region element : elements) {
        if (element != null) {
            singleParam.getChildren().addAll(element);
        }
    }
    ColumnConstraints paramConstraints = new ColumnConstraints();
    if (!SHOULD_NOT_EXPAND.contains(node.getParameter().getType().getId())) {
        singleParam.setMinWidth(USE_PREF_SIZE);
    }
    paramConstraints.minWidthProperty().bind(singleParam.minWidthProperty());
    paramGroupGridPane.getColumnConstraints().add(paramConstraints);
    paramGroupGridPane.add(singleParam, currentCol++, 0);
}
 
Example 2
private void updateColumnConstraints() {
    final GridPane gridpane = (GridPane) getTarget();

    final ObservableList<ColumnConstraints> columns = gridpane != null ? gridpane.getColumnConstraints() : null;
    columnConstraintsDetail.setConstraints(columns);

    if (columns != null) {
        for (int rowIndex = 1; rowIndex <= columns.size(); rowIndex++) {
            final ColumnConstraints cc = columns.get(rowIndex - 1);
            int colIndex = 0;
            columnConstraintsDetail.add(Integer.toString(rowIndex - 1), colIndex++, rowIndex);
            columnConstraintsDetail.addSize(cc.getMinWidth(), rowIndex, colIndex++);
            columnConstraintsDetail.addSize(cc.getPrefWidth(), rowIndex, colIndex++);
            columnConstraintsDetail.addSize(cc.getMaxWidth(), rowIndex, colIndex++);
            columnConstraintsDetail.add(cc.getPercentWidth() != -1 ? f.format(cc.getPercentWidth()) : "-", colIndex++, rowIndex);
            columnConstraintsDetail.addObject(cc.getHgrow(), rowIndex, colIndex++);
            columnConstraintsDetail.addObject(cc.getHalignment(), rowIndex, colIndex++);
            columnConstraintsDetail.add(Boolean.toString(cc.isFillWidth()), colIndex, rowIndex);
        }
    }
}
 
Example 3
Source Project: trex-stateless-gui   Source File: ChartsController.java    License: 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 4
/**
 * Creates a new {@link GridPane} containing the properties of the selected shortcut
 *
 * @return a new {@link GridPane} containing the properties of the selected shortcut
 */
private GridPane createPropertiesGrid() {
    final GridPane propertiesGrid = new GridPane();
    propertiesGrid.getStyleClass().add("grid");

    ColumnConstraints titleColumn = new ColumnConstraintsWithPercentage(30);
    ColumnConstraints valueColumn = new ColumnConstraintsWithPercentage(70);

    propertiesGrid.getColumnConstraints().addAll(titleColumn, valueColumn);

    // ensure that changes to the shortcutProperties map result in updates to the GridPane
    shortcutProperties.addListener((Observable invalidation) -> updateProperties(propertiesGrid));
    // initialize the properties grid correctly
    updateProperties(propertiesGrid);

    return propertiesGrid;
}
 
Example 5
Source Project: Schillsaver   Source File: JFXHelper.java    License: MIT License 6 votes vote down vote up
/**
 * Creates a GridPane with only one row, but where there are as many equal sized columns as there are
 * controls passed to the function.
 *
 * Ex:
 *      If you pass in two controls, then there will be one row with two columns where each column uses
 *      50% of the width.
 *
 * Ex:
 *      If you pass in four controls, then there will be one row with four columns where each column uses
 *      25% of the width.
 *
 * @param controls
 *          The controls.
 *
 * @return
 *          The pane.
 */
public static GridPane createHorizontalGridPane(final Control... controls) {
    if (controls.length == 0) {
        return new GridPane();
    }

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

    for (final Control ignored : controls) {
        final ColumnConstraints constraints = new ColumnConstraints();
        constraints.setPercentWidth(sectionWidth);

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

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

    return pane;
}
 
Example 6
Source Project: bisq   Source File: ProposalDisplay.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("Duplicates")
public ScrollPane getView() {
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);

    AnchorPane anchorPane = new AnchorPane();
    scrollPane.setContent(anchorPane);

    gridPane.setHgap(5);
    gridPane.setVgap(5);

    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setPercentWidth(100);

    gridPane.getColumnConstraints().addAll(columnConstraints1);

    AnchorPane.setBottomAnchor(gridPane, 10d);
    AnchorPane.setRightAnchor(gridPane, 10d);
    AnchorPane.setLeftAnchor(gridPane, 10d);
    AnchorPane.setTopAnchor(gridPane, 10d);
    anchorPane.getChildren().add(gridPane);

    return scrollPane;
}
 
Example 7
Source Project: PeerWasp   Source File: ActivityItemCell.java    License: MIT License 6 votes vote down vote up
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 8
Source Project: constellation   Source File: EasyGridPane.java    License: Apache License 2.0 5 votes vote down vote up
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 9
Source Project: constellation   Source File: ConversationBox.java    License: 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 10
Source Project: constellation   Source File: AttributeEditorPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void updateItem(Object item, boolean empty) {
    super.updateItem(item, empty);

    AbstractAttributeInteraction<?> interaction = AbstractAttributeInteraction.getInteraction(attrDataType);
    final String displayText;
    final List<Node> displayNodes;
    if (item == null) {
        displayText = NO_VALUE_TEXT;
        displayNodes = Collections.emptyList();
    } else {
        displayText = interaction.getDisplayText(item);
        displayNodes = interaction.getDisplayNodes(item, -1, CELL_HEIGHT - 1);
    }

    GridPane gridPane = new GridPane();
    gridPane.setHgap(CELL_ITEM_SPACING);
    ColumnConstraints displayNodeConstraint = new ColumnConstraints(CELL_HEIGHT - 1);
    displayNodeConstraint.setHalignment(HPos.CENTER);

    for (int i = 0; i < displayNodes.size(); i++) {
        final Node displayNode = displayNodes.get(i);
        gridPane.add(displayNode, i, 0);
        gridPane.getColumnConstraints().add(displayNodeConstraint);
    }

    setGraphic(gridPane);
    setPrefHeight(CELL_HEIGHT);
    setText(displayText);
}
 
Example 11
Source Project: mzmine3   Source File: SpectralMatchPanelFX.java    License: GNU General Public License v2.0 5 votes vote down vote up
private GridPane createTitlePane() {
  pnTitle = new GridPane();
  pnTitle.setAlignment(Pos.CENTER);

  // create Top panel
  double simScore = hit.getSimilarity().getScore();
  Color gradientCol = FxColorUtil.awtColorToFX(ColorScaleUtil
      .getColor(FxColorUtil.fxColorToAWT(MIN_COS_COLOR), FxColorUtil.fxColorToAWT(MAX_COS_COLOR),
          MIN_COS_COLOR_VALUE, MAX_COS_COLOR_VALUE, simScore));
  pnTitle.setBackground(
      new Background(new BackgroundFill(gradientCol, CornerRadii.EMPTY, Insets.EMPTY)));

  lblHit = new Label(hit.getName());
  lblHit.getStyleClass().add("white-larger-label");

  lblScore = new Label(COS_FORM.format(simScore));
  lblScore.getStyleClass().add("white-score-label");
  lblScore
      .setTooltip(new Tooltip("Cosine similarity of raw data scan (top, blue) and database scan: "
          + COS_FORM.format(simScore)));

  pnTitle.add(lblHit, 0, 0);
  pnTitle.add(lblScore, 1, 0);
  ColumnConstraints ccTitle0 = new ColumnConstraints(150, -1, -1, Priority.ALWAYS, HPos.LEFT,
      true);
  ColumnConstraints ccTitle1 = new ColumnConstraints(150, 150, 150, Priority.NEVER, HPos.LEFT,
      false);
  pnTitle.getColumnConstraints().add(0, ccTitle0);
  pnTitle.getColumnConstraints().add(1, ccTitle1);

  return pnTitle;
}
 
Example 12
Source Project: WorkbenchFX   Source File: PatientView.java    License: 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 13
Source Project: G-Earth   Source File: RuleContainer.java    License: 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 14
Source Project: marathonv5   Source File: FormPane.java    License: Apache License 2.0 5 votes vote down vote up
public FormPane(String styleClass, int columns) {
    this.columns = columns;
    getStyleClass().addAll("form-pane", styleClass);
    ColumnConstraints cc = new ColumnConstraints();
    cc.setMinWidth(Region.USE_PREF_SIZE);
    getColumnConstraints().add(cc);
    getStyleClass().add(StyleClassHelper.BACKGROUND);
}
 
Example 15
Source Project: netbeans   Source File: WebViewBrowser.java    License: Apache License 2.0 5 votes vote down vote up
public WebViewPane() {
    VBox.setVgrow(this, Priority.ALWAYS);
    setMaxWidth(Double.MAX_VALUE);
    setMaxHeight(Double.MAX_VALUE);

    WebView view = new WebView();
    view.setMinSize(500, 400);
    view.setPrefSize(500, 400);
    final WebEngine eng = view.getEngine();
    eng.load("http://www.oracle.com/us/index.html");
    final TextField locationField = new TextField("http://www.oracle.com/us/index.html");
    locationField.setMaxHeight(Double.MAX_VALUE);
    Button goButton = new Button("Go");
    goButton.setDefaultButton(true);
    EventHandler<ActionEvent> goAction = new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent event) {
            eng.load(locationField.getText().startsWith("http://") ? locationField.getText() :
                    "http://" + locationField.getText());
        }
    };
    goButton.setOnAction(goAction);
    locationField.setOnAction(goAction);
    eng.locationProperty().addListener(new ChangeListener<String>() {
        @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            locationField.setText(newValue);
        }
    });
    GridPane grid = new GridPane();
    grid.setVgap(5);
    grid.setHgap(5);
    GridPane.setConstraints(locationField, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
    GridPane.setConstraints(goButton,1,0);
    GridPane.setConstraints(view, 0, 1, 2, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
    grid.getColumnConstraints().addAll(
            new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true),
            new ColumnConstraints(40, 40, 40, Priority.NEVER, HPos.CENTER, true)
    );
    grid.getChildren().addAll(locationField, goButton, view);
    getChildren().add(grid);
}
 
Example 16
Source Project: pattypan   Source File: Util.java    License: MIT License 5 votes vote down vote up
public static ColumnConstraints newColumn(int value, String unit, HPos position) {
  ColumnConstraints col = new ColumnConstraints();
  if (unit.equals("%")) {
    col.setPercentWidth(value);
  }
  if (unit.equals("px")) {
    col.setMaxWidth(value);
    col.setMinWidth(value);
  }

  if (position != null) {
    col.setHalignment(position);
  }
  return col;
}
 
Example 17
public void initStats() {
    String fontSize="-fx-font-size: 0.9em;";
    getMdBox().getMainApp().getMenuController().getHBottomBox().getChildren().clear();
    getMdBox().getMainApp().getMenuController().getHBottomBox().getColumnConstraints().clear();
    getMdBox().getMainApp().getMenuController().getHBottomBox().setPadding(new Insets(5, 5, 5, 5));
    ColumnConstraints c1 = new ColumnConstraints();
    ColumnConstraints c2 = new ColumnConstraints();
    ColumnConstraints c3 = new ColumnConstraints();
    ColumnConstraints c4 = new ColumnConstraints();
    c1.setPercentWidth(50);
    c2.setPercentWidth(20);
    c3.setPercentWidth(15);
    c4.setPercentWidth(15);
    Label chars = new Label();
    Label words = new Label();
    Label times = new Label();
    chars.setStyle(fontSize);
    words.setStyle(fontSize);
    times.setStyle(fontSize);
    getMdBox().getMainApp().getMenuController().getHBottomBox().getColumnConstraints().addAll(c1, c2, c3, c4);
    getMdBox().getMainApp().getMenuController().getHBottomBox().add(times, 1, 0);
    getMdBox().getMainApp().getMenuController().getHBottomBox().add(chars, 2, 0);
    getMdBox().getMainApp().getMenuController().getHBottomBox().add(words, 3, 0);

    chars.textProperty().bind(countChars);
    words.textProperty().bind(countWords);
    times.textProperty().bind(countTimes);
    performStats();
}
 
Example 18
Source Project: density-converter   Source File: GUIController.java    License: Apache License 2.0 5 votes vote down vote up
private void setupLayout() {
    ColumnConstraints column1M = new ColumnConstraints();
    column1M.setPercentWidth(20);
    ColumnConstraints column2M = new ColumnConstraints();
    column2M.setPercentWidth(56);
    ColumnConstraints column3M = new ColumnConstraints();
    column3M.setPercentWidth(12);
    ColumnConstraints column4M = new ColumnConstraints();
    column4M.setPercentWidth(12);
    rootGridPane.getColumnConstraints().addAll(column1M, column2M, column3M, column4M);

    ColumnConstraints column1 = new ColumnConstraints();
    column1.setPercentWidth(20);
    ColumnConstraints column2 = new ColumnConstraints();
    column2.setPercentWidth(30);
    ColumnConstraints column3 = new ColumnConstraints();
    column3.setPercentWidth(20);
    ColumnConstraints column4 = new ColumnConstraints();
    column4.setPercentWidth(30);
    gridPaneChoiceBoxes.getColumnConstraints().addAll(column1, column2, column3, column4);

    ColumnConstraints column1C = new ColumnConstraints();
    column1C.setPercentWidth(50);
    ColumnConstraints column2C = new ColumnConstraints();
    column2C.setPercentWidth(50);
    gridPaneOptionsCheckboxes.getColumnConstraints().addAll(column1C, column2C);
    gridPanePostProcessors.getColumnConstraints().addAll(column1C, column2C);

    ColumnConstraints column1D = new ColumnConstraints();
    column1D.setPercentWidth(25);
    ColumnConstraints column2D = new ColumnConstraints();
    column2D.setPercentWidth(25);
    ColumnConstraints column3D = new ColumnConstraints();
    column3D.setPercentWidth(25);
    ColumnConstraints column4D = new ColumnConstraints();
    column4D.setPercentWidth(25);
    gridPaneToggleGroup.getColumnConstraints().addAll(column1D, column2D, column3D, column4D);
}
 
Example 19
Source Project: JRemapper   Source File: CodePane.java    License: MIT License 5 votes vote down vote up
/**
 * Setup everything else that isn't the code-area.
 */
private void setupTheRest() {
	info.setPrefHeight(95);
	info.getStyleClass().add("infopane");
	ColumnConstraints colInfo = new ColumnConstraints();
	ColumnConstraints colEdit = new ColumnConstraints();
	colInfo.setPercentWidth(15);
	colEdit.setPercentWidth(85);
	info.getColumnConstraints().addAll(colInfo, colEdit);
	setTop(info);
	pane.animationDurationProperty().setValue(Duration.millis(50));
	pane.setContent(new VirtualizedScrollPane<>(code));
	setCenter(pane);
}
 
Example 20
/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    final GridPane container = new GridPane();
    container.getStyleClass().add("compactListElement");

    List<ColumnConstraints> constraints = new ArrayList<>();

    // add the miniature icon
    container.add(createMiniature(), 0, 0);

    constraints.add(new ColumnConstraints());

    // add the title label
    container.add(createTitle(), 1, 0);

    constraints.add(new ColumnConstraintsWithPercentage(40));

    // add the additional information
    getControl().getAdditionalInformation().forEach(information -> {
        final Label informationLabel = new Label(information.getContent());
        informationLabel.getStyleClass().add("information");

        container.add(informationLabel, constraints.size(), 0);

        constraints.add(new ColumnConstraintsWithPercentage(information.getWidth()));
    });

    // set the last constraint to fill the remaining space
    constraints.set(constraints.size() - 1, new ColumnConstraints());

    container.getColumnConstraints().setAll(constraints);

    getChildren().addAll(container);
}
 
Example 21
/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    final GridPane container = new GridPane();
    container.getStyleClass().add("detailsListElement");

    final List<ColumnConstraints> constraints = new ArrayList<>();

    // add the title label
    container.add(createTitle(), 0, 0);

    constraints.add(new ColumnConstraintsWithPercentage(30));

    // TODO: the skin should react to changes done to the additional information list
    // TODO: the skin should react to changes done to the detailed information list
    Stream.concat(getControl().getAdditionalInformation().stream(), getControl().getDetailedInformation().stream())
            .forEach(information -> {
                final Label informationLabel = new Label(information.getContent());
                informationLabel.setWrapText(true);
                informationLabel.getStyleClass().add("information");

                container.add(informationLabel, constraints.size(), 0);

                constraints.add(new ColumnConstraintsWithPercentage(information.getWidth()));
            });

    // set the last constraint to fill the remaining space
    constraints.set(constraints.size() - 1, new ColumnConstraints());

    container.getColumnConstraints().setAll(constraints);

    getChildren().addAll(container);
}
 
Example 22
/**
 * Creates a new {@link GridPane} containing the control buttons for the selected shortcut.
 * These control buttons consist of:
 * <ul>
 * <li>The run button</li>
 * <li>The stop button</li>
 * <li>The uninstall button</li>
 * </ul>
 *
 * @return A new {@link GridPane} containing the control buttons for the selected shortcut
 */
private GridPane createControlButtons() {
    final GridPane controlButtons = new GridPane();
    controlButtons.getStyleClass().add("shortcut-control-button-group");

    ColumnConstraints runColumn = new ColumnConstraintsWithPercentage(25);
    ColumnConstraints stopColumn = new ColumnConstraintsWithPercentage(25);
    ColumnConstraints uninstallColumn = new ColumnConstraintsWithPercentage(25);
    ColumnConstraints editColumn = new ColumnConstraintsWithPercentage(25);

    controlButtons.getColumnConstraints().addAll(runColumn, stopColumn, uninstallColumn, editColumn);

    final Button runButton = new Button(tr("Run"));
    runButton.getStyleClass().addAll("shortcutButton", "runButton");
    runButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutRun())
            .ifPresent(onShortcutRun -> onShortcutRun.accept(getControl().getShortcut())));
    GridPane.setHalignment(runButton, HPos.CENTER);

    final Button stopButton = new Button(tr("Close"));
    stopButton.getStyleClass().addAll("shortcutButton", "stopButton");
    stopButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutStop())
            .ifPresent(onShortcutStop -> onShortcutStop.accept(getControl().getShortcut())));
    GridPane.setHalignment(stopButton, HPos.CENTER);

    final Button uninstallButton = new Button(tr("Uninstall"));
    uninstallButton.getStyleClass().addAll("shortcutButton", "uninstallButton");
    uninstallButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutUninstall())
            .ifPresent(onShortcutUninstall -> onShortcutUninstall.accept(getControl().getShortcut())));
    GridPane.setHalignment(uninstallButton, HPos.CENTER);

    final Button editButton = new Button(tr("Edit"));
    editButton.getStyleClass().addAll("shortcutButton", "editButton");
    editButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutEdit())
            .ifPresent(onShortcutEdit -> onShortcutEdit.accept(getControl().getShortcut())));
    GridPane.setHalignment(editButton, HPos.CENTER);

    controlButtons.addRow(0, runButton, stopButton, uninstallButton, editButton);

    return controlButtons;
}
 
Example 23
public DelayPane(DelayedStartListener listener) {
	getColumnConstraints().add(new ColumnConstraints(100));
	setVgap(5);

	final Label instructionsLabel = new Label("Set interval within which a beep will sound\n"
			+ "to signal the start of a round.\nDefault: A round starts after a random wait\n"
			+ "between 4 and 8 seconds in length.\n");
	instructionsLabel.setPrefSize(300, 77);

	this.add(instructionsLabel, 0, 0, 2, 3);
	addRow(3, new Label("Min (s)"));
	addRow(4, new Label("Max (s)"));

	final TextField minTextField = new TextField("4");
	this.add(minTextField, 1, 3);

	final TextField maxTextField = new TextField("8");
	this.add(maxTextField, 1, 4);

	minTextField.textProperty().addListener((observable, oldValue, newValue) -> {
		if (!newValue.matches("\\d*")) {
			minTextField.setText(oldValue);
			minTextField.positionCaret(minTextField.getLength());
		} else {
			listener.updatedDelayedStartInterval(Integer.parseInt(minTextField.getText()),
					Integer.parseInt(maxTextField.getText()));
		}
	});

	maxTextField.textProperty().addListener((observable, oldValue, newValue) -> {
		if (!newValue.matches("\\d*")) {
			maxTextField.setText(oldValue);
			maxTextField.positionCaret(maxTextField.getLength());
		} else {
			listener.updatedDelayedStartInterval(Integer.parseInt(minTextField.getText()),
					Integer.parseInt(maxTextField.getText()));
		}
	});
}
 
Example 24
@SuppressWarnings("Duplicates")
@Override
protected void createGridPane() {
    gridPane = new GridPane();
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    gridPane.setPadding(new Insets(64, 64, 64, 64));
    gridPane.setPrefWidth(width);

    ColumnConstraints columnConstraints = new ColumnConstraints();
    columnConstraints.setPercentWidth(100);
    gridPane.getColumnConstraints().add(columnConstraints);
}
 
Example 25
@SuppressWarnings("Duplicates")
@Override
protected void createGridPane() {
    gridPane = new GridPane();
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    gridPane.setPadding(new Insets(64, 64, 64, 64));
    gridPane.setPrefWidth(width);

    ColumnConstraints columnConstraints = new ColumnConstraints();
    columnConstraints.setPercentWidth(100);
    gridPane.getColumnConstraints().add(columnConstraints);
}
 
Example 26
Source Project: bisq   Source File: Overlay.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
protected void createGridPane() {
    gridPane = new GridPane();
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    gridPane.setPadding(new Insets(64, 64, 64, 64));
    gridPane.setPrefWidth(width);

    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.SOMETIMES);
    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
}
 
Example 27
private GridPane createVotesTable() {
    GridPane votesGridPane = new GridPane();
    votesGridPane.setHgap(5);
    votesGridPane.setVgap(5);
    votesGridPane.setPadding(new Insets(15));

    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.ALWAYS);
    votesGridPane.getColumnConstraints().addAll(columnConstraints1);

    int gridRow = 0;

    TableGroupHeadline votesTableHeader = new TableGroupHeadline(Res.get("dao.results.proposals.voting.detail.header"));
    GridPane.setRowIndex(votesTableHeader, gridRow);
    GridPane.setMargin(votesTableHeader, new Insets(8, 0, 0, 0));
    GridPane.setColumnSpan(votesTableHeader, 2);
    votesGridPane.getChildren().add(votesTableHeader);

    TableView<VoteListItem> votesTableView = new TableView<>();
    votesTableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
    votesTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    createColumns(votesTableView);
    GridPane.setRowIndex(votesTableView, gridRow);
    GridPane.setMargin(votesTableView, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 0));
    GridPane.setColumnSpan(votesTableView, 2);
    GridPane.setVgrow(votesTableView, Priority.ALWAYS);
    votesGridPane.getChildren().add(votesTableView);

    votesTableView.setItems(sortedVotes);

    addCloseButton(votesGridPane, ++gridRow);

    return votesGridPane;
}
 
Example 28
Source Project: bisq   Source File: CandleTooltip.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
CandleTooltip(StringConverter<Number> priceStringConverter) {
    this.priceStringConverter = priceStringConverter;

    setHgap(Layout.GRID_GAP);

    setVgap(2);

    Label open = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.open"));
    Label close = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.close"));
    Label high = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.high"));
    Label low = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.low"));
    Label average = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.average"));
    Label median = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.median"));
    Label date = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.date"));
    setConstraints(open, 0, 0);
    setConstraints(openValue, 1, 0);
    setConstraints(close, 0, 1);
    setConstraints(closeValue, 1, 1);
    setConstraints(high, 0, 2);
    setConstraints(highValue, 1, 2);
    setConstraints(low, 0, 3);
    setConstraints(lowValue, 1, 3);
    setConstraints(average, 0, 4);
    setConstraints(averageValue, 1, 4);
    setConstraints(median, 0, 5);
    setConstraints(medianValue, 1, 5);
    setConstraints(date, 0, 6);
    setConstraints(dateValue, 1, 6);

    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.NEVER);
    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);
    getColumnConstraints().addAll(columnConstraints1, columnConstraints2);

    getChildren().addAll(open, openValue, close, closeValue, high, highValue, low, lowValue, average, averageValue, median, medianValue, date, dateValue);
}
 
Example 29
Source Project: bisq   Source File: MutableOfferView.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
private void addGridPane() {
    gridPane = new GridPane();
    gridPane.getStyleClass().add("content-pane");
    gridPane.setPadding(new Insets(30, 25, -1, 25));
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.NEVER);
    columnConstraints1.setMinWidth(200);
    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
    scrollPane.setContent(gridPane);
}
 
Example 30
Source Project: bisq   Source File: TakeOfferView.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
private void addGridPane() {
    gridPane = new GridPane();
    gridPane.getStyleClass().add("content-pane");
    gridPane.setPadding(new Insets(15, 15, -1, 15));
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.NEVER);
    columnConstraints1.setMinWidth(200);
    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
    scrollPane.setContent(gridPane);
}