Skip to content

Commit

Permalink
Improve wording for security deposit
Browse files Browse the repository at this point in the history
  • Loading branch information
ripcurlx committed Mar 7, 2019
1 parent eefa649 commit 0a42b15
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
2 changes: 2 additions & 0 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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}


####################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> 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<PaymentAccount> paymentAccountsComboBox;
private ComboBox<TradeCurrency> currencyComboBox;
Expand Down Expand Up @@ -578,6 +578,7 @@ private void addBindings() {
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);
Expand Down Expand Up @@ -628,6 +629,7 @@ private void removeBindings() {
totalToPayTextField.textProperty().unbind();
addressTextField.amountAsCoinProperty().unbind();
buyerSecurityDepositInputTextField.textProperty().unbindBidirectional(model.buyerSecurityDeposit);
buyerSecurityDepositLabel.textProperty().unbind();
tradeFeeInBtcLabel.textProperty().unbind();
tradeFeeInBsqLabel.textProperty().unbind();
tradeFeeDescriptionLabel.textProperty().unbind();
Expand Down Expand Up @@ -767,7 +769,7 @@ private void createListeners() {

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);
Expand Down Expand Up @@ -1127,7 +1129,9 @@ private VBox getBuyerSecurityDepositBox() {
// getEditableValueBox delivers BTC, so we overwrite it with %
buyerSecurityDepositPercentageLabel.setText("%");

VBox depositBox = getTradeInputBox(tuple.first, Res.get("createOffer.setDeposit")).second;
Tuple2<Label, VBox> tradeInputBoxTuple = getTradeInputBox(tuple.first, model.getSecurityDepositLabel());
VBox depositBox = tradeInputBoxTuple.second;
buyerSecurityDepositLabel = tradeInputBoxTuple.first;
depositBox.setMaxWidth(310);

editOfferElements.add(buyerSecurityDepositInputTextField);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> 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)
Expand Down Expand Up @@ -600,6 +601,7 @@ boolean initWithData(OfferPayload.Direction direction, TradeCurrency tradeCurren
isBuy ? Res.get("shared.buy") : Res.get("shared.sell"));

buyerSecurityDeposit.set(btcFormatter.formatToPercent(dataModel.getBuyerSecurityDeposit().get()));
buyerSecurityDepositLabel.set(getSecurityDepositLabel());

applyMakerFee();
return result;
Expand Down Expand Up @@ -920,6 +922,15 @@ public String getTradeAmount() {
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);
Expand Down
2 changes: 1 addition & 1 deletion desktop/src/main/java/bisq/desktop/util/FormBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,7 @@ public static Tuple3<HBox, InfoInputTextField, Label> getNonEditableValueBoxWith
public static Tuple2<Label, VBox> 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));
Expand Down

0 comments on commit 0a42b15

Please sign in to comment.