Fix bug with open trades row selection (#238)

This commit is contained in:
Manfred Karrer 2014-10-27 01:32:00 +01:00
parent 52da080f22
commit 008ae0ef52
3 changed files with 6 additions and 17 deletions

View file

@ -188,10 +188,6 @@ class PendingTradesModel extends UIModel {
trade.faultProperty().addListener(faultChangeListener); trade.faultProperty().addListener(faultChangeListener);
fault.set(trade.faultProperty().get()); fault.set(trade.faultProperty().get());
if (closedTrade != null) {
list.removeIf(e -> e.getTrade().getId().equals(closedTrade.getId()));
}
} }
else { else {
txId.set(null); txId.set(null);
@ -207,18 +203,16 @@ class PendingTradesModel extends UIModel {
tradeManager.fiatPaymentReceived(getTrade().getId()); tradeManager.fiatPaymentReceived(getTrade().getId());
} }
void removePendingTrade() {
if (closedTrade != null) {
list.removeIf(e -> e.getTrade().getId().equals(closedTrade.getId()));
}
}
void withdraw(String toAddress) { void withdraw(String toAddress) {
FutureCallback<Transaction> callback = new FutureCallback<Transaction>() { FutureCallback<Transaction> callback = new FutureCallback<Transaction>() {
@Override @Override
public void onSuccess(@javax.annotation.Nullable Transaction transaction) { public void onSuccess(@javax.annotation.Nullable Transaction transaction) {
if (transaction != null) { if (transaction != null) {
log.info("onWithdraw onSuccess tx ID:" + transaction.getHashAsString()); log.info("onWithdraw onSuccess tx ID:" + transaction.getHashAsString());
if (closedTrade != null) {
list.removeIf(e -> e.getTrade().getId().equals(closedTrade.getId()));
}
} }
} }

View file

@ -133,10 +133,6 @@ public class PendingTradesPM extends PresentationModel<PendingTradesModel> {
model.fiatPaymentReceived(); model.fiatPaymentReceived();
} }
void removePendingTrade() {
model.removePendingTrade();
}
void withdraw(String withdrawToAddress) { void withdraw(String withdrawToAddress) {
// TODO address validation // TODO address validation
if (withdrawToAddress != null && withdrawToAddress.length() > 0) if (withdrawToAddress != null && withdrawToAddress.length() > 0)

View file

@ -107,12 +107,12 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
setVolumeColumnCellFactory(); setVolumeColumnCellFactory();
setDateColumnCellFactory(); setDateColumnCellFactory();
scrollPane.vvalueProperty().addListener((ov, oldValue, newValue) -> { /* scrollPane.vvalueProperty().addListener((ov, oldValue, newValue) -> {
log.debug("#### vvalueProperty " + newValue); log.debug("#### vvalueProperty " + newValue);
}); });
scrollPane.viewportBoundsProperty().addListener((ov, oldValue, newValue) -> { scrollPane.viewportBoundsProperty().addListener((ov, oldValue, newValue) -> {
log.debug("#### viewportBoundsProperty " + newValue); log.debug("#### viewportBoundsProperty " + newValue);
}); });*/
table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
table.setPlaceholder(new Label("No pending trades available")); table.setPlaceholder(new Label("No pending trades available"));
@ -206,7 +206,6 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
@FXML @FXML
public void onWithdraw() { public void onWithdraw() {
setSummaryControlsVisible(false); setSummaryControlsVisible(false);
presentationModel.removePendingTrade();
presentationModel.withdraw(withdrawAddressTextField.getText()); presentationModel.withdraw(withdrawAddressTextField.getText());
Platform.runLater(() -> Platform.runLater(() ->
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PORTFOLIO, navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PORTFOLIO,