From 670a19037e350c251d5176cdece39184a9a9fe0e Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Mon, 27 Oct 2014 02:22:41 +0100 Subject: [PATCH] Reset offerbook filter values at screen change (#235) --- .../main/trade/offerbook/OfferBookViewCB.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookViewCB.java b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookViewCB.java index 31c10ea200..7a8d188c2d 100644 --- a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookViewCB.java +++ b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookViewCB.java @@ -124,7 +124,7 @@ public class OfferBookViewCB extends CachedViewCB { placeholder.setWrapText(true); table.setPlaceholder(placeholder); - setupBindings(); + setupValidators(); setupComparators(); @@ -143,6 +143,12 @@ public class OfferBookViewCB extends CachedViewCB { public void activate() { super.activate(); + amountTextField.setText(""); + priceTextField.setText(""); + volumeTextField.setText(""); + + setupBindings(); + // setOfferBookInfo has been called before SortedList offerList = presentationModel.getOfferList(); table.setItems(offerList); @@ -157,6 +163,8 @@ public class OfferBookViewCB extends CachedViewCB { public void deactivate() { super.deactivate(); + removeBindings(); + } @SuppressWarnings("EmptyMethod") @@ -363,6 +371,20 @@ public class OfferBookViewCB extends CachedViewCB { presentationModel.fiatCode)); } + private void removeBindings() { + amountTextField.textProperty().unbind(); + priceTextField.textProperty().unbind(); + volumeTextField.textProperty().unbind(); + amountBtcLabel.textProperty().unbind(); + priceFiatLabel.textProperty().unbind(); + volumeFiatLabel.textProperty().unbind(); + priceDescriptionLabel.textProperty().unbind(); + volumeDescriptionLabel.textProperty().unbind(); + priceDescriptionLabel.textProperty().unbind(); + volumeDescriptionLabel.textProperty().unbind(); + volumeTextField.promptTextProperty().unbind(); + } + private void setupValidators() { amountTextField.setValidator(optionalBtcValidator); priceTextField.setValidator(optionalFiatValidator);