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

The following examples show how to use javafx.scene.layout.GridPane#setRowIndex() . 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: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static <T> TableView<T> addTableViewWithHeader(GridPane gridPane,
                                                      int rowIndex,
                                                      String headerText,
                                                      int top,
                                                      String groupStyle) {
    TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, rowIndex, 1, headerText, top);

    if (groupStyle != null) titledGroupBg.getStyleClass().add(groupStyle);

    TableView<T> tableView = new TableView<>();
    GridPane.setRowIndex(tableView, rowIndex);
    GridPane.setMargin(tableView, new Insets(top + 30, -10, 5, -10));
    gridPane.getChildren().add(tableView);
    tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    return tableView;
}
 
Example 2
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static <T> Tuple3<Label, ComboBox<T>, TextField> addLabelComboBoxLabel(GridPane gridPane,
                                                                              int rowIndex,
                                                                              String title,
                                                                              String textFieldText,
                                                                              double top) {
    Label label = addLabel(gridPane, rowIndex, title, top);

    HBox hBox = new HBox();
    hBox.setSpacing(10);

    ComboBox<T> comboBox = new JFXComboBox<>();
    TextField textField = new TextField(textFieldText);
    textField.setEditable(false);
    textField.setMouseTransparent(true);
    textField.setFocusTraversable(false);

    hBox.getChildren().addAll(comboBox, textField);
    GridPane.setRowIndex(hBox, rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    GridPane.setMargin(hBox, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(hBox);

    return new Tuple3<>(label, comboBox, textField);
}
 
Example 3
Source File: NewTradeProtocolLaunchWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void addHeadLine() {

    Label versionNumber = new AutoTooltipLabel(BisqAppMain.DEFAULT_APP_NAME + " v1.2");
    versionNumber.getStyleClass().add("news-version");
    HBox.setHgrow(versionNumber, Priority.ALWAYS);
    versionNumber.setMaxWidth(Double.MAX_VALUE);

    Button closeButton = FormBuilder.getIconButton(MaterialDesignIcon.CLOSE,
            "close-icon", "1.231em");
    closeButton.setOnAction(event -> hide());
    HBox.setHgrow(closeButton, Priority.NEVER);

    HBox header = new HBox(versionNumber, closeButton);

    GridPane.setRowIndex(header, ++rowIndex);
    GridPane.setColumnSpan(header, 2);
    gridPane.getChildren().add(header);

    headLineLabel = addLabel(gridPane, ++rowIndex, headLine);
    headLineLabel.getStyleClass().add("popup-headline-information");
    headlineIcon = new Label();
    headlineIcon.getStyleClass().add("popup-icon-information");
    headlineIcon.setManaged(true);
    headlineIcon.setVisible(true);
    FormBuilder.getIconForLabel(AwesomeIcon.INFO_SIGN, headlineIcon, "1em");

    headLineLabel.setGraphic(headlineIcon);
    GridPane.setHalignment(headLineLabel, HPos.LEFT);
    GridPane.setColumnSpan(headLineLabel, 2);
}
 
Example 4
Source File: Overlay.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
protected void addMessage() {
    if (message != null) {
        messageLabel = new AutoTooltipLabel(truncatedMessage);
        messageLabel.setMouseTransparent(true);
        messageLabel.setWrapText(true);
        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);
    }
}
 
Example 5
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static <T> ComboBox<T> addComboBox(GridPane gridPane, int rowIndex, int top) {
    final JFXComboBox<T> comboBox = new JFXComboBox<>();

    GridPane.setRowIndex(comboBox, rowIndex);
    GridPane.setMargin(comboBox, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(comboBox);
    return comboBox;

}
 
Example 6
Source File: InfoDisplay.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public void setGridPane(GridPane gridPane) {
    this.gridPane.set(gridPane);

    gridPane.getChildren().addAll(icon, textFlow);

    GridPane.setColumnIndex(icon, columnIndex.get());
    GridPane.setColumnIndex(textFlow, columnIndex.get() + 1);

    GridPane.setRowIndex(icon, rowIndex.get());
    GridPane.setRowIndex(textFlow, rowIndex.get());
}
 
Example 7
Source File: DaoLaunchWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void createContent() {
    HBox slidingContentWithPagingBox = new HBox();
    slidingContentWithPagingBox.setPadding(new Insets(30, 0, 0, 0));
    slidingContentWithPagingBox.setAlignment(Pos.CENTER);
    Button prevButton = getIconButton(MaterialDesignIcon.ARROW_LEFT, "dao-launch-paging-button");
    prevButton.setOnAction(event -> {
        autoPlayTimeline.stop();
        goToPrevSection();
    });
    Button nextButton = getIconButton(MaterialDesignIcon.ARROW_RIGHT, "dao-launch-paging-button");
    nextButton.setOnAction(event -> {
        autoPlayTimeline.stop();
        goToNextSection();
    });
    VBox slidingContent = new VBox();
    slidingContent.setMinWidth(616);
    slidingContent.setSpacing(20);
    sectionDescriptionLabel = new Label();
    sectionDescriptionLabel.setTextAlignment(TextAlignment.CENTER);
    sectionDescriptionLabel.getStyleClass().add("dao-launch-description");
    sectionDescriptionLabel.setMaxWidth(562);
    sectionDescriptionLabel.setWrapText(true);


    selectedSection = sections.get(currentSectionIndex.get());

    sectionDescriptionLabel.setText(selectedSection.description);
    sectionScreenshot = new ImageView();
    sectionScreenshot.setOpacity(0);
    sectionScreenshot.setId(selectedSection.imageId);

    slidingContent.setAlignment(Pos.CENTER);
    slidingContent.getChildren().addAll(sectionDescriptionLabel, sectionScreenshot);
    slidingContentWithPagingBox.getChildren().addAll(prevButton, slidingContent, nextButton);

    GridPane.setRowIndex(slidingContentWithPagingBox, ++rowIndex);
    GridPane.setColumnSpan(slidingContentWithPagingBox, 2);
    GridPane.setHgrow(slidingContent, Priority.ALWAYS);
    gridPane.getChildren().add(slidingContentWithPagingBox);
}
 
Example 8
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static RadioButton addRadioButton(GridPane gridPane, int rowIndex, ToggleGroup toggleGroup, String title) {
    RadioButton radioButton = new AutoTooltipRadioButton(title);
    radioButton.setToggleGroup(toggleGroup);
    GridPane.setRowIndex(radioButton, rowIndex);
    gridPane.getChildren().add(radioButton);
    return radioButton;
}
 
Example 9
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 10
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static Label addLabel(GridPane gridPane, int rowIndex, String title, double top) {
    Label label = new AutoTooltipLabel(title);
    GridPane.setRowIndex(label, rowIndex);
    GridPane.setMargin(label, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(label);
    return label;
}
 
Example 11
Source File: PreferencesView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initializeSeparator() {
    final Separator separator = new Separator(Orientation.VERTICAL);
    separator.setPadding(new Insets(0, 10, 0, 10));
    GridPane.setColumnIndex(separator, 1);
    GridPane.setHalignment(separator, HPos.CENTER);
    GridPane.setRowIndex(separator, 0);
    GridPane.setRowSpan(separator, GridPane.REMAINING);
    root.getChildren().add(separator);
}
 
Example 12
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static PasswordTextField addPasswordTextField(GridPane gridPane, int rowIndex, String title, double top) {
    PasswordTextField passwordField = new PasswordTextField();
    passwordField.setPromptText(title);
    GridPane.setRowIndex(passwordField, rowIndex);
    GridPane.setColumnIndex(passwordField, 0);
    GridPane.setColumnSpan(passwordField, 2);
    GridPane.setMargin(passwordField, new Insets(top + 10, 0, 20, 0));
    gridPane.getChildren().add(passwordField);

    return passwordField;
}
 
Example 13
Source File: PhasesView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public int addGroup(GridPane gridPane, int gridRow) {
    addTitledGroupBg(gridPane, gridRow, 1, Res.get("dao.cycle.headline"));
    separatedPhaseBars = createSeparatedPhaseBars();
    GridPane.setMargin(separatedPhaseBars, new Insets(Layout.FIRST_ROW_DISTANCE + 5, 0, 0, 0));
    GridPane.setRowIndex(separatedPhaseBars, gridRow);
    gridPane.getChildren().add(separatedPhaseBars);
    return gridRow;
}
 
Example 14
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static Tuple2<Label, TxIdTextField> addLabelTxIdTextField(GridPane gridPane,
                                                                 int rowIndex,
                                                                 int columnIndex,
                                                                 String title,
                                                                 double top) {
    Label label = addLabel(gridPane, rowIndex, title, top);

    TxIdTextField txIdTextField = new TxIdTextField();
    GridPane.setRowIndex(txIdTextField, rowIndex);
    GridPane.setColumnIndex(txIdTextField, columnIndex);
    GridPane.setMargin(txIdTextField, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(txIdTextField);

    return new Tuple2<>(label, txIdTextField);
}
 
Example 15
Source File: BsqEmptyWalletWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addContent() {
    gridPane.getColumnConstraints().remove(1);

    addTopLabelTextField(gridPane, ++rowIndex, Res.get("emptyWalletWindow.balance"),
            bsqFormatter.formatCoinWithCode(bsqWalletService.getAvailableConfirmedBalance()), 10);

    addTopLabelTextField(gridPane, ++rowIndex, Res.get("emptyWalletWindow.bsq.btcBalance"),
            bsqFormatter.formatBTCWithCode(bsqWalletService.getAvailableNonBsqBalance().value), 10);

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


    closeButton.setDefaultButton(true);
    closeButton.updateText(Res.get("shared.close"));

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    GridPane.setRowIndex(hBox, ++rowIndex);

    hBox.getChildren().addAll(closeButton);

    gridPane.getChildren().add(hBox);
    GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
}
 
Example 16
Source File: InfoDisplay.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
public void setRowIndex(int rowIndex) {
    this.rowIndex.set(rowIndex);

    GridPane.setRowIndex(icon, rowIndex);
    GridPane.setRowIndex(textFlow, rowIndex);
}
 
Example 17
Source File: BuyerStep4View.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
protected void addContent() {
    gridPane.getColumnConstraints().get(1).setHgrow(Priority.SOMETIMES);

    addTitledGroupBg(gridPane, gridRow, 5, Res.get("portfolio.pending.step5_buyer.groupTitle"), 0);
    addCompactTopLabelTextField(gridPane, gridRow, getBtcTradeAmountLabel(), model.getTradeVolume(), Layout.TWICE_FIRST_ROW_DISTANCE);

    addCompactTopLabelTextField(gridPane, ++gridRow, getFiatTradeAmountLabel(), model.getFiatVolume());
    addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("portfolio.pending.step5_buyer.refunded"), model.getSecurityDeposit());
    addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("portfolio.pending.step5_buyer.tradeFee"), model.getTradeFee());
    final String miningFee = model.dataModel.isMaker() ?
            Res.get("portfolio.pending.step5_buyer.makersMiningFee") :
            Res.get("portfolio.pending.step5_buyer.takersMiningFee");
    addCompactTopLabelTextField(gridPane, ++gridRow, miningFee, model.getTxFee());
    withdrawTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 1, Res.get("portfolio.pending.step5_buyer.withdrawBTC"), Layout.COMPACT_GROUP_DISTANCE);
    withdrawTitledGroupBg.getStyleClass().add("last");
    addCompactTopLabelTextField(gridPane, gridRow, Res.get("portfolio.pending.step5_buyer.amount"), model.getPayoutAmount(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    withdrawAddressTextField = addInputTextField(gridPane, ++gridRow, Res.get("portfolio.pending.step5_buyer.withdrawToAddress"));
    withdrawAddressTextField.setManaged(false);
    withdrawAddressTextField.setVisible(false);

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    useSavingsWalletButton = new AutoTooltipButton(Res.get("portfolio.pending.step5_buyer.moveToBisqWallet"));
    useSavingsWalletButton.setDefaultButton(true);
    useSavingsWalletButton.getStyleClass().add("action-button");
    Label label = new AutoTooltipLabel(Res.get("shared.OR"));
    label.setPadding(new Insets(5, 0, 0, 0));
    withdrawToExternalWalletButton = new AutoTooltipButton(Res.get("portfolio.pending.step5_buyer.withdrawExternal"));
    withdrawToExternalWalletButton.setDefaultButton(false);
    hBox.getChildren().addAll(useSavingsWalletButton, label, withdrawToExternalWalletButton);
    GridPane.setRowIndex(hBox, ++gridRow);
    GridPane.setMargin(hBox, new Insets(5, 10, 0, 0));
    gridPane.getChildren().add(hBox);

    useSavingsWalletButton.setOnAction(e -> {
        handleTradeCompleted();
        model.dataModel.tradeManager.addTradeToClosedTrades(trade);
    });
    withdrawToExternalWalletButton.setOnAction(e -> {
        onWithdrawal();
    });

    String key = "tradeCompleted" + trade.getId();
    if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) {
        DontShowAgainLookup.dontShowAgain(key, true);
        new Notification().headLine(Res.get("notification.tradeCompleted.headline"))
                .notification(Res.get("notification.tradeCompleted.msg"))
                .autoClose()
                .show();
    }
}
 
Example 18
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 19
Source File: WalletPasswordWindow.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
protected void addButtons() {
    BusyAnimation busyAnimation = new BusyAnimation(false);
    Label deriveStatusLabel = new AutoTooltipLabel();

    unlockButton = new AutoTooltipButton(Res.get("shared.unlock"));
    unlockButton.setDefaultButton(true);
    unlockButton.getStyleClass().add("action-button");
    unlockButton.setDisable(true);
    unlockButton.setOnAction(e -> {
        String password = passwordTextField.getText();
        checkArgument(password.length() < 500, Res.get("password.tooLong"));
        KeyCrypterScrypt keyCrypterScrypt = walletsManager.getKeyCrypterScrypt();
        if (keyCrypterScrypt != null) {
            busyAnimation.play();
            deriveStatusLabel.setText(Res.get("password.deriveKey"));
            ScryptUtil.deriveKeyWithScrypt(keyCrypterScrypt, password, aesKey -> {
                if (walletsManager.checkAESKey(aesKey)) {
                    if (aesKeyHandler != null)
                        aesKeyHandler.onAesKey(aesKey);

                    hide();
                } else {
                    busyAnimation.stop();
                    deriveStatusLabel.setText("");

                    UserThread.runAfter(() -> new Popup()
                            .warning(Res.get("password.wrongPw"))
                            .onClose(this::blurAgain).show(), Transitions.DEFAULT_DURATION, TimeUnit.MILLISECONDS);
                }
            });
        } else {
            log.error("wallet.getKeyCrypter() is null, that must not happen.");
        }
    });

    forgotPasswordButton = new AutoTooltipButton(Res.get("password.forgotPassword"));
    forgotPasswordButton.setOnAction(e -> {
        forgotPasswordButton.setDisable(true);
        unlockButton.setDefaultButton(false);
        showRestoreScreen();
    });

    Button cancelButton = new AutoTooltipButton(Res.get("shared.cancel"));
    cancelButton.setOnAction(event -> {
        hide();
        closeHandlerOptional.ifPresent(Runnable::run);
    });

    HBox hBox = new HBox();
    hBox.setMinWidth(560);
    hBox.setPadding(new Insets(0, 0, 0, 0));
    hBox.setSpacing(10);
    GridPane.setRowIndex(hBox, ++rowIndex);
    hBox.setAlignment(Pos.CENTER_LEFT);
    hBox.getChildren().add(unlockButton);
    if (!hideForgotPasswordButton)
        hBox.getChildren().add(forgotPasswordButton);
    if (!hideCloseButton)
        hBox.getChildren().add(cancelButton);
    hBox.getChildren().addAll(busyAnimation, deriveStatusLabel);
    gridPane.getChildren().add(hBox);


    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.LEFT);
    columnConstraints1.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1);
}
 
Example 20
Source File: FrontGridPane.java    From img2latex-mathpix with Apache License 2.0 4 votes vote down vote up
/**
 * Method to set the row index of UI.CopiedButton in UI.BackGridPane.
 */
public void setCopiedButtonRowIndex() {
    COPIED_BUTTON.setVisible(true);
    GridPane.setRowIndex(COPIED_BUTTON, 1);
}