diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/components/PriceInput.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/components/PriceInput.java index aedf091965..8fd6f1e86f 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/components/PriceInput.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/components/PriceInput.java @@ -195,6 +195,7 @@ private Model() { public void reset() { priceQuote.set(null); + priceString.set(null); market = null; isFocused = false; description.set(null); diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/price/TradeWizardPriceController.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/price/TradeWizardPriceController.java index 0f5e94dc9b..387d17b031 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/price/TradeWizardPriceController.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/price/TradeWizardPriceController.java @@ -72,6 +72,7 @@ public ReadOnlyObjectProperty getPriceSpec() { } public void reset() { + priceInput.reset(); model.reset(); } @@ -164,18 +165,15 @@ private void applyPercentageFromQuote(PriceQuote priceQuote) { model.getPercentageAsString().set(formatToPercentWithSymbol(percentage)); } - //todo add validator and give feedback private boolean isQuoteValid(PriceQuote priceQuote) { double percentage = getPercentage(priceQuote); - if (percentage >= -0.1 && percentage <= 0.5) { - return true; - } - return false; + return percentage >= -0.1 && percentage <= 0.5; } private double getPercentage(PriceQuote priceQuote) { - Optional optionalPercentage = PriceSpecUtil.createFloatPriceSpec(marketPriceService, priceQuote).map(FloatPriceSpec::getPercentage); + Optional optionalPercentage = PriceSpecUtil.createFloatPriceSpec(marketPriceService, priceQuote) + .map(FloatPriceSpec::getPercentage); if (optionalPercentage.isEmpty()) { log.error("optionalPercentage not present"); } diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/price/TradeWizardPriceView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/price/TradeWizardPriceView.java index 033cb4f4f5..1cc24e2d8e 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/price/TradeWizardPriceView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/trade_wizard/price/TradeWizardPriceView.java @@ -46,6 +46,7 @@ public class TradeWizardPriceView extends View findFixPriceSpec(PriceSpec priceSpec) { - return priceSpec instanceof FixPriceSpec ? - Optional.of((FixPriceSpec) priceSpec) : - Optional.empty(); + return priceSpec instanceof FixPriceSpec + ? Optional.of((FixPriceSpec) priceSpec) + : Optional.empty(); } public static Optional findFloatPriceSpec(PriceSpec priceSpec) { - return priceSpec instanceof FloatPriceSpec ? - Optional.of((FloatPriceSpec) priceSpec) : - Optional.empty(); + return priceSpec instanceof FloatPriceSpec + ? Optional.of((FloatPriceSpec) priceSpec) + : Optional.empty(); } public static Optional findMarketPriceSpec(PriceSpec priceSpec) { - return priceSpec instanceof MarketPriceSpec ? - Optional.of((MarketPriceSpec) priceSpec) : - Optional.empty(); + return priceSpec instanceof MarketPriceSpec + ? Optional.of((MarketPriceSpec) priceSpec) + : Optional.empty(); } public static Optional createFloatPriceSpec(MarketPriceService marketPriceService, PriceQuote priceQuote) { @@ -53,4 +53,4 @@ public static Optional createFloatPriceSpec(MarketPriceService m .map(FloatPriceSpec::new) .findAny(); } -} \ No newline at end of file +}