Java Code Examples for javafx.scene.layout.GridPane#setColumnIndex()

The following examples show how to use javafx.scene.layout.GridPane#setColumnIndex() . 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: TakeOfferView.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void addOptionsGroup() {
    advancedOptionsGroup = addTitledGroupBg(gridPane, ++gridRow, 1, Res.get("shared.advancedOptions"), Layout.COMPACT_GROUP_DISTANCE);

    advancedOptionsBox = new HBox();
    advancedOptionsBox.setSpacing(40);

    GridPane.setRowIndex(advancedOptionsBox, gridRow);
    GridPane.setColumnIndex(advancedOptionsBox, 0);
    GridPane.setHalignment(advancedOptionsBox, HPos.LEFT);
    GridPane.setMargin(advancedOptionsBox, new Insets(Layout.COMPACT_FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0));
    gridPane.getChildren().add(advancedOptionsBox);

    advancedOptionsBox.getChildren().addAll(getTradeFeeFieldsBox());
}
 
Example 2
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
@NotNull
public static Tuple2<Label, VBox> addTopLabelWithVBox(GridPane gridPane,
                                                      int rowIndex,
                                                      int columnIndex,
                                                      String title,
                                                      Node node,
                                                      double top) {
    final Tuple2<Label, VBox> topLabelWithVBox = getTopLabelWithVBox(title, node);
    VBox vBox = topLabelWithVBox.second;

    GridPane.setRowIndex(vBox, rowIndex);
    GridPane.setColumnIndex(vBox, columnIndex);
    GridPane.setMargin(vBox, new Insets(top + Layout.FLOATING_LABEL_DISTANCE, 0, 0, 0));
    gridPane.getChildren().add(vBox);

    return new Tuple2<>(topLabelWithVBox.first, vBox);
}
 
Example 3
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static Tuple2<Label, TextFieldWithCopyIcon> addTopLabelTextFieldWithCopyIcon(GridPane gridPane,
                                                                                    int rowIndex,
                                                                                    int colIndex,
                                                                                    String title,
                                                                                    String value,
                                                                                    double top) {

    TextFieldWithCopyIcon textFieldWithCopyIcon = new TextFieldWithCopyIcon();
    textFieldWithCopyIcon.setText(value);

    final Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, textFieldWithCopyIcon, top);
    topLabelWithVBox.second.setAlignment(Pos.TOP_LEFT);
    GridPane.setColumnIndex(topLabelWithVBox.second, colIndex);

    return new Tuple2<>(topLabelWithVBox.first, textFieldWithCopyIcon);
}
 
Example 4
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static Tuple3<Label, HyperlinkWithIcon, VBox> addTopLabelHyperlinkWithIcon(GridPane gridPane,
                                                                                  int rowIndex,
                                                                                  int columnIndex,
                                                                                  String title,
                                                                                  String value,
                                                                                  String url,
                                                                                  double top) {
    Tuple3<Label, HyperlinkWithIcon, VBox> tuple = addTopLabelHyperlinkWithIcon(gridPane,
            rowIndex,
            title,
            value,
            url,
            top);
    GridPane.setColumnIndex(tuple.third, columnIndex);
    return tuple;
}
 
Example 5
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static Tuple3<Label, TextField, VBox> addTopLabelReadOnlyTextField(GridPane gridPane,
                                                                          int rowIndex,
                                                                          int columnIndex,
                                                                          String title,
                                                                          String value,
                                                                          double top) {
    Tuple3<Label, TextField, VBox> tuple = addTopLabelTextField(gridPane, rowIndex, title, value, top - 15);
    GridPane.setColumnIndex(tuple.third, columnIndex);
    return tuple;
}
 
Example 6
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static AddressTextField addAddressTextField(GridPane gridPane, int rowIndex, String title, double top) {
    AddressTextField addressTextField = new AddressTextField(title);
    GridPane.setRowIndex(addressTextField, rowIndex);
    GridPane.setColumnIndex(addressTextField, 0);
    GridPane.setMargin(addressTextField, new Insets(top + 20, 0, 0, 0));
    gridPane.getChildren().add(addressTextField);

    return addressTextField;
}
 
Example 7
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static FundsTextField addFundsTextfield(GridPane gridPane, int rowIndex, String text, double top) {

        FundsTextField fundsTextField = new FundsTextField();
        fundsTextField.getTextField().setPromptText(text);
        GridPane.setRowIndex(fundsTextField, rowIndex);
        GridPane.setColumnIndex(fundsTextField, 0);
        GridPane.setMargin(fundsTextField, new Insets(top + 20, 0, 0, 0));
        gridPane.getChildren().add(fundsTextField);

        return fundsTextField;
    }
 
Example 8
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static CheckBox addLabelCheckBox(GridPane gridPane, int rowIndex, String title, double top) {
    CheckBox checkBox = new AutoTooltipCheckBox(title);
    GridPane.setRowIndex(checkBox, rowIndex);
    GridPane.setColumnIndex(checkBox, 0);
    GridPane.setMargin(checkBox, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(checkBox);

    return checkBox;
}
 
Example 9
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static HyperlinkWithIcon addHyperlinkWithIcon(GridPane gridPane,
                                                     int rowIndex,
                                                     String title,
                                                     String url,
                                                     double top) {
    HyperlinkWithIcon hyperlinkWithIcon = new ExternalHyperlink(title);
    hyperlinkWithIcon.setOnAction(e -> GUIUtil.openWebPage(url));
    GridPane.setRowIndex(hyperlinkWithIcon, rowIndex);
    GridPane.setColumnIndex(hyperlinkWithIcon, 0);
    GridPane.setMargin(hyperlinkWithIcon, new Insets(top, 0, 0, 0));
    GridPane.setHalignment(hyperlinkWithIcon, HPos.LEFT);
    gridPane.getChildren().add(hyperlinkWithIcon);
    return hyperlinkWithIcon;
}
 
Example 10
Source File: TradeFeedbackWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void addMessage() {
    super.addMessage();

    HyperlinkWithIcon survey = addHyperlinkWithIcon(gridPane, ++rowIndex, "https://bisq.network/survey",
            "https://bisq.network/survey");
    GridPane.setMargin(survey, new Insets(-6, 0, 10, 0));

    AutoTooltipLabel messageLabel2 = new AutoTooltipLabel(Res.get("tradeFeedbackWindow.msg.part2"));
    messageLabel2.setMouseTransparent(true);
    messageLabel2.setWrapText(true);
    GridPane.setHalignment(messageLabel2, HPos.LEFT);
    GridPane.setHgrow(messageLabel2, Priority.ALWAYS);
    GridPane.setRowIndex(messageLabel2, ++rowIndex);
    GridPane.setColumnIndex(messageLabel2, 0);
    GridPane.setColumnSpan(messageLabel2, 2);
    gridPane.getChildren().add(messageLabel2);

    HyperlinkWithIcon forum = addHyperlinkWithIcon(gridPane, ++rowIndex, "https://bisq.community",
            "https://bisq.community", 40);
    GridPane.setMargin(forum, new Insets(-6, 0, 10, 0));

    AutoTooltipLabel messageLabel3 = new AutoTooltipLabel(Res.get("tradeFeedbackWindow.msg.part3"));
    messageLabel3.setMouseTransparent(true);
    messageLabel3.setWrapText(true);
    GridPane.setHalignment(messageLabel3, HPos.LEFT);
    GridPane.setHgrow(messageLabel3, Priority.ALWAYS);
    GridPane.setRowIndex(messageLabel3, ++rowIndex);
    GridPane.setColumnIndex(messageLabel3, 0);
    GridPane.setColumnSpan(messageLabel3, 2);
    gridPane.getChildren().add(messageLabel3);
}
 
Example 11
Source File: TorNetworkSettingsWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
protected void addButtons() {
    closeButton = new AutoTooltipButton(closeButtonText == null ? Res.get("shared.close") : closeButtonText);
    closeButton.setOnAction(event -> doClose());

    if (actionHandlerOptional.isPresent()) {
        actionButton = new AutoTooltipButton(Res.get("shared.shutDown"));
        actionButton.setDefaultButton(true);
        //TODO app wide focus
        //actionButton.requestFocus();
        actionButton.setOnAction(event -> saveAndShutDown());

        Button urlButton = new AutoTooltipButton(Res.get("torNetworkSettingWindow.openTorWebPage"));
        urlButton.setOnAction(event -> {
            try {
                Utilities.openURI(URI.create("https://bridges.torproject.org/bridges"));
            } catch (IOException e) {
                e.printStackTrace();
            }
        });

        Pane spacer = new Pane();
        HBox hBox = new HBox();
        hBox.setSpacing(10);
        hBox.getChildren().addAll(spacer, urlButton, 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);
        GridPane.setMargin(closeButton, new Insets(buttonDistance, 0, 0, 0));
        GridPane.setRowIndex(closeButton, rowIndex);
        GridPane.setColumnIndex(closeButton, 1);
        gridPane.getChildren().add(closeButton);
    }
}
 
Example 12
Source File: QRCodeWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void show() {
    createGridPane();
    addHeadLine();
    addMessage();

    GridPane.setRowIndex(qrCodeImageView, ++rowIndex);
    GridPane.setColumnSpan(qrCodeImageView, 2);
    GridPane.setHalignment(qrCodeImageView, HPos.CENTER);
    gridPane.getChildren().add(qrCodeImageView);

    String request = bitcoinURI.replace("%20", " ").replace("?", "\n?").replace("&", "\n&");
    Label infoLabel = new AutoTooltipLabel(Res.get("qRCodeWindow.request", request));
    infoLabel.setMouseTransparent(true);
    infoLabel.setWrapText(true);
    infoLabel.setId("popup-qr-code-info");
    GridPane.setHalignment(infoLabel, HPos.CENTER);
    GridPane.setHgrow(infoLabel, Priority.ALWAYS);
    GridPane.setMargin(infoLabel, new Insets(3, 0, 0, 0));
    GridPane.setRowIndex(infoLabel, ++rowIndex);
    GridPane.setColumnIndex(infoLabel, 0);
    GridPane.setColumnSpan(infoLabel, 2);
    gridPane.getChildren().add(infoLabel);

    addButtons();
    applyStyles();
    display();
}
 
Example 13
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static Button addButton(GridPane gridPane, int rowIndex, String title, double top, boolean isPrimaryAction) {
    Button button = new AutoTooltipButton(title);
    if (isPrimaryAction) {
        button.setDefaultButton(true);
        button.getStyleClass().add("action-button");
    }

    GridPane.setRowIndex(button, rowIndex);
    GridPane.setColumnIndex(button, 0);
    gridPane.getChildren().add(button);
    GridPane.setMargin(button, new Insets(top, 0, 0, 0));
    return button;
}
 
Example 14
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static Tuple3<Label, TextField, VBox> addCompactTopLabelTextField(GridPane gridPane,
                                                                         int rowIndex,
                                                                         int colIndex,
                                                                         String title,
                                                                         String value) {
    final Tuple3<Label, TextField, VBox> labelTextFieldVBoxTuple3 = addTopLabelTextField(gridPane, rowIndex, title, value, -Layout.FLOATING_LABEL_DISTANCE);
    GridPane.setColumnIndex(labelTextFieldVBoxTuple3.third, colIndex);
    return labelTextFieldVBoxTuple3;
}
 
Example 15
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static TitledGroupBg addTitledGroupBg(GridPane gridPane,
                                             int rowIndex,
                                             int columnIndex,
                                             int rowSpan,
                                             String title) {
    TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, rowIndex, rowSpan, title, 0);
    GridPane.setColumnIndex(titledGroupBg, columnIndex);
    return titledGroupBg;
}
 
Example 16
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static Tuple3<Label, TextField, VBox> addTopLabelReadOnlyTextField(GridPane gridPane,
                                                                          int rowIndex,
                                                                          int columnIndex,
                                                                          String title,
                                                                          double top) {
    Tuple3<Label, TextField, VBox> tuple = addTopLabelTextField(gridPane, rowIndex, title, "", top - 15);
    GridPane.setColumnIndex(tuple.third, columnIndex);
    return tuple;
}
 
Example 17
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static Tuple2<Label, TextArea> addTopLabelTextArea(GridPane gridPane, int rowIndex, int colIndex,
                                                          String title, String prompt, double top) {

    TextArea textArea = new BisqTextArea();
    textArea.setPromptText(prompt);
    textArea.setWrapText(true);

    final Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, textArea, top);
    GridPane.setColumnIndex(topLabelWithVBox.second, colIndex);

    return new Tuple2<>(topLabelWithVBox.first, textArea);
}
 
Example 18
Source File: FrontGridPane.java    From img2latex-mathpix with Apache License 2.0 5 votes vote down vote up
/**
 * Method to set the column index of UI.CopyResultButton in UI.BackGridPane.
 */
public void setCopyResultButtonColumnIndex(List<CopyResultButton> buttonList) {

    var columnIndex = 2;

    for (CopyResultButton copyResultButton : buttonList) {
        copyResultButton.setVisible(true);
        GridPane.setColumnIndex(copyResultButton, columnIndex);
        columnIndex -= 1;
    }

}
 
Example 19
Source File: SendPrivateNotificationWindow.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addContent() {
    InputTextField keyInputTextField = addInputTextField(gridPane, ++rowIndex, Res.get("shared.unlock"), 10);
    if (useDevPrivilegeKeys)
        keyInputTextField.setText(DevEnv.DEV_PRIVILEGE_PRIV_KEY);

    Tuple2<Label, TextArea> labelTextAreaTuple2 = addTopLabelTextArea(gridPane, ++rowIndex,
            Res.get("sendPrivateNotificationWindow.privateNotification"),
            Res.get("sendPrivateNotificationWindow.enterNotification"));
    TextArea alertMessageTextArea = labelTextAreaTuple2.second;
    Label first = labelTextAreaTuple2.first;
    first.setMinWidth(200);

    Button sendButton = new AutoTooltipButton(Res.get("sendPrivateNotificationWindow.send"));
    sendButton.setOnAction(e -> {
        if (alertMessageTextArea.getText().length() > 0 && keyInputTextField.getText().length() > 0) {
            PrivateNotificationPayload privateNotification = new PrivateNotificationPayload(alertMessageTextArea.getText());
            if (!privateNotificationManager.sendPrivateNotificationMessageIfKeyIsValid(
                    privateNotification,
                    pubKeyRing,
                    nodeAddress,
                    keyInputTextField.getText(),
                    new SendMailboxMessageListener() {
                        @Override
                        public void onArrived() {
                            log.info("PrivateNotificationPayload arrived at peer {}.", nodeAddress);
                            new Popup().feedback(Res.get("shared.messageArrived"))
                                    .onClose(SendPrivateNotificationWindow.this::hide).show();
                        }

                        @Override
                        public void onStoredInMailbox() {
                            log.info("PrivateNotificationPayload stored in mailbox for peer {}.", nodeAddress);
                            new Popup().feedback(Res.get("shared.messageStoredInMailbox"))
                                    .onClose(SendPrivateNotificationWindow.this::hide).show();
                        }

                        @Override
                        public void onFault(String errorMessage) {
                            log.error("PrivateNotificationPayload failed: Peer {}, errorMessage={}", nodeAddress,
                                    errorMessage);
                            new Popup().feedback(Res.get("shared.messageSendingFailed", errorMessage))
                                    .onClose(SendPrivateNotificationWindow.this::hide).show();
                        }
                    }))
                new Popup().warning(Res.get("shared.invalidKey")).width(300).onClose(this::blurAgain).show();
        }
    });

    closeButton = new AutoTooltipButton(Res.get("shared.close"));
    closeButton.setOnAction(e -> {
        hide();
        closeHandlerOptional.ifPresent(Runnable::run);
    });

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.setAlignment(Pos.CENTER_RIGHT);
    GridPane.setRowIndex(hBox, ++rowIndex);
    GridPane.setColumnSpan(hBox, 2);
    GridPane.setColumnIndex(hBox, 0);
    hBox.getChildren().addAll(sendButton, closeButton);
    gridPane.getChildren().add(hBox);
    GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
}
 
Example 20
Source File: MutableOfferView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addSecondRow() {
    // price as fiat
    Tuple3<HBox, InputTextField, Label> priceValueCurrencyBoxTuple = getEditableValueBox(
            Res.get("createOffer.price.prompt"));
    priceValueCurrencyBox = priceValueCurrencyBoxTuple.first;
    fixedPriceTextField = priceValueCurrencyBoxTuple.second;
    editOfferElements.add(fixedPriceTextField);
    priceCurrencyLabel = priceValueCurrencyBoxTuple.third;
    editOfferElements.add(priceCurrencyLabel);
    Tuple2<Label, VBox> priceInputBoxTuple = getTradeInputBox(priceValueCurrencyBox, "");
    priceDescriptionLabel = priceInputBoxTuple.first;

    getSmallIconForLabel(MaterialDesignIcon.LOCK, priceDescriptionLabel, "small-icon-label");

    editOfferElements.add(priceDescriptionLabel);
    fixedPriceBox = priceInputBoxTuple.second;

    marketBasedPriceTextField.setPromptText(Res.get("shared.enterPercentageValue"));
    marketBasedPriceLabel.setText("%");

    Tuple3<HBox, InputTextField, Label> amountValueCurrencyBoxTuple = getEditableValueBox(Res.get("createOffer.amount.prompt"));
    minAmountValueCurrencyBox = amountValueCurrencyBoxTuple.first;
    minAmountTextField = amountValueCurrencyBoxTuple.second;
    editOfferElements.add(minAmountTextField);
    minAmountBtcLabel = amountValueCurrencyBoxTuple.third;
    editOfferElements.add(minAmountBtcLabel);

    Tuple2<Label, VBox> amountInputBoxTuple = getTradeInputBox(minAmountValueCurrencyBox, Res.get("createOffer.amountPriceBox.minAmountDescription"));


    fakeXLabel = new Label();
    fakeXIcon = getIconForLabel(MaterialDesignIcon.CLOSE, "2em", fakeXLabel);
    fakeXLabel.getStyleClass().add("opaque-icon-character");
    fakeXLabel.setVisible(false); // we just use it to get the same layout as the upper row

    // Fixed/Percentage toggle
    priceTypeToggleButton = getIconButton(MaterialDesignIcon.SWAP_VERTICAL);
    editOfferElements.add(priceTypeToggleButton);
    HBox.setMargin(priceTypeToggleButton, new Insets(16, 0, 0, 0));

    priceTypeToggleButton.setOnAction((actionEvent) ->
            updatePriceToggleButtons(model.getDataModel().getUseMarketBasedPrice().getValue()));

    secondRowHBox = new HBox();

    secondRowHBox.setSpacing(5);
    secondRowHBox.setAlignment(Pos.CENTER_LEFT);
    secondRowHBox.getChildren().addAll(amountInputBoxTuple.second, fakeXLabel, fixedPriceBox, priceTypeToggleButton);
    GridPane.setRowIndex(secondRowHBox, ++gridRow);
    GridPane.setColumnIndex(secondRowHBox, 0);
    GridPane.setMargin(secondRowHBox, new Insets(0, 10, 10, 0));
    gridPane.getChildren().add(secondRowHBox);
}