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();
}
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();*/
}
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);
}
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));
}
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);
}
Aggregations