From 008ae0ef527470d14648859b299b439c938ab43c Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Mon, 27 Oct 2014 01:32:00 +0100 Subject: [PATCH] Fix bug with open trades row selection (#238) --- .../main/portfolio/pending/PendingTradesModel.java | 14 ++++---------- .../main/portfolio/pending/PendingTradesPM.java | 4 ---- .../portfolio/pending/PendingTradesViewCB.java | 5 ++--- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesModel.java b/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesModel.java index 7ee87e4337..37975e2fdd 100644 --- a/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesModel.java +++ b/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesModel.java @@ -188,10 +188,6 @@ class PendingTradesModel extends UIModel { trade.faultProperty().addListener(faultChangeListener); fault.set(trade.faultProperty().get()); - - if (closedTrade != null) { - list.removeIf(e -> e.getTrade().getId().equals(closedTrade.getId())); - } } else { txId.set(null); @@ -207,18 +203,16 @@ class PendingTradesModel extends UIModel { tradeManager.fiatPaymentReceived(getTrade().getId()); } - void removePendingTrade() { - if (closedTrade != null) { - list.removeIf(e -> e.getTrade().getId().equals(closedTrade.getId())); - } - } - void withdraw(String toAddress) { FutureCallback callback = new FutureCallback() { @Override public void onSuccess(@javax.annotation.Nullable Transaction transaction) { if (transaction != null) { log.info("onWithdraw onSuccess tx ID:" + transaction.getHashAsString()); + + if (closedTrade != null) { + list.removeIf(e -> e.getTrade().getId().equals(closedTrade.getId())); + } } } diff --git a/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesPM.java b/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesPM.java index bf7e42265f..32d8ff9a8c 100644 --- a/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesPM.java +++ b/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesPM.java @@ -133,10 +133,6 @@ public class PendingTradesPM extends PresentationModel { model.fiatPaymentReceived(); } - void removePendingTrade() { - model.removePendingTrade(); - } - void withdraw(String withdrawToAddress) { // TODO address validation if (withdrawToAddress != null && withdrawToAddress.length() > 0) diff --git a/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesViewCB.java b/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesViewCB.java index 7b144fb9e0..a7a904f9d6 100644 --- a/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesViewCB.java +++ b/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesViewCB.java @@ -107,12 +107,12 @@ public class PendingTradesViewCB extends CachedViewCB { setVolumeColumnCellFactory(); setDateColumnCellFactory(); - scrollPane.vvalueProperty().addListener((ov, oldValue, newValue) -> { + /* scrollPane.vvalueProperty().addListener((ov, oldValue, newValue) -> { log.debug("#### vvalueProperty " + newValue); }); scrollPane.viewportBoundsProperty().addListener((ov, oldValue, newValue) -> { log.debug("#### viewportBoundsProperty " + newValue); - }); + });*/ table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); table.setPlaceholder(new Label("No pending trades available")); @@ -206,7 +206,6 @@ public class PendingTradesViewCB extends CachedViewCB { @FXML public void onWithdraw() { setSummaryControlsVisible(false); - presentationModel.removePendingTrade(); presentationModel.withdraw(withdrawAddressTextField.getText()); Platform.runLater(() -> navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PORTFOLIO,