diff --git a/src/main/java/io/bitsquare/gui/components/Popups.java b/src/main/java/io/bitsquare/gui/components/Popups.java index 1696087907..81a6574b92 100644 --- a/src/main/java/io/bitsquare/gui/components/Popups.java +++ b/src/main/java/io/bitsquare/gui/components/Popups.java @@ -17,7 +17,6 @@ package io.bitsquare.gui.components; -import io.bitsquare.BitSquare; import io.bitsquare.BitSquareUI; import io.bitsquare.gui.OverlayManager; import io.bitsquare.locale.BSResources; @@ -61,6 +60,7 @@ public class Popups { actions.add(new AbstractAction(BSResources.get("shared.close")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "CLOSE"); Dialog.Actions.CLOSE.handle(actionEvent); overlayManager.removeBlurContent(); } @@ -88,13 +88,16 @@ public class Popups { actions.add(new AbstractAction(BSResources.get("shared.ok")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "OK"); Dialog.Actions.OK.handle(actionEvent); overlayManager.removeBlurContent(); } + }); actions.add(new AbstractAction(BSResources.get("shared.cancel")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "CANCEL"); Dialog.Actions.CANCEL.handle(actionEvent); overlayManager.removeBlurContent(); } @@ -127,6 +130,7 @@ public class Popups { actions.add(new AbstractAction(BSResources.get("shared.close")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "CLOSE"); Dialog.Actions.CLOSE.handle(actionEvent); overlayManager.removeBlurContent(); } @@ -159,6 +163,7 @@ public class Popups { actions.add(new AbstractAction(BSResources.get("shared.close")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "CLOSE"); Dialog.Actions.CLOSE.handle(actionEvent); overlayManager.removeBlurContent(); } @@ -191,6 +196,7 @@ public class Popups { actions.add(new AbstractAction(BSResources.get("shared.close")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "CLOSE"); Dialog.Actions.CLOSE.handle(actionEvent); overlayManager.removeBlurContent(); } @@ -216,14 +222,14 @@ public class Popups { Action response = Popups.openErrorPopup("Error", "Application already running", "This application is already running and cannot be started twice.\n\n " + "Check your system tray to reopen the window of the running application."); - if (response == Dialog.Actions.OK) + if (Popups.isOK(response)) Platform.exit(); } else { Action response = Popups.openExceptionPopup(throwable, "Exception", "A critical error has occurred.", "Please copy the exception details and open a bug report at:\n " + "https://github.com/bitsquare/bitsquare/issues."); - if (response == Dialog.Actions.OK) + if (Popups.isOK(response)) Platform.exit(); } }; @@ -239,4 +245,13 @@ public class Popups { openWarningPopup("Warning", "There is not enough money available", "Please pay in first to your wallet."); } + + public static boolean isOK(Action response) { + return response.getProperties().get("type").equals("OK"); + } + + public static boolean isYes(Action response) { + return response.getProperties().get("type").equals("YES"); + } + } diff --git a/src/main/java/io/bitsquare/gui/main/account/content/fiat/FiatAccountViewCB.java b/src/main/java/io/bitsquare/gui/main/account/content/fiat/FiatAccountViewCB.java index 9f516c5500..1b4760777b 100644 --- a/src/main/java/io/bitsquare/gui/main/account/content/fiat/FiatAccountViewCB.java +++ b/src/main/java/io/bitsquare/gui/main/account/content/fiat/FiatAccountViewCB.java @@ -247,6 +247,7 @@ public class FiatAccountViewCB extends CachedViewCB implements Co actions.add(new AbstractAction(BSResources.get("shared.no")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "NO"); Dialog.Actions.NO.handle(actionEvent); overlayManager.removeBlurContent(); } @@ -255,6 +256,7 @@ public class FiatAccountViewCB extends CachedViewCB implements Co actions.add(new AbstractAction(BSResources.get("shared.yes")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "YES"); Dialog.Actions.YES.handle(actionEvent); overlayManager.removeBlurContent(); } @@ -265,7 +267,7 @@ public class FiatAccountViewCB extends CachedViewCB implements Co ".\n\nDo you want to add it automatically?", actions); - if (response == Dialog.Actions.YES) + if (Popups.isYes(response)) presentationModel.addCountryToAcceptedCountriesList(); } }); diff --git a/src/main/java/io/bitsquare/gui/main/account/content/registration/RegistrationViewCB.java b/src/main/java/io/bitsquare/gui/main/account/content/registration/RegistrationViewCB.java index 040e14e8b6..416951974a 100644 --- a/src/main/java/io/bitsquare/gui/main/account/content/registration/RegistrationViewCB.java +++ b/src/main/java/io/bitsquare/gui/main/account/content/registration/RegistrationViewCB.java @@ -109,6 +109,7 @@ public class RegistrationViewCB extends CachedViewCB implements actions.add(new AbstractAction(BSResources.get("shared.copyTxId")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "COPY"); Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.putString(presentationModel.getTransactionId()); @@ -118,6 +119,7 @@ public class RegistrationViewCB extends CachedViewCB implements actions.add(new AbstractAction(BSResources.get("shared.close")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "CLOSE"); try { if (parent instanceof MultiStepNavigation) ((MultiStepNavigation) parent).nextStep(RegistrationViewCB.this); diff --git a/src/main/java/io/bitsquare/gui/main/funds/withdrawal/WithdrawalViewCB.java b/src/main/java/io/bitsquare/gui/main/funds/withdrawal/WithdrawalViewCB.java index 98a70e06fb..2813dbacaf 100644 --- a/src/main/java/io/bitsquare/gui/main/funds/withdrawal/WithdrawalViewCB.java +++ b/src/main/java/io/bitsquare/gui/main/funds/withdrawal/WithdrawalViewCB.java @@ -53,7 +53,6 @@ import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeIcon; import org.controlsfx.control.action.Action; -import org.controlsfx.dialog.Dialog; import org.jetbrains.annotations.NotNull; @@ -162,11 +161,14 @@ public class WithdrawalViewCB extends CachedViewCB { if (transaction != null) { log.info("onWithdraw onSuccess tx ID:" + transaction.getHashAsString()); } + else { + log.error("onWithdraw transaction is null"); + } } @Override public void onFailure(@NotNull Throwable t) { - log.debug("onWithdraw onFailure"); + log.error("onWithdraw onFailure"); } }; @@ -179,7 +181,7 @@ public class WithdrawalViewCB extends CachedViewCB { "You receive in total: " + formatter.formatCoinWithCode(amount.subtract(FeePolicy.TX_FEE)) + " BTC\n\n" + "Are you sure you withdraw that amount?"); - if (response == Dialog.Actions.OK) { + if (Popups.isOK(response)) { try { walletFacade.sendFunds( withdrawFromTextField.getText(), withdrawToTextField.getText(), diff --git a/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesModel.java b/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesModel.java index bfe9cc9397..1138f0d89c 100644 --- a/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesModel.java +++ b/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesModel.java @@ -251,7 +251,7 @@ class PendingTradesModel extends UIModel { formatter.formatCoinWithCode(amount.subtract(FeePolicy.TX_FEE)) + " BTC\n\n" + "Are you sure you withdraw that amount?"); - if (response == Dialog.Actions.OK) { + if (Popups.isOK(response)) { try { walletFacade.sendFunds( withdrawFromTextField.getText(), withdrawToTextField.getText(), diff --git a/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferViewCB.java b/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferViewCB.java index 809e3460bd..dbc59afb16 100644 --- a/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferViewCB.java +++ b/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferViewCB.java @@ -191,6 +191,7 @@ public class CreateOfferViewCB extends CachedViewCB { actions.add(new AbstractAction(BSResources.get("shared.close")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "CLOSE"); Dialog.Actions.CLOSE.handle(actionEvent); overlayManager.removeBlurContent(); } @@ -353,6 +354,7 @@ public class CreateOfferViewCB extends CachedViewCB { actions.add(new AbstractAction(BSResources.get("shared.copyTxId")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "COPY"); Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.putString(presentationModel.transactionId.get()); @@ -362,6 +364,7 @@ public class CreateOfferViewCB extends CachedViewCB { actions.add(new AbstractAction(BSResources.get("shared.close")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "CLOSE"); try { close(); } catch (Exception e) { diff --git a/src/main/java/io/bitsquare/gui/main/trade/orderbook/OrderBookViewCB.java b/src/main/java/io/bitsquare/gui/main/trade/orderbook/OrderBookViewCB.java index a55e3a62bc..b0afbc9e67 100644 --- a/src/main/java/io/bitsquare/gui/main/trade/orderbook/OrderBookViewCB.java +++ b/src/main/java/io/bitsquare/gui/main/trade/orderbook/OrderBookViewCB.java @@ -243,6 +243,7 @@ public class OrderBookViewCB extends CachedViewCB { actions.add(new AbstractAction(BSResources.get("shared.ok")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "OK"); Dialog.Actions.OK.handle(actionEvent); overlayManager.removeBlurContent(); navigation.setItemsForReturning(navigation.getCurrentItems()); @@ -271,6 +272,7 @@ public class OrderBookViewCB extends CachedViewCB { actions.add(new AbstractAction(BSResources.get("shared.yes")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "YES"); Dialog.Actions.YES.handle(actionEvent); overlayManager.removeBlurContent(); } @@ -278,6 +280,7 @@ public class OrderBookViewCB extends CachedViewCB { actions.add(new AbstractAction(BSResources.get("shared.no")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "NO"); Dialog.Actions.NO.handle(actionEvent); overlayManager.removeBlurContent(); } @@ -288,7 +291,7 @@ public class OrderBookViewCB extends CachedViewCB { restrictionsInfo, actions); - if (response == Dialog.Actions.YES) + if (Popups.isYes(response)) navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ACCOUNT, Navigation.Item.ACCOUNT_SETTINGS, Navigation.Item.RESTRICTIONS); diff --git a/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferViewCB.java b/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferViewCB.java index f5a95730a8..e173bd4372 100644 --- a/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferViewCB.java +++ b/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferViewCB.java @@ -207,6 +207,7 @@ public class TakeOfferViewCB extends CachedViewCB { actions.add(new AbstractAction(BSResources.get("shared.close")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "CLOSE"); Dialog.Actions.CLOSE.handle(actionEvent); overlayManager.removeBlurContent(); } @@ -327,6 +328,7 @@ public class TakeOfferViewCB extends CachedViewCB { actions.add(new AbstractAction(BSResources.get("shared.copyTxId")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "COPY"); Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.putString(presentationModel.transactionId.get()); @@ -336,6 +338,7 @@ public class TakeOfferViewCB extends CachedViewCB { actions.add(new AbstractAction(BSResources.get("shared.close")) { @Override public void handle(ActionEvent actionEvent) { + getProperties().put("type", "CLOSE"); try { close(); navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ORDERS,