apply code inspection

This commit is contained in:
Manfred Karrer 2017-03-07 20:20:26 -05:00
parent a5027d50dc
commit 5121e759d1
3 changed files with 51 additions and 51 deletions

View file

@ -27,10 +27,8 @@ import io.bitsquare.btc.listeners.BalanceListener;
import io.bitsquare.btc.provider.fee.FeeService; import io.bitsquare.btc.provider.fee.FeeService;
import io.bitsquare.btc.provider.price.PriceFeedService; import io.bitsquare.btc.provider.price.PriceFeedService;
import io.bitsquare.btc.wallet.BtcWalletService; import io.bitsquare.btc.wallet.BtcWalletService;
import io.bitsquare.btc.wallet.TradeWalletService;
import io.bitsquare.common.crypto.KeyRing; import io.bitsquare.common.crypto.KeyRing;
import io.bitsquare.common.util.Utilities; import io.bitsquare.common.util.Utilities;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.common.model.ActivatableDataModel; import io.bitsquare.gui.common.model.ActivatableDataModel;
import io.bitsquare.gui.main.offer.createoffer.monetary.Price; import io.bitsquare.gui.main.offer.createoffer.monetary.Price;
import io.bitsquare.gui.main.offer.createoffer.monetary.Volume; import io.bitsquare.gui.main.offer.createoffer.monetary.Volume;
@ -66,7 +64,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
class CreateOfferDataModel extends ActivatableDataModel { class CreateOfferDataModel extends ActivatableDataModel {
private final OpenOfferManager openOfferManager; private final OpenOfferManager openOfferManager;
private final BtcWalletService walletService; private final BtcWalletService walletService;
private final TradeWalletService tradeWalletService;
private final Preferences preferences; private final Preferences preferences;
private final User user; private final User user;
private final KeyRing keyRing; private final KeyRing keyRing;
@ -74,7 +71,6 @@ class CreateOfferDataModel extends ActivatableDataModel {
private final PriceFeedService priceFeedService; private final PriceFeedService priceFeedService;
final String shortOfferId; final String shortOfferId;
private final FeeService feeService; private final FeeService feeService;
private final Navigation navigation;
private final BSFormatter formatter; private final BSFormatter formatter;
private final String offerId; private final String offerId;
private final AddressEntry addressEntry; private final AddressEntry addressEntry;
@ -122,19 +118,17 @@ class CreateOfferDataModel extends ActivatableDataModel {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
CreateOfferDataModel(OpenOfferManager openOfferManager, BtcWalletService walletService, TradeWalletService tradeWalletService, CreateOfferDataModel(OpenOfferManager openOfferManager, BtcWalletService walletService,
Preferences preferences, User user, KeyRing keyRing, P2PService p2PService, PriceFeedService priceFeedService, Preferences preferences, User user, KeyRing keyRing, P2PService p2PService, PriceFeedService priceFeedService,
FeeService feeService, Navigation navigation, BSFormatter formatter) { FeeService feeService, BSFormatter formatter) {
this.openOfferManager = openOfferManager; this.openOfferManager = openOfferManager;
this.walletService = walletService; this.walletService = walletService;
this.tradeWalletService = tradeWalletService;
this.preferences = preferences; this.preferences = preferences;
this.user = user; this.user = user;
this.keyRing = keyRing; this.keyRing = keyRing;
this.p2PService = p2PService; this.p2PService = p2PService;
this.priceFeedService = priceFeedService; this.priceFeedService = priceFeedService;
this.feeService = feeService; this.feeService = feeService;
this.navigation = navigation;
this.formatter = formatter; this.formatter = formatter;
offerId = Utilities.getRandomPrefix(5, 8) + "-" + offerId = Utilities.getRandomPrefix(5, 8) + "-" +
@ -226,7 +220,7 @@ class CreateOfferDataModel extends ActivatableDataModel {
fillPaymentAccounts(); fillPaymentAccounts();
PaymentAccount account = user.findFirstPaymentAccountWithCurrency(tradeCurrency); PaymentAccount account = user.findFirstPaymentAccountWithCurrency(tradeCurrency);
if (account != null && !isUSBankAccount(account)) { if (account != null && isNotUSBankAccount(account)) {
paymentAccount = account; paymentAccount = account;
this.tradeCurrency = tradeCurrency; this.tradeCurrency = tradeCurrency;
} else { } else {
@ -240,6 +234,7 @@ class CreateOfferDataModel extends ActivatableDataModel {
} }
} }
if (this.tradeCurrency != null)
tradeCurrencyCode.set(this.tradeCurrency.getCode()); tradeCurrencyCode.set(this.tradeCurrency.getCode());
if (!preferences.getUseStickyMarketPrice()) if (!preferences.getUseStickyMarketPrice())
@ -556,6 +551,7 @@ class CreateOfferDataModel extends ActivatableDataModel {
log.debug("missingCoin " + missingCoin.get().toFriendlyString()); log.debug("missingCoin " + missingCoin.get().toFriendlyString());
isWalletFunded.set(isBalanceSufficient(balance.get())); isWalletFunded.set(isBalanceSufficient(balance.get()));
//noinspection PointlessBooleanExpression
if (totalToPayAsCoin.get() != null && isWalletFunded.get() && walletFundedNotification == null && !DevFlags.DEV_MODE) { if (totalToPayAsCoin.get() != null && isWalletFunded.get() && walletFundedNotification == null && !DevFlags.DEV_MODE) {
walletFundedNotification = new Notification() walletFundedNotification = new Notification()
.headLine("Trading wallet update") .headLine("Trading wallet update")
@ -599,15 +595,16 @@ class CreateOfferDataModel extends ActivatableDataModel {
private void fillPaymentAccounts() { private void fillPaymentAccounts() {
paymentAccounts.setAll(user.getPaymentAccounts().stream() paymentAccounts.setAll(user.getPaymentAccounts().stream()
.filter(e -> !isUSBankAccount(e)) .filter(this::isNotUSBankAccount)
.collect(Collectors.toSet())); .collect(Collectors.toSet()));
} }
private boolean isUSBankAccount(PaymentAccount paymentAccount) { private boolean isNotUSBankAccount(PaymentAccount paymentAccount) {
//noinspection SimplifiableIfStatement
if (paymentAccount instanceof SameCountryRestrictedBankAccount && paymentAccount.getContractData() instanceof BankAccountContractData) if (paymentAccount instanceof SameCountryRestrictedBankAccount && paymentAccount.getContractData() instanceof BankAccountContractData)
return ((SameCountryRestrictedBankAccount) paymentAccount).getCountryCode().equals("US"); return !((SameCountryRestrictedBankAccount) paymentAccount).getCountryCode().equals("US");
else else
return false; return true;
} }
void setAmount(Coin amount) { void setAmount(Coin amount) {

View file

@ -121,14 +121,14 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
private EventHandler<ActionEvent> currencyComboBoxSelectionHandler; private EventHandler<ActionEvent> currencyComboBoxSelectionHandler;
private int gridRow = 0; private int gridRow = 0;
private final Preferences preferences; private final Preferences preferences;
private BSFormatter formatter; private final BSFormatter formatter;
private ChangeListener<String> tradeCurrencyCodeListener; private ChangeListener<String> tradeCurrencyCodeListener;
private ImageView qrCodeImageView; private ImageView qrCodeImageView;
private HBox fundingHBox; private HBox fundingHBox;
private Subscription isWaitingForFundsSubscription; private Subscription isWaitingForFundsSubscription;
private Subscription cancelButton2StyleSubscription; private Subscription cancelButton2StyleSubscription;
private Subscription balanceSubscription; private Subscription balanceSubscription;
private List<Node> editOfferElements = new ArrayList<>(); private final List<Node> editOfferElements = new ArrayList<>();
private boolean isActivated; private boolean isActivated;
private Label xLabel; private Label xLabel;
private VBox fixedPriceBox; private VBox fixedPriceBox;
@ -172,7 +172,9 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
paymentAccountsComboBox.setConverter(new StringConverter<PaymentAccount>() { paymentAccountsComboBox.setConverter(new StringConverter<PaymentAccount>() {
@Override @Override
public String toString(PaymentAccount paymentAccount) { public String toString(PaymentAccount paymentAccount) {
return paymentAccount.getAccountName() + " (" + paymentAccount.getSingleTradeCurrency().getCode() + ", " + TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
String code = singleTradeCurrency != null ? singleTradeCurrency.getCode() : "";
return paymentAccount.getAccountName() + " (" + code + ", " +
Res.get(paymentAccount.getPaymentMethod().getId()) + ")"; Res.get(paymentAccount.getPaymentMethod().getId()) + ")";
} }
@ -299,10 +301,10 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
if (model.isBootstrapped()) { if (model.isBootstrapped()) {
if (model.hasAcceptedArbitrators()) { if (model.hasAcceptedArbitrators()) {
Offer offer = model.createAndGetOffer(); Offer offer = model.createAndGetOffer();
//noinspection PointlessBooleanExpression
if (!DevFlags.DEV_MODE) if (!DevFlags.DEV_MODE)
offerDetailsWindow.onPlaceOffer(() -> offerDetailsWindow.onPlaceOffer(() ->
model.onPlaceOffer(offer, () -> model.onPlaceOffer(offer, offerDetailsWindow::hide))
offerDetailsWindow.hide()))
.show(offer); .show(offer);
else else
model.onPlaceOffer(offer, () -> { model.onPlaceOffer(offer, () -> {
@ -330,6 +332,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
balanceTextField.setTargetAmount(model.dataModel.totalToPayAsCoin.get()); balanceTextField.setTargetAmount(model.dataModel.totalToPayAsCoin.get());
//noinspection PointlessBooleanExpression
if (!DevFlags.DEV_MODE) { if (!DevFlags.DEV_MODE) {
String key = "securityDepositInfo"; String key = "securityDepositInfo";
new Popup().backgroundInfo("To ensure that both traders follow the trade protocol they need to pay a security deposit.\n\n" + new Popup().backgroundInfo("To ensure that both traders follow the trade protocol they need to pay a security deposit.\n\n" +
@ -416,7 +419,9 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
model.onPaymentAccountSelected(paymentAccount); model.onPaymentAccountSelected(paymentAccount);
} else { } else {
currencyTextField.setText(paymentAccount.getSingleTradeCurrency().getNameAndCode()); TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
if (singleTradeCurrency != null)
currencyTextField.setText(singleTradeCurrency.getNameAndCode());
model.onPaymentAccountSelected(paymentAccount); model.onPaymentAccountSelected(paymentAccount);
model.onCurrencySelected(paymentAccount.getSingleTradeCurrency()); model.onCurrencySelected(paymentAccount.getSingleTradeCurrency());
} }
@ -563,7 +568,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
cancelButton2StyleSubscription = EasyBind.subscribe(placeOfferButton.visibleProperty(), cancelButton2StyleSubscription = EasyBind.subscribe(placeOfferButton.visibleProperty(),
isVisible -> cancelButton2.setId(isVisible ? "cancel-button" : null)); isVisible -> cancelButton2.setId(isVisible ? "cancel-button" : null));
balanceSubscription = EasyBind.subscribe(model.dataModel.balance, newValue -> balanceTextField.setBalance(newValue)); balanceSubscription = EasyBind.subscribe(model.dataModel.balance, balanceTextField::setBalance);
} }
private void removeSubscriptions() { private void removeSubscriptions() {
@ -574,27 +579,27 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
private void createListeners() { private void createListeners() {
amountFocusedListener = (o, oldValue, newValue) -> { amountFocusedListener = (o, oldValue, newValue) -> {
model.onFocusOutAmountTextField(oldValue, newValue, amountTextField.getText()); model.onFocusOutAmountTextField(oldValue, newValue);
amountTextField.setText(model.amount.get()); amountTextField.setText(model.amount.get());
}; };
minAmountFocusedListener = (o, oldValue, newValue) -> { minAmountFocusedListener = (o, oldValue, newValue) -> {
model.onFocusOutMinAmountTextField(oldValue, newValue, minAmountTextField.getText()); model.onFocusOutMinAmountTextField(oldValue, newValue);
minAmountTextField.setText(model.minAmount.get()); minAmountTextField.setText(model.minAmount.get());
}; };
priceFocusedListener = (o, oldValue, newValue) -> { priceFocusedListener = (o, oldValue, newValue) -> {
model.onFocusOutPriceTextField(oldValue, newValue, fixedPriceTextField.getText()); model.onFocusOutPriceTextField(oldValue, newValue);
fixedPriceTextField.setText(model.price.get()); fixedPriceTextField.setText(model.price.get());
}; };
priceAsPercentageFocusedListener = (o, oldValue, newValue) -> { priceAsPercentageFocusedListener = (o, oldValue, newValue) -> {
model.onFocusOutPriceAsPercentageTextField(oldValue, newValue, marketBasedPriceTextField.getText()); model.onFocusOutPriceAsPercentageTextField(oldValue, newValue);
marketBasedPriceTextField.setText(model.marketPriceMargin.get()); marketBasedPriceTextField.setText(model.marketPriceMargin.get());
}; };
volumeFocusedListener = (o, oldValue, newValue) -> { volumeFocusedListener = (o, oldValue, newValue) -> {
model.onFocusOutVolumeTextField(oldValue, newValue, volumeTextField.getText()); model.onFocusOutVolumeTextField(oldValue, newValue);
volumeTextField.setText(model.volume.get()); volumeTextField.setText(model.volume.get());
}; };
securityDepositFocusedListener = (o, oldValue, newValue) -> { securityDepositFocusedListener = (o, oldValue, newValue) -> {
model.onFocusOutSecurityDepositTextField(oldValue, newValue, securityDepositTextField.getText()); model.onFocusOutSecurityDepositTextField(oldValue, newValue);
securityDepositTextField.setText(model.securityDeposit.get()); securityDepositTextField.setText(model.securityDeposit.get());
}; };
errorMessageListener = (o, oldValue, newValue) -> { errorMessageListener = (o, oldValue, newValue) -> {
@ -664,9 +669,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
}; };
marketPriceAvailableListener = (observable, oldValue, newValue) -> { marketPriceAvailableListener = (observable, oldValue, newValue) -> updateMarketPriceAvailable();
updateMarketPriceAvailable();
};
} }
private void updateMarketPriceAvailable() { private void updateMarketPriceAvailable() {
@ -1054,9 +1057,9 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
model.dataModel.setUseMarketBasedPrice(!fixedPriceSelected); model.dataModel.setUseMarketBasedPrice(!fixedPriceSelected);
if (!fixedPriceButton.isSelected() && fixedPriceSelected) if (!fixedPriceButton.isSelected() && fixedPriceSelected)
fixedPriceButton.setSelected(fixedPriceSelected); fixedPriceButton.setSelected(true);
if (useMarketBasedPriceButton.isSelected() && !fixedPriceSelected) if (useMarketBasedPriceButton.isSelected() && !fixedPriceSelected)
useMarketBasedPriceButton.setSelected(!fixedPriceSelected); useMarketBasedPriceButton.setSelected(false);
} }
fixedPriceButton.setMouseTransparent(fixedPriceSelected); fixedPriceButton.setMouseTransparent(fixedPriceSelected);

View file

@ -63,10 +63,10 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
private final BtcValidator btcValidator; private final BtcValidator btcValidator;
private final SecurityDepositValidator securityDepositValidator; private final SecurityDepositValidator securityDepositValidator;
private final P2PService p2PService; private final P2PService p2PService;
private PriceFeedService priceFeedService; private final PriceFeedService priceFeedService;
private Preferences preferences; private final Preferences preferences;
private Navigation navigation; private final Navigation navigation;
final BSFormatter formatter; private final BSFormatter formatter;
private final FiatValidator fiatValidator; private final FiatValidator fiatValidator;
private String amountDescription; private String amountDescription;
@ -103,7 +103,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
final BooleanProperty isNextButtonDisabled = new SimpleBooleanProperty(true); final BooleanProperty isNextButtonDisabled = new SimpleBooleanProperty(true);
final BooleanProperty placeOfferCompleted = new SimpleBooleanProperty(); final BooleanProperty placeOfferCompleted = new SimpleBooleanProperty();
final BooleanProperty showPayFundsScreenDisplayed = new SimpleBooleanProperty(); final BooleanProperty showPayFundsScreenDisplayed = new SimpleBooleanProperty();
final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty(); private final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty();
final BooleanProperty isWaitingForFunds = new SimpleBooleanProperty(); final BooleanProperty isWaitingForFunds = new SimpleBooleanProperty();
final ObjectProperty<InputValidator.ValidationResult> amountValidationResult = new SimpleObjectProperty<>(); final ObjectProperty<InputValidator.ValidationResult> amountValidationResult = new SimpleObjectProperty<>();
@ -113,7 +113,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
final ObjectProperty<InputValidator.ValidationResult> securityDepositValidationResult = new SimpleObjectProperty<>(); final ObjectProperty<InputValidator.ValidationResult> securityDepositValidationResult = new SimpleObjectProperty<>();
// Those are needed for the addressTextField // Those are needed for the addressTextField
final ObjectProperty<Address> address = new SimpleObjectProperty<>(); private final ObjectProperty<Address> address = new SimpleObjectProperty<>();
private ChangeListener<String> amountStringListener; private ChangeListener<String> amountStringListener;
private ChangeListener<String> minAmountStringListener; private ChangeListener<String> minAmountStringListener;
@ -178,7 +178,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
minAmount.set(amount.get()); minAmount.set(amount.get());
UserThread.runAfter(() -> { UserThread.runAfter(() -> {
price.set("1000"); price.set("1000");
onFocusOutPriceAsPercentageTextField(true, false, ""); onFocusOutPriceAsPercentageTextField(true, false);
}, 1); }, 1);
setAmountToModel(); setAmountToModel();
@ -578,7 +578,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
"You need " + formatter.formatCoinWithCode(dataModel.totalToPayAsCoin.get()) + " but you have only " + "You need " + formatter.formatCoinWithCode(dataModel.totalToPayAsCoin.get()) + " but you have only " +
formatter.formatCoinWithCode(dataModel.totalAvailableBalance) + " in your Bitsquare wallet.\n\n" + formatter.formatCoinWithCode(dataModel.totalAvailableBalance) + " in your Bitsquare wallet.\n\n" +
"Please fund that trade from an external Bitcoin wallet or fund your Bitsquare " + "Please fund that trade from an external Bitcoin wallet or fund your Bitsquare " +
"wallet at \"Funds/Depost funds\".") "wallet at \"Funds/Deposit funds\".")
.actionButtonText("Go to \"Funds/Deposit funds\"") .actionButtonText("Go to \"Funds/Deposit funds\"")
.onAction(() -> navigation.navigateTo(MainView.class, FundsView.class, DepositView.class)) .onAction(() -> navigation.navigateTo(MainView.class, FundsView.class, DepositView.class))
.show(); .show();
@ -593,7 +593,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// On focus out we do validation and apply the data to the model // On focus out we do validation and apply the data to the model
void onFocusOutAmountTextField(boolean oldValue, boolean newValue, String userInput) { void onFocusOutAmountTextField(boolean oldValue, boolean newValue) {
if (oldValue && !newValue) { if (oldValue && !newValue) {
InputValidator.ValidationResult result = isBtcInputValid(amount.get()); InputValidator.ValidationResult result = isBtcInputValid(amount.get());
amountValidationResult.set(result); amountValidationResult.set(result);
@ -615,7 +615,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
} }
} }
void onFocusOutMinAmountTextField(boolean oldValue, boolean newValue, String userInput) { void onFocusOutMinAmountTextField(boolean oldValue, boolean newValue) {
if (oldValue && !newValue) { if (oldValue && !newValue) {
InputValidator.ValidationResult result = isBtcInputValid(minAmount.get()); InputValidator.ValidationResult result = isBtcInputValid(minAmount.get());
minAmountValidationResult.set(result); minAmountValidationResult.set(result);
@ -634,7 +634,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
} }
} }
void onFocusOutPriceTextField(boolean oldValue, boolean newValue, String userInput) { void onFocusOutPriceTextField(boolean oldValue, boolean newValue) {
if (oldValue && !newValue) { if (oldValue && !newValue) {
InputValidator.ValidationResult result = isPriceInputValid(price.get()); InputValidator.ValidationResult result = isPriceInputValid(price.get());
boolean isValid = result.isValid; boolean isValid = result.isValid;
@ -651,13 +651,13 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
} }
} }
void onFocusOutPriceAsPercentageTextField(boolean oldValue, boolean newValue, String userInput) { void onFocusOutPriceAsPercentageTextField(boolean oldValue, boolean newValue) {
inputIsMarketBasedPrice = !oldValue && newValue; inputIsMarketBasedPrice = !oldValue && newValue;
if (oldValue && !newValue) if (oldValue && !newValue)
marketPriceMargin.set(formatter.formatRoundedDoubleWithPrecision(dataModel.getMarketPriceMargin() * 100, 2)); marketPriceMargin.set(formatter.formatRoundedDoubleWithPrecision(dataModel.getMarketPriceMargin() * 100, 2));
} }
void onFocusOutVolumeTextField(boolean oldValue, boolean newValue, String userInput) { void onFocusOutVolumeTextField(boolean oldValue, boolean newValue) {
if (oldValue && !newValue) { if (oldValue && !newValue) {
InputValidator.ValidationResult result = isVolumeInputValid(volume.get()); InputValidator.ValidationResult result = isVolumeInputValid(volume.get());
volumeValidationResult.set(result); volumeValidationResult.set(result);
@ -685,7 +685,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
} }
} }
void onFocusOutSecurityDepositTextField(boolean oldValue, boolean newValue, String userInput) { void onFocusOutSecurityDepositTextField(boolean oldValue, boolean newValue) {
if (oldValue && !newValue) { if (oldValue && !newValue) {
InputValidator.ValidationResult result = securityDepositValidator.validate(securityDeposit.get()); InputValidator.ValidationResult result = securityDepositValidator.validate(securityDeposit.get());
securityDepositValidationResult.set(result); securityDepositValidationResult.set(result);
@ -708,17 +708,17 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
ignoreSecurityDepositStringListener = false; ignoreSecurityDepositStringListener = false;
}) })
.closeButtonText("Yes, use my lower value") .closeButtonText("Yes, use my lower value")
.onClose(() -> applySecurityDepositOnFocusOut(result)) .onClose(() -> applySecurityDepositOnFocusOut())
.dontShowAgainId(securityDepositLowerAsDefault, preferences) .dontShowAgainId(securityDepositLowerAsDefault, preferences)
.show(); .show();
} else { } else {
applySecurityDepositOnFocusOut(result); applySecurityDepositOnFocusOut();
} }
} }
} }
} }
private void applySecurityDepositOnFocusOut(InputValidator.ValidationResult result) { private void applySecurityDepositOnFocusOut() {
setSecurityDepositToModel(); setSecurityDepositToModel();
ignoreSecurityDepositStringListener = true; ignoreSecurityDepositStringListener = true;
securityDeposit.set(formatter.formatCoin(dataModel.securityDeposit.get())); securityDeposit.set(formatter.formatCoin(dataModel.securityDeposit.get()));
@ -750,7 +750,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
formatter.formatToPercentWithSymbol(preferences.getMaxPriceDistanceInPercent()) + formatter.formatToPercentWithSymbol(preferences.getMaxPriceDistanceInPercent()) +
" and can be adjusted in the preferences.") " and can be adjusted in the preferences.")
.actionButtonText("Change price") .actionButtonText("Change price")
.onAction(() -> popup.hide()) .onAction(popup::hide)
.closeButtonText("Go to \"Preferences\"") .closeButtonText("Go to \"Preferences\"")
.onClose(() -> navigation.navigateTo(MainView.class, SettingsView.class, PreferencesView.class)) .onClose(() -> navigation.navigateTo(MainView.class, SettingsView.class, PreferencesView.class))
.show(); .show();