Search in sources :

Example 1 with FundsTextField

use of bisq.desktop.components.FundsTextField in project bisq-desktop by bisq-network.

the class TakeOfferView method addFundingGroup.

private void addFundingGroup() {
    // don't increase gridRow as we removed button when this gets visible
    payFundsPane = FormBuilder.addTitledGroupBg(gridPane, gridRow, 3, Res.get("takeOffer.fundsBox.title"), Layout.GROUP_DISTANCE);
    GridPane.setColumnSpan(payFundsPane, 3);
    payFundsPane.setVisible(false);
    Tuple2<Label, FundsTextField> fundsTuple = addLabelFundsTextfield(gridPane, gridRow, Res.get("shared.totalsNeeded"), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    totalToPayLabel = fundsTuple.first;
    totalToPayLabel.setVisible(false);
    totalToPayTextField = fundsTuple.second;
    totalToPayTextField.setVisible(false);
    qrCodeImageView = new ImageView();
    qrCodeImageView.setVisible(false);
    qrCodeImageView.getStyleClass().add("qr-code");
    Tooltip.install(qrCodeImageView, new Tooltip(Res.get("shared.openLargeQRWindow")));
    qrCodeImageView.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> UserThread.runAfter(() -> new QRCodeWindow(getBitcoinURI()).show(), 200, TimeUnit.MILLISECONDS)));
    GridPane.setRowIndex(qrCodeImageView, gridRow);
    GridPane.setColumnIndex(qrCodeImageView, 2);
    GridPane.setRowSpan(qrCodeImageView, 3);
    GridPane.setMargin(qrCodeImageView, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE - 9, 0, 0, 5));
    gridPane.getChildren().add(qrCodeImageView);
    Tuple2<Label, AddressTextField> addressTuple = FormBuilder.addLabelAddressTextField(gridPane, ++gridRow, Res.get("shared.tradeWalletAddress"));
    addressLabel = addressTuple.first;
    addressLabel.setVisible(false);
    addressTextField = addressTuple.second;
    addressTextField.setVisible(false);
    Tuple2<Label, BalanceTextField> balanceTuple = FormBuilder.addLabelBalanceTextField(gridPane, ++gridRow, Res.get("shared.tradeWalletBalance"));
    balanceLabel = balanceTuple.first;
    balanceLabel.setVisible(false);
    balanceTextField = balanceTuple.second;
    balanceTextField.setVisible(false);
    fundingHBox = new HBox();
    fundingHBox.setVisible(false);
    fundingHBox.setManaged(false);
    fundingHBox.setSpacing(10);
    Button fundFromSavingsWalletButton = new AutoTooltipButton(Res.get("shared.fundFromSavingsWalletButton"));
    fundFromSavingsWalletButton.setDefaultButton(true);
    fundFromSavingsWalletButton.setDefaultButton(false);
    fundFromSavingsWalletButton.setOnAction(e -> model.fundFromSavingsWallet());
    Label label = new AutoTooltipLabel(Res.get("shared.OR"));
    label.setPadding(new Insets(5, 0, 0, 0));
    Button fundFromExternalWalletButton = new AutoTooltipButton(Res.get("shared.fundFromExternalWalletButton"));
    fundFromExternalWalletButton.setDefaultButton(false);
    fundFromExternalWalletButton.setOnAction(e -> GUIUtil.showFeeInfoBeforeExecute(this::openWallet));
    waitingForFundsBusyAnimation = new BusyAnimation(false);
    waitingForFundsLabel = new AutoTooltipLabel();
    waitingForFundsLabel.setPadding(new Insets(5, 0, 0, 0));
    fundingHBox.getChildren().addAll(fundFromSavingsWalletButton, label, fundFromExternalWalletButton, waitingForFundsBusyAnimation, waitingForFundsLabel);
    GridPane.setRowIndex(fundingHBox, ++gridRow);
    GridPane.setColumnIndex(fundingHBox, 1);
    GridPane.setMargin(fundingHBox, new Insets(15, 10, 0, 0));
    gridPane.getChildren().add(fundingHBox);
    takeOfferButton = FormBuilder.addButtonAfterGroup(gridPane, gridRow, "");
    takeOfferButton.setVisible(false);
    takeOfferButton.setManaged(false);
    takeOfferButton.setMinHeight(40);
    takeOfferButton.setPadding(new Insets(0, 20, 0, 20));
    takeOfferButton.setOnAction(e -> onTakeOffer());
    cancelButton2 = FormBuilder.addButton(gridPane, ++gridRow, Res.get("shared.cancel"));
    cancelButton2.setOnAction(e -> {
        if (model.dataModel.getIsBtcWalletFunded().get()) {
            new Popup<>().warning(Res.get("takeOffer.alreadyFunded.askCancel")).closeButtonText(Res.get("shared.no")).actionButtonText(Res.get("shared.yesCancel")).onAction(() -> {
                model.dataModel.swapTradeToSavings();
                close();
            }).show();
        } else {
            close();
            model.dataModel.swapTradeToSavings();
        }
    });
    cancelButton2.setDefaultButton(false);
    cancelButton2.setVisible(false);
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) BusyAnimation(bisq.desktop.components.BusyAnimation) AddressTextField(bisq.desktop.components.AddressTextField) Tooltip(javafx.scene.control.Tooltip) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) QRCodeWindow(bisq.desktop.main.overlays.windows.QRCodeWindow) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) BalanceTextField(bisq.desktop.components.BalanceTextField) FundsTextField(bisq.desktop.components.FundsTextField) ImageView(javafx.scene.image.ImageView) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Example 2 with FundsTextField

use of bisq.desktop.components.FundsTextField in project bisq-desktop by bisq-network.

the class FormBuilder method addLabelFundsTextfield.

public static Tuple2<Label, FundsTextField> addLabelFundsTextfield(GridPane gridPane, int rowIndex, String text, double top) {
    Label label = addLabel(gridPane, rowIndex, text, top);
    FundsTextField fundsTextField = new FundsTextField();
    GridPane.setRowIndex(fundsTextField, rowIndex);
    GridPane.setColumnIndex(fundsTextField, 1);
    GridPane.setMargin(fundsTextField, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(fundsTextField);
    return new Tuple2<>(label, fundsTextField);
}
Also used : Insets(javafx.geometry.Insets) Tuple2(bisq.common.util.Tuple2) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) FundsTextField(bisq.desktop.components.FundsTextField)

Example 3 with FundsTextField

use of bisq.desktop.components.FundsTextField in project bisq-desktop by bisq-network.

the class CreateOfferView method addFundingGroup.

private void addFundingGroup() {
    // don't increase gridRow as we removed button when this gets visible
    payFundsTitledGroupBg = addTitledGroupBg(gridPane, gridRow, 3, Res.get("createOffer.fundsBox.title"), Layout.GROUP_DISTANCE);
    GridPane.setColumnSpan(payFundsTitledGroupBg, 3);
    payFundsTitledGroupBg.setVisible(false);
    Tuple2<Label, FundsTextField> fundsTuple = addLabelFundsTextfield(gridPane, gridRow, Res.get("shared.totalsNeeded"), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    totalToPayLabel = fundsTuple.first;
    totalToPayLabel.setVisible(false);
    totalToPayTextField = fundsTuple.second;
    totalToPayTextField.setVisible(false);
    qrCodeImageView = new ImageView();
    qrCodeImageView.setVisible(false);
    qrCodeImageView.getStyleClass().add("qr-code");
    Tooltip.install(qrCodeImageView, new Tooltip(Res.get("shared.openLargeQRWindow")));
    qrCodeImageView.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> UserThread.runAfter(() -> new QRCodeWindow(getBitcoinURI()).show(), 200, TimeUnit.MILLISECONDS)));
    GridPane.setRowIndex(qrCodeImageView, gridRow);
    GridPane.setColumnIndex(qrCodeImageView, 2);
    GridPane.setRowSpan(qrCodeImageView, 3);
    GridPane.setMargin(qrCodeImageView, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE - 9, 0, 0, 5));
    gridPane.getChildren().add(qrCodeImageView);
    Tuple2<Label, AddressTextField> addressTuple = addLabelAddressTextField(gridPane, ++gridRow, Res.get("shared.tradeWalletAddress"));
    addressLabel = addressTuple.first;
    addressLabel.setVisible(false);
    addressTextField = addressTuple.second;
    addressTextField.setVisible(false);
    Tuple2<Label, BalanceTextField> balanceTuple = addLabelBalanceTextField(gridPane, ++gridRow, Res.get("shared.tradeWalletBalance"));
    balanceLabel = balanceTuple.first;
    balanceLabel.setVisible(false);
    balanceTextField = balanceTuple.second;
    balanceTextField.setVisible(false);
    fundingHBox = new HBox();
    fundingHBox.setVisible(false);
    fundingHBox.setManaged(false);
    fundingHBox.setSpacing(10);
    Button fundFromSavingsWalletButton = new AutoTooltipButton(Res.get("shared.fundFromSavingsWalletButton"));
    fundFromSavingsWalletButton.setDefaultButton(false);
    fundFromSavingsWalletButton.setOnAction(e -> model.fundFromSavingsWallet());
    Label label = new AutoTooltipLabel(Res.get("shared.OR"));
    label.setPadding(new Insets(5, 0, 0, 0));
    Button fundFromExternalWalletButton = new AutoTooltipButton(Res.get("shared.fundFromExternalWalletButton"));
    fundFromExternalWalletButton.setDefaultButton(false);
    fundFromExternalWalletButton.setOnAction(e -> GUIUtil.showFeeInfoBeforeExecute(this::openWallet));
    waitingForFundsBusyAnimation = new BusyAnimation();
    waitingForFundsLabel = new AutoTooltipLabel();
    waitingForFundsLabel.setPadding(new Insets(5, 0, 0, 0));
    fundingHBox.getChildren().addAll(fundFromSavingsWalletButton, label, fundFromExternalWalletButton, waitingForFundsBusyAnimation, waitingForFundsLabel);
    GridPane.setRowIndex(fundingHBox, ++gridRow);
    GridPane.setColumnIndex(fundingHBox, 1);
    GridPane.setMargin(fundingHBox, new Insets(15, 10, 0, 0));
    gridPane.getChildren().add(fundingHBox);
    placeOfferButton = addButtonAfterGroup(gridPane, gridRow, "");
    placeOfferButton.setOnAction(e -> onPlaceOffer());
    placeOfferButton.setMinHeight(40);
    placeOfferButton.setPadding(new Insets(0, 20, 0, 20));
    cancelButton2 = addButton(gridPane, ++gridRow, Res.get("shared.cancel"));
    cancelButton2.setOnAction(e -> {
        if (model.dataModel.getIsBtcWalletFunded().get()) {
            new Popup<>().warning(Res.get("createOffer.warnCancelOffer")).closeButtonText(Res.get("shared.no")).actionButtonText(Res.get("shared.yesCancel")).onAction(() -> {
                close();
                model.dataModel.swapTradeToSavings();
            }).show();
        } else {
            close();
            model.dataModel.swapTradeToSavings();
        }
    });
    cancelButton2.setDefaultButton(false);
    cancelButton2.setVisible(false);
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) BusyAnimation(bisq.desktop.components.BusyAnimation) AddressTextField(bisq.desktop.components.AddressTextField) Tooltip(javafx.scene.control.Tooltip) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) QRCodeWindow(bisq.desktop.main.overlays.windows.QRCodeWindow) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) BalanceTextField(bisq.desktop.components.BalanceTextField) FundsTextField(bisq.desktop.components.FundsTextField) ImageView(javafx.scene.image.ImageView) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Aggregations

AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)3 FundsTextField (bisq.desktop.components.FundsTextField)3 Insets (javafx.geometry.Insets)3 Label (javafx.scene.control.Label)3 AddressTextField (bisq.desktop.components.AddressTextField)2 AutoTooltipButton (bisq.desktop.components.AutoTooltipButton)2 BalanceTextField (bisq.desktop.components.BalanceTextField)2 BusyAnimation (bisq.desktop.components.BusyAnimation)2 QRCodeWindow (bisq.desktop.main.overlays.windows.QRCodeWindow)2 Button (javafx.scene.control.Button)2 Tooltip (javafx.scene.control.Tooltip)2 ImageView (javafx.scene.image.ImageView)2 HBox (javafx.scene.layout.HBox)2 Tuple2 (bisq.common.util.Tuple2)1