Example usage for javafx.scene.layout GridPane setColumnIndex

List of usage examples for javafx.scene.layout GridPane setColumnIndex

Introduction

In this page you can find the example usage for javafx.scene.layout GridPane setColumnIndex.

Prototype

public static void setColumnIndex(Node child, Integer value) 

Source Link

Document

Sets the column index for the child when contained by a gridpane so that it will be positioned starting in that column of the gridpane.

Usage

From source file:io.bitsquare.gui.components.paymentmethods.OKPayForm.java

private void addCurrenciesGrid(boolean isEditable) {
    Label label = addLabel(gridPane, ++gridRow, "Supported currencies:", 0);
    GridPane.setValignment(label, VPos.TOP);
    FlowPane flowPane = new FlowPane();
    flowPane.setPadding(new Insets(10, 10, 10, 10));
    flowPane.setVgap(10);/*w ww .j a  v a2s .com*/
    flowPane.setHgap(10);

    if (isEditable)
        flowPane.setId("flow-pane-checkboxes-bg");
    else
        flowPane.setId("flow-pane-checkboxes-non-editable-bg");

    CurrencyUtil.getAllOKPayCurrencies().stream().forEach(e -> {
        CheckBox checkBox = new CheckBox(e.getCode());
        checkBox.setMouseTransparent(!isEditable);
        checkBox.setSelected(okPayAccount.getTradeCurrencies().contains(e));
        checkBox.setMinWidth(60);
        checkBox.setMaxWidth(checkBox.getMinWidth());
        checkBox.setTooltip(new Tooltip(e.getName()));
        checkBox.setOnAction(event -> {
            if (checkBox.isSelected())
                okPayAccount.addCurrency(e);
            else
                okPayAccount.removeCurrency(e);

            updateAllInputsValid();
        });
        flowPane.getChildren().add(checkBox);
    });

    GridPane.setRowIndex(flowPane, gridRow);
    GridPane.setColumnIndex(flowPane, 1);
    gridPane.getChildren().add(flowPane);
}

From source file:io.bitsquare.gui.components.paymentmethods.SepaForm.java

@Override
public void addFormForAddAccount() {
    gridRowFrom = gridRow + 1;/*w w w.j av a  2  s .  c o  m*/

    InputTextField holderNameInputTextField = addLabelInputTextField(gridPane, ++gridRow,
            "Account holder name:").second;
    holderNameInputTextField.setValidator(inputValidator);
    holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        sepaAccount.setHolderName(newValue);
        updateFromInputs();
    });

    ibanInputTextField = addLabelInputTextField(gridPane, ++gridRow, "IBAN:").second;
    ibanInputTextField.setValidator(ibanValidator);
    ibanInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        sepaAccount.setIban(newValue);
        updateFromInputs();

    });
    bicInputTextField = addLabelInputTextField(gridPane, ++gridRow, "BIC:").second;
    bicInputTextField.setValidator(bicValidator);
    bicInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        sepaAccount.setBic(newValue);
        updateFromInputs();

    });

    addLabel(gridPane, ++gridRow, "Country of bank:");
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    ComboBox<Country> countryComboBox = new ComboBox<>();
    currencyComboBox = new ComboBox<>();
    currencyTextField = new TextField("");
    currencyTextField.setEditable(false);
    currencyTextField.setMouseTransparent(true);
    currencyTextField.setFocusTraversable(false);
    currencyTextField.setMinWidth(300);

    currencyTextField.setVisible(false);
    currencyTextField.setManaged(false);
    currencyComboBox.setVisible(false);
    currencyComboBox.setManaged(false);

    hBox.getChildren().addAll(countryComboBox, currencyTextField, currencyComboBox);
    GridPane.setRowIndex(hBox, gridRow);
    GridPane.setColumnIndex(hBox, 1);
    gridPane.getChildren().add(hBox);

    countryComboBox.setPromptText("Select country of bank");
    countryComboBox.setConverter(new StringConverter<Country>() {
        @Override
        public String toString(Country country) {
            return country.name + " (" + country.code + ")";
        }

        @Override
        public Country fromString(String s) {
            return null;
        }
    });
    countryComboBox.setOnAction(e -> {
        Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem();
        sepaAccount.setCountry(selectedItem);
        TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(selectedItem.code);
        setupCurrency(selectedItem, currency);

        updateCountriesSelection(true, euroCountryCheckBoxes);
        updateCountriesSelection(true, nonEuroCountryCheckBoxes);
        updateFromInputs();
    });

    addEuroCountriesGrid(true);
    addNonEuroCountriesGrid(true);
    addAllowedPeriod();
    addAccountNameTextFieldWithAutoFillCheckBox();

    countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllSepaCountries()));
    Country country = CountryUtil.getDefaultCountry();
    if (CountryUtil.getAllSepaCountries().contains(country)) {
        countryComboBox.getSelectionModel().select(country);
        sepaAccount.setCountry(country);
        TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(country.code);
        setupCurrency(country, currency);
    }

    updateFromInputs();
}

From source file:io.bitsquare.gui.components.paymentmethods.SepaForm.java

private void addCountriesGrid(boolean isEditable, String title, List<CheckBox> checkBoxList,
        List<Country> dataProvider) {
    Label label = addLabel(gridPane, ++gridRow, title, 0);
    label.setWrapText(true);/*from  w w w. j  a v a2 s .  c o  m*/
    label.setMaxWidth(180);
    label.setTextAlignment(TextAlignment.RIGHT);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setValignment(label, VPos.TOP);
    FlowPane flowPane = new FlowPane();
    flowPane.setPadding(new Insets(10, 10, 10, 10));
    flowPane.setVgap(10);
    flowPane.setHgap(10);
    flowPane.setMinHeight(55);

    if (isEditable)
        flowPane.setId("flow-pane-checkboxes-bg");
    else
        flowPane.setId("flow-pane-checkboxes-non-editable-bg");

    dataProvider.stream().forEach(country -> {
        final String countryCode = country.code;
        CheckBox checkBox = new CheckBox(countryCode);
        checkBox.setUserData(countryCode);
        checkBoxList.add(checkBox);
        checkBox.setMouseTransparent(!isEditable);
        checkBox.setMinWidth(45);
        checkBox.setMaxWidth(45);
        checkBox.setTooltip(new Tooltip(country.name));
        checkBox.setOnAction(event -> {
            if (checkBox.isSelected())
                sepaAccount.addAcceptedCountry(countryCode);
            else
                sepaAccount.removeAcceptedCountry(countryCode);

            updateAllInputsValid();
        });
        flowPane.getChildren().add(checkBox);
    });
    updateCountriesSelection(isEditable, checkBoxList);

    GridPane.setRowIndex(flowPane, gridRow);
    GridPane.setColumnIndex(flowPane, 1);
    gridPane.getChildren().add(flowPane);
}

From source file:io.bitsquare.gui.main.overlays.Overlay.java

protected void addMessage() {
    if (message != null) {
        messageLabel = new Label(truncatedMessage);
        messageLabel.setMouseTransparent(true);
        messageLabel.setWrapText(true);/*from  ww  w .java  2s  . co  m*/
        GridPane.setHalignment(messageLabel, HPos.LEFT);
        GridPane.setHgrow(messageLabel, Priority.ALWAYS);
        GridPane.setMargin(messageLabel, new Insets(3, 0, 0, 0));
        GridPane.setRowIndex(messageLabel, ++rowIndex);
        GridPane.setColumnIndex(messageLabel, 0);
        GridPane.setColumnSpan(messageLabel, 2);
        gridPane.getChildren().add(messageLabel);
    }
}

From source file:io.bitsquare.gui.main.overlays.Overlay.java

private void addReportErrorButtons() {
    messageLabel.setText(truncatedMessage
            + "\n\nTo help us to improve the software please report the bug at our issue tracker at Github or send it by email to the developers.\n"
            + "The error message will be copied to clipboard when you click the below buttons.\n"
            + "It will make debugging easier if you can attach the bitsquare.log file which you can find in the application directory.");

    Button githubButton = new Button("Report to Github issue tracker");
    GridPane.setMargin(githubButton, new Insets(20, 0, 0, 0));
    GridPane.setHalignment(githubButton, HPos.RIGHT);
    GridPane.setRowIndex(githubButton, ++rowIndex);
    GridPane.setColumnIndex(githubButton, 1);
    gridPane.getChildren().add(githubButton);

    githubButton.setOnAction(event -> {
        Utilities.copyToClipboard(message);
        GUIUtil.openWebPage("https://github.com/bitsquare/bitsquare/issues");
    });/*www. j  a  va 2  s .  c  o m*/

    Button mailButton = new Button("Report by email");
    GridPane.setHalignment(mailButton, HPos.RIGHT);
    GridPane.setRowIndex(mailButton, ++rowIndex);
    GridPane.setColumnIndex(mailButton, 1);
    gridPane.getChildren().add(mailButton);
    mailButton.setOnAction(event -> {
        Utilities.copyToClipboard(message);
        GUIUtil.openMail("manfred@bitsquare.io", "Error report", "Error message:\n" + message);
    });
}

From source file:io.bitsquare.gui.main.overlays.Overlay.java

protected void addDontShowAgainCheckBox() {
    if (dontShowAgainId != null && preferences != null) {
        if (dontShowAgainText == null)
            dontShowAgainText = "Don't show again";
        CheckBox dontShowAgainCheckBox = addCheckBox(gridPane, rowIndex, dontShowAgainText, buttonDistance - 1);
        GridPane.setColumnIndex(dontShowAgainCheckBox, 0);
        GridPane.setHalignment(dontShowAgainCheckBox, HPos.LEFT);
        dontShowAgainCheckBox.setOnAction(
                e -> preferences.dontShowAgain(dontShowAgainId, dontShowAgainCheckBox.isSelected()));
    }/*from ww  w.j av  a  2s  . co  m*/
}

From source file:io.bitsquare.gui.main.overlays.Overlay.java

protected void addCloseButton() {
    closeButton = new Button(closeButtonText == null ? "Close" : closeButtonText);
    closeButton.setOnAction(event -> doClose());

    if (actionHandlerOptional.isPresent() || actionButtonText != null) {
        actionButton = new Button(actionButtonText == null ? "Ok" : actionButtonText);
        actionButton.setDefaultButton(true);
        //TODO app wide focus
        //actionButton.requestFocus();
        actionButton.setOnAction(event -> {
            hide();//from www . ja va  2s. c  o  m
            actionHandlerOptional.ifPresent(Runnable::run);
        });

        Pane spacer = new Pane();
        HBox hBox = new HBox();
        hBox.setSpacing(10);
        hBox.getChildren().addAll(spacer, closeButton, actionButton);
        HBox.setHgrow(spacer, Priority.ALWAYS);

        GridPane.setHalignment(hBox, HPos.RIGHT);
        GridPane.setRowIndex(hBox, ++rowIndex);
        GridPane.setColumnSpan(hBox, 2);
        GridPane.setMargin(hBox, new Insets(buttonDistance, 0, 0, 0));
        gridPane.getChildren().add(hBox);
    } else if (!hideCloseButton) {
        closeButton.setDefaultButton(true);
        GridPane.setHalignment(closeButton, HPos.RIGHT);
        if (!showReportErrorButtons)
            GridPane.setMargin(closeButton, new Insets(buttonDistance, 0, 0, 0));
        GridPane.setRowIndex(closeButton, ++rowIndex);
        GridPane.setColumnIndex(closeButton, 1);
        gridPane.getChildren().add(closeButton);
    }
}

From source file:org.mskcc.shenkers.control.alignment.AlignmentOverlay.java

private void populateGridPane() {
    ObservableList<Node> children = this.getChildren();
    children.clear();/*ww w . j  ava 2s  .com*/
    int l = nodes.size();
    boolean flip = flipProperty.get();

    for (int i = 0; i < l; i++) {
        Node n = nodes.get(i);
        GridPane.setHalignment(n, HPos.CENTER);
        GridPane.setValignment(n, VPos.CENTER);
        GridPane.setHgrow(n, Priority.ALWAYS);
        GridPane.setVgrow(n, Priority.ALWAYS);
        GridPane.setRowIndex(n, 0);
        GridPane.setColumnIndex(n, flip ? l - i - 1 : i);
        children.add(n);
    }
}