Search in sources :

Example 16 with Popup

use of bisq.desktop.main.overlays.popups.Popup in project bisq-desktop by bisq-network.

the class CreateOfferViewModel method displayPriceOutOfRangePopup.

private void displayPriceOutOfRangePopup() {
    Popup popup = new Popup<>();
    // noinspection unchecked
    popup.warning(Res.get("createOffer.priceOutSideOfDeviation", btcFormatter.formatToPercentWithSymbol(preferences.getMaxPriceDistanceInPercent()))).actionButtonText(Res.get("createOffer.changePrice")).onAction(popup::hide).closeButtonTextWithGoTo("navigation.settings.preferences").onClose(() -> navigation.navigateTo(MainView.class, SettingsView.class, PreferencesView.class)).show();
}
Also used : Popup(bisq.desktop.main.overlays.popups.Popup)

Example 17 with Popup

use of bisq.desktop.main.overlays.popups.Popup in project bisq-desktop by bisq-network.

the class TakeOfferView method onClose.

// called form parent as the view does not get notified when the tab is closed
@SuppressWarnings("PointlessBooleanExpression")
public void onClose() {
    Coin balance = model.dataModel.getBalance().get();
    // noinspection ConstantConditions,ConstantConditions
    if (balance != null && balance.isPositive() && !model.takeOfferCompleted.get() && !DevEnv.isDevMode()) {
        model.dataModel.swapTradeToSavings();
        // noinspection unchecked
        new Popup<>().information(Res.get("takeOffer.alreadyFunded.movedFunds")).actionButtonTextWithGoTo("navigation.funds.availableForWithdrawal").onAction(() -> navigation.navigateTo(MainView.class, FundsView.class, WithdrawalView.class)).show();
    }
// TODO need other implementation as it is displayed also if there are old funds in the wallet
/*
        if (model.dataModel.getIsWalletFunded().get())
            new Popup<>().warning("You have already funds paid in.\nIn the <Funds/Open for withdrawal> section you can withdraw those funds.").show();*/
}
Also used : Coin(org.bitcoinj.core.Coin) Popup(bisq.desktop.main.overlays.popups.Popup)

Example 18 with Popup

use of bisq.desktop.main.overlays.popups.Popup in project bisq-desktop by bisq-network.

the class TakeOfferView method onShowPayFundsScreen.

@SuppressWarnings("PointlessBooleanExpression")
private void onShowPayFundsScreen() {
    nextButton.setVisible(false);
    nextButton.setManaged(false);
    nextButton.setOnAction(null);
    cancelButton1.setVisible(false);
    cancelButton1.setManaged(false);
    cancelButton1.setOnAction(null);
    model.onShowPayFundsScreen();
    amountTextField.setMouseTransparent(true);
    amountTextField.setFocusTraversable(false);
    priceTextField.setMouseTransparent(true);
    priceAsPercentageTextField.setMouseTransparent(true);
    volumeTextField.setMouseTransparent(true);
    balanceTextField.setTargetAmount(model.dataModel.getTotalToPayAsCoin().get());
    if (!DevEnv.isDevMode()) {
        String key = "securityDepositInfo";
        new Popup<>().backgroundInfo(Res.get("popup.info.securityDepositInfo")).actionButtonText(Res.get("shared.faq")).onAction(() -> GUIUtil.openWebPage("https://bisq.network/faq#6")).useIUnderstandButton().dontShowAgainId(key).show();
        String tradeAmountText = model.isSeller() ? Res.get("takeOffer.takeOfferFundWalletInfo.tradeAmount", model.getTradeAmount()) : "";
        String message = Res.get("takeOffer.takeOfferFundWalletInfo.msg", model.totalToPay.get(), tradeAmountText, model.getSecurityDepositInfo(), model.getTakerFee(), model.getTxFee());
        key = "takeOfferFundWalletInfo";
        new Popup<>().headLine(Res.get("takeOffer.takeOfferFundWalletInfo.headline")).instruction(message).dontShowAgainId(key).show();
    }
    offerAvailabilityBusyAnimation.stop();
    cancelButton2.setVisible(true);
    waitingForFundsBusyAnimation.play();
    payFundsPane.setVisible(true);
    totalToPayLabel.setVisible(true);
    totalToPayTextField.setVisible(true);
    addressLabel.setVisible(true);
    addressTextField.setVisible(true);
    qrCodeImageView.setVisible(true);
    balanceLabel.setVisible(true);
    balanceTextField.setVisible(true);
    totalToPayTextField.setFundsStructure(Res.get("takeOffer.fundsBox.fundsStructure", model.getSecurityDepositWithCode(), model.getMakerFeePercentage(), model.getTxFeePercentage()));
    totalToPayTextField.setContentForInfoPopOver(createInfoPopover());
    if (model.dataModel.getIsBtcWalletFunded().get()) {
        if (walletFundedNotification == null) {
            walletFundedNotification = new Notification().headLine(Res.get("notification.walletUpdate.headline")).notification(Res.get("notification.takeOffer.walletUpdate.msg", formatter.formatCoinWithCode(model.dataModel.getTotalToPayAsCoin().get()))).autoClose();
            walletFundedNotification.show();
        }
    }
    final byte[] imageBytes = QRCode.from(getBitcoinURI()).withSize(98, // code has 41 elements 8 px is border with 98 we get double scale and min. border
    98).to(ImageType.PNG).stream().toByteArray();
    Image qrImage = new Image(new ByteArrayInputStream(imageBytes));
    qrCodeImageView.setImage(qrImage);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) Popup(bisq.desktop.main.overlays.popups.Popup) Image(javafx.scene.image.Image) Notification(bisq.desktop.main.overlays.notifications.Notification)

Example 19 with Popup

use of bisq.desktop.main.overlays.popups.Popup in project bisq-desktop by bisq-network.

the class TakeOfferView method addSubscriptions.

@SuppressWarnings("PointlessBooleanExpression")
private void addSubscriptions() {
    errorPopupDisplayed = new SimpleBooleanProperty();
    offerWarningSubscription = EasyBind.subscribe(model.offerWarning, newValue -> {
        if (newValue != null) {
            if (offerDetailsWindowDisplayed)
                offerDetailsWindow.hide();
            UserThread.runAfter(() -> new Popup<>().warning(newValue + "\n\n" + Res.get("takeOffer.alreadyPaidInFunds")).actionButtonTextWithGoTo("navigation.funds.availableForWithdrawal").onAction(() -> {
                errorPopupDisplayed.set(true);
                model.resetOfferWarning();
                close();
                // noinspection unchecked
                navigation.navigateTo(MainView.class, FundsView.class, WithdrawalView.class);
            }).onClose(() -> {
                errorPopupDisplayed.set(true);
                model.resetOfferWarning();
                close();
            }).show(), 100, TimeUnit.MILLISECONDS);
        }
    });
    errorMessageSubscription = EasyBind.subscribe(model.errorMessage, newValue -> {
        if (newValue != null) {
            new Popup<>().error(Res.get("takeOffer.error.message", model.errorMessage.get()) + Res.get("popup.error.tryRestart")).onClose(() -> {
                errorPopupDisplayed.set(true);
                model.resetErrorMessage();
                close();
            }).show();
        }
    });
    isOfferAvailableSubscription = EasyBind.subscribe(model.isOfferAvailable, isOfferAvailable -> {
        if (isOfferAvailable)
            offerAvailabilityBusyAnimation.stop();
        offerAvailabilityLabel.setVisible(!isOfferAvailable);
        offerAvailabilityLabel.setManaged(!isOfferAvailable);
    });
    isWaitingForFundsSubscription = EasyBind.subscribe(model.isWaitingForFunds, isWaitingForFunds -> {
        waitingForFundsBusyAnimation.setIsRunning(isWaitingForFunds);
        waitingForFundsLabel.setVisible(isWaitingForFunds);
        waitingForFundsLabel.setManaged(isWaitingForFunds);
    });
    showWarningInvalidBtcDecimalPlacesSubscription = EasyBind.subscribe(model.showWarningInvalidBtcDecimalPlaces, newValue -> {
        if (newValue) {
            new Popup<>().warning(Res.get("takeOffer.amountPriceBox.warning.invalidBtcDecimalPlaces")).show();
            model.showWarningInvalidBtcDecimalPlaces.set(false);
        }
    });
    showTransactionPublishedScreenSubscription = EasyBind.subscribe(model.showTransactionPublishedScreen, newValue -> {
        // noinspection ConstantConditions
        if (newValue && DevEnv.isDevMode()) {
            close();
        } else // noinspection ConstantConditions,ConstantConditions
        if (newValue && model.getTrade() != null && !model.getTrade().hasFailed()) {
            String key = "takeOfferSuccessInfo";
            if (DontShowAgainLookup.showAgain(key)) {
                UserThread.runAfter(() -> new Popup<>().headLine(Res.get("takeOffer.success.headline")).feedback(Res.get("takeOffer.success.info")).actionButtonTextWithGoTo("navigation.portfolio.pending").dontShowAgainId(key).onAction(() -> {
                    // noinspection unchecked
                    UserThread.runAfter(() -> navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class), 100, TimeUnit.MILLISECONDS);
                    close();
                }).onClose(this::close).show(), 1);
            } else {
                close();
            }
        }
    });
    /*       noSufficientFeeBinding = EasyBind.combine(model.dataModel.getIsWalletFunded(), model.dataModel.isMainNet, model.dataModel.isFeeFromFundingTxSufficient,
                (getIsWalletFunded(), isMainNet, isFeeSufficient) -> getIsWalletFunded() && isMainNet && !isFeeSufficient);
        noSufficientFeeSubscription = noSufficientFeeBinding.subscribe((observable, oldValue, newValue) -> {
            if (newValue)
                new Popup<>().warning("The mining fee from your funding transaction is not sufficiently high.\n\n" +
                        "You need to use at least a mining fee of " +
                        model.formatter.formatCoinWithCode(FeePolicy.getMinRequiredFeeForFundingTx()) + ".\n\n" +
                        "The fee used in your funding transaction was only " +
                        model.formatter.formatCoinWithCode(model.dataModel.feeFromFundingTx) + ".\n\n" +
                        "The trade transactions might take too much time to be included in " +
                        "a block if the fee is too low.\n" +
                        "Please check at your external wallet that you set the required fee and " +
                        "do a funding again with the correct fee.\n\n" +
                        "In the \"Funds/Open for withdrawal\" section you can withdraw those funds.")
                        .closeButtonText(Res.get("shared.close"))
                        .onClose(() -> {
                            close();
                            navigation.navigateTo(MainView.class, FundsView.class, WithdrawalView.class);
                        })
                        .show();
        });*/
    balanceSubscription = EasyBind.subscribe(model.dataModel.getBalance(), balanceTextField::setBalance);
    cancelButton2StyleSubscription = EasyBind.subscribe(takeOfferButton.visibleProperty(), isVisible -> cancelButton2.setId(isVisible ? "cancel-button" : null));
}
Also used : Button(javafx.scene.control.Button) HPos(javafx.geometry.HPos) Pos(javafx.geometry.Pos) BusyAnimation(bisq.desktop.components.BusyAnimation) QRCodeWindow(bisq.desktop.main.overlays.windows.QRCodeWindow) Utilities(bisq.common.util.Utilities) ArbitratorSelectionView(bisq.desktop.main.account.content.arbitratorselection.ArbitratorSelectionView) Coin(org.bitcoinj.core.Coin) BalanceTextField(bisq.desktop.components.BalanceTextField) FormBuilder.addLabelFundsTextfield(bisq.desktop.util.FormBuilder.addLabelFundsTextfield) Layout(bisq.desktop.util.Layout) VBox(javafx.scene.layout.VBox) BSFormatter(bisq.desktop.util.BSFormatter) FeeOptionWindow(bisq.desktop.main.overlays.windows.FeeOptionWindow) ScrollPane(javafx.scene.control.ScrollPane) InputTextField(bisq.desktop.components.InputTextField) QRCode(net.glxn.qrgen.QRCode) ComboBox(javafx.scene.control.ComboBox) ByteArrayInputStream(java.io.ByteArrayInputStream) Res(bisq.core.locale.Res) ImageType(net.glxn.qrgen.image.ImageType) URI(java.net.URI) BsqWalletView(bisq.desktop.main.dao.wallet.BsqWalletView) Navigation(bisq.desktop.Navigation) HBox(javafx.scene.layout.HBox) Orientation(javafx.geometry.Orientation) Popup(bisq.desktop.main.overlays.popups.Popup) Offer(bisq.core.offer.Offer) TextField(javafx.scene.control.TextField) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Font(javafx.scene.text.Font) FormBuilder(bisq.desktop.util.FormBuilder) Subscription(org.fxmisc.easybind.Subscription) PaymentMethod(bisq.core.payment.payload.PaymentMethod) Separator(javafx.scene.control.Separator) Priority(javafx.scene.layout.Priority) PaymentAccount(bisq.core.payment.PaymentAccount) DevEnv(bisq.common.app.DevEnv) AnchorPane(javafx.scene.layout.AnchorPane) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) UserThread(bisq.common.UserThread) AccountSettingsView(bisq.desktop.main.account.settings.AccountSettingsView) NotNull(org.jetbrains.annotations.NotNull) PortfolioView(bisq.desktop.main.portfolio.PortfolioView) GUIUtil(bisq.desktop.util.GUIUtil) ColumnConstraints(javafx.scene.layout.ColumnConstraints) OfferDetailsWindow(bisq.desktop.main.overlays.windows.OfferDetailsWindow) FormBuilder.getNonEditableValueCurrencyBox(bisq.desktop.util.FormBuilder.getNonEditableValueCurrencyBox) FundsTextField(bisq.desktop.components.FundsTextField) PendingTradesView(bisq.desktop.main.portfolio.pendingtrades.PendingTradesView) FormBuilder.getAmountCurrencyBox(bisq.desktop.util.FormBuilder.getAmountCurrencyBox) Notification(bisq.desktop.main.overlays.notifications.Notification) FxmlView(bisq.desktop.common.view.FxmlView) Inject(javax.inject.Inject) Tuple2(bisq.common.util.Tuple2) WithdrawalView(bisq.desktop.main.funds.withdrawal.WithdrawalView) OfferPayload(bisq.core.offer.OfferPayload) Tuple3(bisq.common.util.Tuple3) Insets(javafx.geometry.Insets) VPos(javafx.geometry.VPos) FundsView(bisq.desktop.main.funds.FundsView) Tooltip(javafx.scene.control.Tooltip) TitledGroupBg(bisq.desktop.components.TitledGroupBg) AccountView(bisq.desktop.main.account.AccountView) GridPane(javafx.scene.layout.GridPane) BsqReceiveView(bisq.desktop.main.dao.wallet.receive.BsqReceiveView) DaoView(bisq.desktop.main.dao.DaoView) Label(javafx.scene.control.Label) DontShowAgainLookup(bisq.core.user.DontShowAgainLookup) OfferView(bisq.desktop.main.offer.OfferView) AddressTextField(bisq.desktop.components.AddressTextField) BsqFormatter(bisq.desktop.util.BsqFormatter) TimeUnit(java.util.concurrent.TimeUnit) MainView(bisq.desktop.main.MainView) Bindings.createStringBinding(javafx.beans.binding.Bindings.createStringBinding) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) EasyBind(org.fxmisc.easybind.EasyBind) ImageView(javafx.scene.image.ImageView) ActivatableViewAndModel(bisq.desktop.common.view.ActivatableViewAndModel) ChangeListener(javafx.beans.value.ChangeListener) Image(javafx.scene.image.Image) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) Popup(bisq.desktop.main.overlays.popups.Popup)

Example 20 with Popup

use of bisq.desktop.main.overlays.popups.Popup in project bisq-desktop by bisq-network.

the class DisputeSummaryWindow method applyCustomAmounts.

private void applyCustomAmounts(InputTextField inputTextField) {
    Contract contract = dispute.getContract();
    Coin buyerAmount = formatter.parseToCoin(buyerPayoutAmountInputTextField.getText());
    Coin sellerAmount = formatter.parseToCoin(sellerPayoutAmountInputTextField.getText());
    Offer offer = new Offer(contract.getOfferPayload());
    Coin available = contract.getTradeAmount().add(offer.getBuyerSecurityDeposit()).add(offer.getSellerSecurityDeposit());
    Coin totalAmount = buyerAmount.add(sellerAmount);
    if (totalAmount.compareTo(available) > 0) {
        new Popup<>().warning(Res.get("disputeSummaryWindow.payout.adjustAmount", available.toFriendlyString())).show();
        if (inputTextField == buyerPayoutAmountInputTextField) {
            buyerAmount = available.subtract(sellerAmount);
            inputTextField.setText(formatter.formatCoin(buyerAmount));
        } else if (inputTextField == sellerPayoutAmountInputTextField) {
            sellerAmount = available.subtract(buyerAmount);
            inputTextField.setText(formatter.formatCoin(sellerAmount));
        }
    }
    disputeResult.setBuyerPayoutAmount(buyerAmount);
    disputeResult.setSellerPayoutAmount(sellerAmount);
    if (buyerAmount.compareTo(sellerAmount) > 0)
        disputeResult.setWinner(DisputeResult.Winner.BUYER);
    else
        disputeResult.setWinner(DisputeResult.Winner.SELLER);
}
Also used : Coin(org.bitcoinj.core.Coin) Offer(bisq.core.offer.Offer) Popup(bisq.desktop.main.overlays.popups.Popup) Contract(bisq.core.trade.Contract)

Aggregations

Popup (bisq.desktop.main.overlays.popups.Popup)57 Label (javafx.scene.control.Label)22 Coin (org.bitcoinj.core.Coin)17 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)16 Button (javafx.scene.control.Button)16 Res (bisq.core.locale.Res)13 AutoTooltipButton (bisq.desktop.components.AutoTooltipButton)13 Insets (javafx.geometry.Insets)13 InputTextField (bisq.desktop.components.InputTextField)12 BSFormatter (bisq.desktop.util.BSFormatter)12 Transaction (org.bitcoinj.core.Transaction)12 List (java.util.List)11 UserThread (bisq.common.UserThread)10 ChangeListener (javafx.beans.value.ChangeListener)9 BusyAnimation (bisq.desktop.components.BusyAnimation)8 ObservableList (javafx.collections.ObservableList)8 HBox (javafx.scene.layout.HBox)8 Tuple2 (bisq.common.util.Tuple2)7 FxmlView (bisq.desktop.common.view.FxmlView)7 TradeCurrency (bisq.core.locale.TradeCurrency)6