mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-03-14 18:06:34 -04:00
Fix problem with popup response not recognized
This commit is contained in:
parent
98b6f72f90
commit
3df091c406
@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -247,6 +247,7 @@ public class FiatAccountViewCB extends CachedViewCB<FiatAccountPm> 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<FiatAccountPm> 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<FiatAccountPm> implements Co
|
||||
".\n\nDo you want to add it automatically?",
|
||||
actions);
|
||||
|
||||
if (response == Dialog.Actions.YES)
|
||||
if (Popups.isYes(response))
|
||||
presentationModel.addCountryToAcceptedCountriesList();
|
||||
}
|
||||
});
|
||||
|
@ -109,6 +109,7 @@ public class RegistrationViewCB extends CachedViewCB<RegistrationPM> 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<RegistrationPM> 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);
|
||||
|
@ -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(),
|
||||
|
@ -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(),
|
||||
|
@ -191,6 +191,7 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
|
||||
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<CreateOfferPM> {
|
||||
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<CreateOfferPM> {
|
||||
actions.add(new AbstractAction(BSResources.get("shared.close")) {
|
||||
@Override
|
||||
public void handle(ActionEvent actionEvent) {
|
||||
getProperties().put("type", "CLOSE");
|
||||
try {
|
||||
close();
|
||||
} catch (Exception e) {
|
||||
|
@ -243,6 +243,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
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<OrderBookPM> {
|
||||
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<OrderBookPM> {
|
||||
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<OrderBookPM> {
|
||||
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);
|
||||
|
@ -207,6 +207,7 @@ public class TakeOfferViewCB extends CachedViewCB<TakeOfferPM> {
|
||||
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<TakeOfferPM> {
|
||||
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<TakeOfferPM> {
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user