diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 98f4fe65a8..36bb8f3d77 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -418,7 +418,9 @@ createOffer.changePrice=Change price createOffer.tac=With publishing this offer I agree to trade with any trader who fulfills the conditions as defined in this screen. createOffer.currencyForFee=Trade fee createOffer.setDeposit=Set buyer's security deposit (%) +createOffer.setDepositAsBuyer=Set my security deposit as buyer (%) createOffer.securityDepositInfo=Your buyer''s security deposit will be {0} +createOffer.securityDepositInfoAsBuyer=Your security deposit as buyer will be {0} #################################################################### diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java index de1313b102..e84befe479 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java @@ -147,7 +147,7 @@ public abstract class MutableOfferView extends private FundsTextField totalToPayTextField; private Label amountDescriptionLabel, priceCurrencyLabel, priceDescriptionLabel, volumeDescriptionLabel, waitingForFundsLabel, marketBasedPriceLabel, percentagePriceDescription, tradeFeeDescriptionLabel, - resultLabel, tradeFeeInBtcLabel, tradeFeeInBsqLabel, xLabel, fakeXLabel; + resultLabel, tradeFeeInBtcLabel, tradeFeeInBsqLabel, xLabel, fakeXLabel, buyerSecurityDepositLabel; protected Label amountBtcLabel, volumeCurrencyLabel, minAmountBtcLabel; private ComboBox paymentAccountsComboBox; private ComboBox currencyComboBox; @@ -578,6 +578,7 @@ public abstract class MutableOfferView extends totalToPayTextField.textProperty().bind(model.totalToPay); addressTextField.amountAsCoinProperty().bind(model.getDataModel().getMissingCoin()); buyerSecurityDepositInputTextField.textProperty().bindBidirectional(model.buyerSecurityDeposit); + buyerSecurityDepositLabel.textProperty().bind(model.buyerSecurityDepositLabel); tradeFeeInBtcLabel.textProperty().bind(model.tradeFeeInBtcWithFiat); tradeFeeInBsqLabel.textProperty().bind(model.tradeFeeInBsqWithFiat); tradeFeeDescriptionLabel.textProperty().bind(model.tradeFeeDescription); @@ -628,6 +629,7 @@ public abstract class MutableOfferView extends totalToPayTextField.textProperty().unbind(); addressTextField.amountAsCoinProperty().unbind(); buyerSecurityDepositInputTextField.textProperty().unbindBidirectional(model.buyerSecurityDeposit); + buyerSecurityDepositLabel.textProperty().unbind(); tradeFeeInBtcLabel.textProperty().unbind(); tradeFeeInBsqLabel.textProperty().unbind(); tradeFeeDescriptionLabel.textProperty().unbind(); @@ -767,7 +769,7 @@ public abstract class MutableOfferView extends buyerSecurityDepositInBTCListener = (observable, oldValue, newValue) -> { if (!newValue.equals("")) { - Label depositInBTCInfo = createPopoverLabel(Res.get("createOffer.securityDepositInfo", newValue)); + Label depositInBTCInfo = createPopoverLabel(model.getSecurityDepositPopOverLabel(newValue)); buyerSecurityDepositInfoInputTextField.setContentForInfoPopOver(depositInBTCInfo); } else { buyerSecurityDepositInfoInputTextField.setContentForInfoPopOver(null); @@ -1127,7 +1129,9 @@ public abstract class MutableOfferView extends // getEditableValueBox delivers BTC, so we overwrite it with % buyerSecurityDepositPercentageLabel.setText("%"); - VBox depositBox = getTradeInputBox(tuple.first, Res.get("createOffer.setDeposit")).second; + Tuple2 tradeInputBoxTuple = getTradeInputBox(tuple.first, model.getSecurityDepositLabel()); + VBox depositBox = tradeInputBoxTuple.second; + buyerSecurityDepositLabel = tradeInputBoxTuple.first; depositBox.setMaxWidth(310); editOfferElements.add(buyerSecurityDepositInputTextField); diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java index cf59a6ec1c..f65b67c217 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java @@ -106,6 +106,7 @@ public abstract class MutableOfferViewModel ext public final StringProperty minAmount = new SimpleStringProperty(); final StringProperty buyerSecurityDeposit = new SimpleStringProperty(); final StringProperty buyerSecurityDepositInBTC = new SimpleStringProperty(); + final StringProperty buyerSecurityDepositLabel = new SimpleStringProperty(); // Price in the viewModel is always dependent on fiat/altcoin: Fiat Fiat/BTC, for altcoins we use inverted price. // The domain (dataModel) uses always the same price model (otherCurrencyBTC) @@ -461,7 +462,8 @@ public abstract class MutableOfferViewModel ext securityDepositAsDoubleListener = (ov, oldValue, newValue) -> { if (newValue != null) { buyerSecurityDeposit.set(btcFormatter.formatToPercent((double) newValue)); - buyerSecurityDepositInBTC.set(btcFormatter.formatCoinWithCode(dataModel.getBuyerSecurityDepositAsCoin())); + if (dataModel.getAmount().get() != null) + buyerSecurityDepositInBTC.set(btcFormatter.formatCoinWithCode(dataModel.getBuyerSecurityDepositAsCoin())); } else { buyerSecurityDeposit.set(""); buyerSecurityDepositInBTC.set(""); @@ -599,6 +601,7 @@ public abstract class MutableOfferViewModel ext isBuy ? Res.get("shared.buy") : Res.get("shared.sell")); buyerSecurityDeposit.set(btcFormatter.formatToPercent(dataModel.getBuyerSecurityDeposit().get())); + buyerSecurityDepositLabel.set(getSecurityDepositLabel()); applyMakerFee(); return result; @@ -919,6 +922,15 @@ public abstract class MutableOfferViewModel ext return btcFormatter.formatCoinWithCode(dataModel.getAmount().get()); } + public String getSecurityDepositLabel() { + return dataModel.isBuyOffer() ? Res.get("createOffer.setDepositAsBuyer") : Res.get("createOffer.setDeposit"); + } + + public String getSecurityDepositPopOverLabel(String depositInBTC) { + return dataModel.isBuyOffer() ? Res.get("createOffer.securityDepositInfoAsBuyer", depositInBTC) : + Res.get("createOffer.securityDepositInfo", depositInBTC); + } + public String getSecurityDepositInfo() { return btcFormatter.formatCoinWithCode(dataModel.getSecurityDeposit()) + GUIUtil.getPercentageOfTradeAmount(dataModel.getSecurityDeposit(), dataModel.getAmount().get(), btcFormatter); diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java index daa93a22d8..7d7147c114 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java @@ -292,8 +292,9 @@ public class PendingTradesViewModel extends ActivatableWithDataModel getTradeInputBox(Pane amountValueBox, String descriptionText) { Label descriptionLabel = new AutoTooltipLabel(descriptionText); descriptionLabel.setId("input-description-label"); - descriptionLabel.setPrefWidth(170); + descriptionLabel.setPrefWidth(190); VBox box = new VBox(); box.setPadding(new Insets(10, 0, 0, 0));