diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesView.java b/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesView.java index b95aad88..35fe31dc 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesView.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesView.java @@ -27,6 +27,7 @@ import haveno.core.offer.Offer; import haveno.core.trade.Contract; import haveno.core.trade.HavenoUtils; import haveno.core.trade.Trade; +import haveno.core.user.User; import haveno.core.xmr.wallet.XmrWalletService; import haveno.desktop.common.view.ActivatableViewAndModel; import haveno.desktop.common.view.FxmlView; @@ -98,15 +99,18 @@ public class FailedTradesView extends ActivatableViewAndModel filterTextFieldListener; private Scene scene; private XmrWalletService xmrWalletService; + private User user; private ContextMenu contextMenu; @Inject public FailedTradesView(FailedTradesViewModel model, TradeDetailsWindow tradeDetailsWindow, - XmrWalletService xmrWalletService) { + XmrWalletService xmrWalletService, + User user) { super(model); this.tradeDetailsWindow = tradeDetailsWindow; this.xmrWalletService = xmrWalletService; + this.user = user; } @Override @@ -190,9 +194,33 @@ public class FailedTradesView extends ActivatableViewAndModel { + Trade selectedFailedTrade = tableView.getSelectionModel().getSelectedItem().getTrade(); + handleContextMenu("portfolio.failed.penalty.msg", + Res.get(selectedFailedTrade.getMaker() == selectedFailedTrade.getBuyer() ? "shared.buyer" : "shared.seller"), + Res.get("shared.maker"), + selectedFailedTrade.getMaker().getSecurityDeposit(), + selectedFailedTrade.getMaker().getReserveTxHash(), + selectedFailedTrade.getMaker().getReserveTxHex()); + }); + + item2.setOnAction(event -> { + Trade selectedFailedTrade = tableView.getSelectionModel().getSelectedItem().getTrade(); + handleContextMenu("portfolio.failed.penalty.msg", + Res.get(selectedFailedTrade.getTaker() == selectedFailedTrade.getBuyer() ? "shared.buyer" : "shared.seller"), + Res.get("shared.taker"), + selectedFailedTrade.getTaker().getSecurityDeposit(), + selectedFailedTrade.getTaker().getReserveTxHash(), + selectedFailedTrade.getTaker().getReserveTxHex()); + }); + + contextMenu.getItems().addAll(item1, item2); + } tableView.setRowFactory(tv -> { TableRow row = new TableRow<>(); @@ -202,26 +230,6 @@ public class FailedTradesView extends ActivatableViewAndModel { - Trade selectedFailedTrade = tableView.getSelectionModel().getSelectedItem().getTrade(); - handleContextMenu("portfolio.failed.penalty.msg", - Res.get(selectedFailedTrade.getMaker() == selectedFailedTrade.getBuyer() ? "shared.buyer" : "shared.seller"), - Res.get("shared.maker"), - selectedFailedTrade.getMaker().getSecurityDeposit(), - selectedFailedTrade.getMaker().getReserveTxHash(), - selectedFailedTrade.getMaker().getReserveTxHex()); - }); - - item2.setOnAction(event -> { - Trade selectedFailedTrade = tableView.getSelectionModel().getSelectedItem().getTrade(); - handleContextMenu("portfolio.failed.penalty.msg", - Res.get(selectedFailedTrade.getTaker() == selectedFailedTrade.getBuyer() ? "shared.buyer" : "shared.seller"), - Res.get("shared.taker"), - selectedFailedTrade.getTaker().getSecurityDeposit(), - selectedFailedTrade.getTaker().getReserveTxHash(), - selectedFailedTrade.getTaker().getReserveTxHex()); - }); - numItems.setText(Res.get("shared.numItemsLabel", sortedList.size())); exportButton.setOnAction(event -> { ObservableList> tableColumns = tableView.getColumns();