Add cancel button to SelectDepositTxPopup

This commit is contained in:
Manfred Karrer 2016-01-18 23:08:38 +01:00
parent 2e363a36b6
commit 276e02e102
2 changed files with 9 additions and 5 deletions

View file

@ -221,9 +221,12 @@ public class PendingTradesDataModel extends ActivatableDataModel {
if (candidates.size() == 1) if (candidates.size() == 1)
doOpenDispute(isSupportTicket, candidates.get(0)); doOpenDispute(isSupportTicket, candidates.get(0));
else if (candidates.size() > 1) else if (candidates.size() > 1)
new SelectDepositTxPopup().transactions(candidates).onSelect(transaction -> { new SelectDepositTxPopup().transactions(candidates)
.onSelect(transaction -> {
doOpenDispute(isSupportTicket, transaction); doOpenDispute(isSupportTicket, transaction);
}).show(); })
.closeButtonText("Cancel")
.show();
else else
log.error("Trade.depositTx is null and we did not find any MultiSig transaction."); log.error("Trade.depositTx is null and we did not find any MultiSig transaction.");
} }

View file

@ -19,7 +19,6 @@ package io.bitsquare.gui.popups;
import io.bitsquare.common.util.Tuple2; import io.bitsquare.common.util.Tuple2;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox; import javafx.scene.control.ComboBox;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.util.StringConverter; import javafx.util.StringConverter;
@ -37,7 +36,6 @@ import static io.bitsquare.gui.util.FormBuilder.addMultilineLabel;
public class SelectDepositTxPopup extends Popup { public class SelectDepositTxPopup extends Popup {
private static final Logger log = LoggerFactory.getLogger(SelectDepositTxPopup.class); private static final Logger log = LoggerFactory.getLogger(SelectDepositTxPopup.class);
private Button emptyWalletButton;
private ComboBox<Transaction> transactionsComboBox; private ComboBox<Transaction> transactionsComboBox;
private List<Transaction> transaction; private List<Transaction> transaction;
private Optional<Consumer<Transaction>> selectHandlerOptional; private Optional<Consumer<Transaction>> selectHandlerOptional;
@ -59,6 +57,7 @@ public class SelectDepositTxPopup extends Popup {
createGridPane(); createGridPane();
addHeadLine(); addHeadLine();
addContent(); addContent();
addCloseButton();
createPopup(); createPopup();
return this; return this;
} }
@ -86,6 +85,7 @@ public class SelectDepositTxPopup extends Popup {
Tuple2<Label, ComboBox> tuple = addLabelComboBox(gridPane, ++rowIndex); Tuple2<Label, ComboBox> tuple = addLabelComboBox(gridPane, ++rowIndex);
transactionsComboBox = tuple.second; transactionsComboBox = tuple.second;
transactionsComboBox.setPromptText("Select deposit transaction");
transactionsComboBox.setConverter(new StringConverter<Transaction>() { transactionsComboBox.setConverter(new StringConverter<Transaction>() {
@Override @Override
public String toString(Transaction transaction) { public String toString(Transaction transaction) {
@ -100,6 +100,7 @@ public class SelectDepositTxPopup extends Popup {
transactionsComboBox.setItems(FXCollections.observableArrayList(transaction)); transactionsComboBox.setItems(FXCollections.observableArrayList(transaction));
transactionsComboBox.setOnAction(event -> { transactionsComboBox.setOnAction(event -> {
selectHandlerOptional.get().accept(transactionsComboBox.getSelectionModel().getSelectedItem()); selectHandlerOptional.get().accept(transactionsComboBox.getSelectionModel().getSelectedItem());
hide();
}); });
} }