make send to many dialog non-modal, menu command brings an existing dialog to foreground

This commit is contained in:
Craig Raw 2023-07-17 10:52:01 +02:00
parent 30a9c1208a
commit 4c408ac7b1

View file

@ -210,6 +210,8 @@ public class AppController implements Initializable {
private Timeline statusTimeline; private Timeline statusTimeline;
private SendToManyDialog sendToManyDialog;
private Tab previouslySelectedTab; private Tab previouslySelectedTab;
private boolean subTabsVisible; private boolean subTabsVisible;
@ -1286,6 +1288,13 @@ public class AppController implements Initializable {
} }
public void sendToMany(ActionEvent event) { public void sendToMany(ActionEvent event) {
if(sendToManyDialog != null) {
Stage stage = (Stage)sendToManyDialog.getDialogPane().getScene().getWindow();
stage.setAlwaysOnTop(true);
stage.setAlwaysOnTop(false);
return;
}
WalletForm selectedWalletForm = getSelectedWalletForm(); WalletForm selectedWalletForm = getSelectedWalletForm();
if(selectedWalletForm != null) { if(selectedWalletForm != null) {
Wallet wallet = selectedWalletForm.getWallet(); Wallet wallet = selectedWalletForm.getWallet();
@ -1294,8 +1303,10 @@ public class AppController implements Initializable {
bitcoinUnit = wallet.getAutoUnit(); bitcoinUnit = wallet.getAutoUnit();
} }
SendToManyDialog sendToManyDialog = new SendToManyDialog(bitcoinUnit); sendToManyDialog = new SendToManyDialog(bitcoinUnit);
sendToManyDialog.initModality(Modality.NONE);
Optional<List<Payment>> optPayments = sendToManyDialog.showAndWait(); Optional<List<Payment>> optPayments = sendToManyDialog.showAndWait();
sendToManyDialog = null;
optPayments.ifPresent(payments -> { optPayments.ifPresent(payments -> {
if(!payments.isEmpty()) { if(!payments.isEmpty()) {
EventManager.get().post(new SendActionEvent(wallet, new ArrayList<>(wallet.getSpendableUtxos().keySet()))); EventManager.get().post(new SendActionEvent(wallet, new ArrayList<>(wallet.getSpendableUtxos().keySet())));