From 8324c888e448bcf18282ad1790294f88af6322ab Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Wed, 2 Mar 2016 23:28:25 +0100 Subject: [PATCH] Reorganized popups --- .../java/io/bitsquare/user/Preferences.java | 37 ++---- .../java/io/bitsquare/app/BitsquareApp.java | 10 +- .../io/bitsquare/app/BitsquareAppModule.java | 4 +- .../gui/components/AddressTextField.java | 2 +- .../gui/components/TxIdTextField.java | 2 +- .../java/io/bitsquare/gui/main/MainView.java | 5 +- .../io/bitsquare/gui/main/MainViewModel.java | 42 +++--- .../ArbitratorRegistrationView.java | 12 +- .../altcoinaccounts/AltCoinAccountsView.java | 2 +- .../ArbitratorSelectionView.java | 2 +- .../account/content/backup/BackupView.java | 2 +- .../fiataccounts/FiatAccountsView.java | 2 +- .../content/password/PasswordView.java | 2 +- .../content/seedwords/SeedWordsView.java | 12 +- .../arbitrator/ArbitratorDisputeView.java | 12 +- .../disputes/trader/TraderDisputeView.java | 30 ++--- .../bitsquare/gui/main/funds/FundsView.java | 4 +- .../gui/main/funds/reserved/ReservedView.java | 20 +-- .../funds/transactions/TransactionsView.java | 22 +-- .../main/funds/withdrawal/WithdrawalView.java | 30 ++--- .../java/io/bitsquare/gui/main/help/Help.java | 2 +- .../gui/main/intructions/Instruction.java | 15 --- .../main/intructions/InstructionCenter.java | 17 --- .../bitsquare/gui/main/offer/OfferView.java | 2 +- .../createoffer/CreateOfferDataModel.java | 30 +++-- .../offer/createoffer/CreateOfferView.java | 87 ++++++------ .../main/offer/offerbook/OfferBookView.java | 12 +- .../offer/takeoffer/TakeOfferDataModel.java | 29 ++-- .../main/offer/takeoffer/TakeOfferView.java | 90 ++++++------- .../Popup.java => overlays/Overlay.java} | 125 +++++++++--------- .../notifications/Notification.java | 39 +++--- .../notifications/NotificationCenter.java | 2 +- .../notifications/NotificationManager.java | 40 ++++++ .../gui/main/overlays/popups/Popup.java | 40 ++++++ .../{ => overlays}/popups/PopupManager.java | 12 +- .../windows/ContractWindow.java} | 18 +-- .../windows/DisplayAlertMessageWindow.java} | 24 ++-- .../windows/DisputeSummaryWindow.java} | 21 ++- .../windows/EmptyWalletWindow.java} | 24 ++-- .../windows/EnterPrivKeyWindow.java} | 19 +-- .../windows/OfferDetailsWindow.java} | 46 +++---- .../windows/OpenEmergencyTicketWindow.java} | 19 +-- .../windows/SelectDepositTxWindow.java} | 15 ++- .../windows/SendAlertMessageWindow.java} | 23 ++-- .../windows/TacWindow.java} | 16 ++- .../windows/TradeDetailsWindow.java} | 17 +-- .../windows/WalletPasswordWindow.java} | 19 ++- .../closedtrades/ClosedTradesView.java | 18 +-- .../failedtrades/FailedTradesView.java | 10 +- .../portfolio/openoffer/OpenOffersView.java | 12 +- .../pendingtrades/PendingTradesDataModel.java | 16 +-- .../pendingtrades/PendingTradesView.java | 14 +- .../pendingtrades/steps/TradeStepView.java | 2 +- .../steps/buyer/BuyerStep2View.java | 15 ++- .../steps/buyer/BuyerStep5View.java | 54 ++++---- .../steps/seller/SellerStep3View.java | 16 ++- .../settings/network/NetworkSettingsView.java | 2 +- .../settings/preferences/PreferencesView.java | 11 +- 58 files changed, 610 insertions(+), 617 deletions(-) delete mode 100644 gui/src/main/java/io/bitsquare/gui/main/intructions/Instruction.java delete mode 100644 gui/src/main/java/io/bitsquare/gui/main/intructions/InstructionCenter.java rename gui/src/main/java/io/bitsquare/gui/main/{popups/Popup.java => overlays/Overlay.java} (87%) rename gui/src/main/java/io/bitsquare/gui/main/{ => overlays}/notifications/Notification.java (92%) rename gui/src/main/java/io/bitsquare/gui/main/{ => overlays}/notifications/NotificationCenter.java (99%) create mode 100644 gui/src/main/java/io/bitsquare/gui/main/overlays/notifications/NotificationManager.java create mode 100644 gui/src/main/java/io/bitsquare/gui/main/overlays/popups/Popup.java rename gui/src/main/java/io/bitsquare/gui/main/{ => overlays}/popups/PopupManager.java (81%) rename gui/src/main/java/io/bitsquare/gui/main/{popups/ContractPopup.java => overlays/windows/ContractWindow.java} (95%) rename gui/src/main/java/io/bitsquare/gui/main/{popups/DisplayAlertMessagePopup.java => overlays/windows/DisplayAlertMessageWindow.java} (84%) rename gui/src/main/java/io/bitsquare/gui/main/{popups/DisputeSummaryPopup.java => overlays/windows/DisputeSummaryWindow.java} (97%) rename gui/src/main/java/io/bitsquare/gui/main/{popups/EmptyWalletPopup.java => overlays/windows/EmptyWalletWindow.java} (91%) rename gui/src/main/java/io/bitsquare/gui/main/{popups/EnterPrivKeyPopup.java => overlays/windows/EnterPrivKeyWindow.java} (91%) rename gui/src/main/java/io/bitsquare/gui/main/{popups/OfferDetailsPopup.java => overlays/windows/OfferDetailsWindow.java} (88%) rename gui/src/main/java/io/bitsquare/gui/main/{popups/OpenEmergencyTicketPopup.java => overlays/windows/OpenEmergencyTicketWindow.java} (86%) rename gui/src/main/java/io/bitsquare/gui/main/{popups/SelectDepositTxPopup.java => overlays/windows/SelectDepositTxWindow.java} (90%) rename gui/src/main/java/io/bitsquare/gui/main/{popups/SendAlertMessagePopup.java => overlays/windows/SendAlertMessageWindow.java} (89%) rename gui/src/main/java/io/bitsquare/gui/main/{popups/TacPopup.java => overlays/windows/TacWindow.java} (90%) rename gui/src/main/java/io/bitsquare/gui/main/{popups/TradeDetailsPopup.java => overlays/windows/TradeDetailsWindow.java} (95%) rename gui/src/main/java/io/bitsquare/gui/main/{popups/WalletPasswordPopup.java => overlays/windows/WalletPasswordWindow.java} (92%) diff --git a/core/src/main/java/io/bitsquare/user/Preferences.java b/core/src/main/java/io/bitsquare/user/Preferences.java index ced3c706a7..59aba19bfc 100644 --- a/core/src/main/java/io/bitsquare/user/Preferences.java +++ b/core/src/main/java/io/bitsquare/user/Preferences.java @@ -98,7 +98,7 @@ public final class Preferences implements Persistable { private BlockChainExplorer blockChainExplorerTestNet; private String backupDirectory; private boolean autoSelectArbitrators = true; - private final Map showAgainMap; + private final Map dontShowAgainMap; private boolean tacAccepted; private boolean useTorForBitcoinJ = true; private Locale preferredLocale; @@ -146,7 +146,7 @@ public final class Preferences implements Persistable { backupDirectory = persisted.getBackupDirectory(); autoSelectArbitrators = persisted.getAutoSelectArbitrators(); - showAgainMap = persisted.getShowAgainMap(); + dontShowAgainMap = persisted.getDontShowAgainMap(); tacAccepted = persisted.getTacAccepted(); preferredLocale = persisted.getPreferredLocale(); @@ -170,7 +170,7 @@ public final class Preferences implements Persistable { setBlockChainExplorerTestNet(blockChainExplorersTestNet.get(0)); setBlockChainExplorerMainNet(blockChainExplorersMainNet.get(0)); - showAgainMap = new HashMap<>(); + dontShowAgainMap = new HashMap<>(); preferredLocale = getDefaultLocale(); preferredTradeCurrency = getDefaultTradeCurrency(); @@ -210,23 +210,14 @@ public final class Preferences implements Persistable { tradeCurrenciesAsObservable.addAll(cryptoCurrencies); } - public void dontShowAgain(String key) { - showAgainMap.put(key, false); - storage.queueUpForSave(2000); + public void dontShowAgain(String key, boolean dontShowAgain) { + dontShowAgainMap.put(key, dontShowAgain); + storage.queueUpForSave(1000); } public void resetDontShowAgainForType() { - showAgainMap.clear(); - storage.queueUpForSave(2000); - } - - public void removeDontShowAgainForType(String type) { - showAgainMap.keySet().stream().forEach(key -> { - if (key.startsWith(type + "_")) - showAgainMap.put(key, true); - }); - - storage.queueUpForSave(2000); + dontShowAgainMap.clear(); + storage.queueUpForSave(1000); } private void updateTradeCurrencies(ListChangeListener.Change change) { @@ -443,18 +434,12 @@ public final class Preferences implements Persistable { return autoSelectArbitrators; } - public Map getShowAgainMap() { - return showAgainMap; + public Map getDontShowAgainMap() { + return dontShowAgainMap; } public boolean showAgain(String key) { - // if we add new and those are not in our stored map we display by default the new popup - if (!showAgainMap.containsKey(key)) { - showAgainMap.put(key, true); - storage.queueUpForSave(2000); - } - - return showAgainMap.get(key); + return !dontShowAgainMap.containsKey(key) || !dontShowAgainMap.get(key); } public boolean getTacAccepted() { diff --git a/gui/src/main/java/io/bitsquare/app/BitsquareApp.java b/gui/src/main/java/io/bitsquare/app/BitsquareApp.java index f15e5e409b..6267476110 100644 --- a/gui/src/main/java/io/bitsquare/app/BitsquareApp.java +++ b/gui/src/main/java/io/bitsquare/app/BitsquareApp.java @@ -35,9 +35,9 @@ import io.bitsquare.gui.common.view.guice.InjectorViewFactory; import io.bitsquare.gui.main.MainView; import io.bitsquare.gui.main.MainViewModel; import io.bitsquare.gui.main.debug.DebugView; -import io.bitsquare.gui.main.popups.EmptyWalletPopup; -import io.bitsquare.gui.main.popups.Popup; -import io.bitsquare.gui.main.popups.SendAlertMessagePopup; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.EmptyWalletWindow; +import io.bitsquare.gui.main.overlays.windows.SendAlertMessageWindow; import io.bitsquare.gui.util.ImageUtil; import io.bitsquare.p2p.P2PService; import io.bitsquare.storage.Storage; @@ -219,14 +219,14 @@ public class BitsquareApp extends Application { private void showSendAlertMessagePopup() { AlertManager alertManager = injector.getInstance(AlertManager.class); - new SendAlertMessagePopup() + new SendAlertMessageWindow() .onAddAlertMessage((alert, privKeyString) -> alertManager.addAlertMessageIfKeyIsValid(alert, privKeyString)) .onRemoveAlertMessage(privKeyString -> alertManager.removeAlertMessageIfKeyIsValid(privKeyString)) .show(); } private void showEmptyWalletPopup() { - injector.getInstance(EmptyWalletPopup.class).show(); + injector.getInstance(EmptyWalletWindow.class).show(); } private void showErrorPopup(Throwable throwable, boolean doShutDown) { diff --git a/gui/src/main/java/io/bitsquare/app/BitsquareAppModule.java b/gui/src/main/java/io/bitsquare/app/BitsquareAppModule.java index 36ee7e4559..65309e2d0e 100644 --- a/gui/src/main/java/io/bitsquare/app/BitsquareAppModule.java +++ b/gui/src/main/java/io/bitsquare/app/BitsquareAppModule.java @@ -27,8 +27,7 @@ import io.bitsquare.common.crypto.KeyStorage; import io.bitsquare.crypto.EncryptionServiceModule; import io.bitsquare.gui.GuiModule; import io.bitsquare.gui.common.view.CachingViewLoader; -import io.bitsquare.gui.main.intructions.InstructionCenter; -import io.bitsquare.gui.main.notifications.NotificationCenter; +import io.bitsquare.gui.main.overlays.notifications.NotificationCenter; import io.bitsquare.p2p.P2PModule; import io.bitsquare.storage.Storage; import io.bitsquare.trade.TradeModule; @@ -62,7 +61,6 @@ class BitsquareAppModule extends AppModule { bind(User.class).in(Singleton.class); bind(Preferences.class).in(Singleton.class); bind(NotificationCenter.class).in(Singleton.class); - bind(InstructionCenter.class).in(Singleton.class); bind(Clock.class).in(Singleton.class); File storageDir = new File(env.getRequiredProperty(Storage.DIR_KEY)); diff --git a/gui/src/main/java/io/bitsquare/gui/components/AddressTextField.java b/gui/src/main/java/io/bitsquare/gui/components/AddressTextField.java index fc878e070c..25656ad9f1 100644 --- a/gui/src/main/java/io/bitsquare/gui/components/AddressTextField.java +++ b/gui/src/main/java/io/bitsquare/gui/components/AddressTextField.java @@ -21,7 +21,7 @@ import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeIcon; import io.bitsquare.common.util.Utilities; import io.bitsquare.gui.main.MainView; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; diff --git a/gui/src/main/java/io/bitsquare/gui/components/TxIdTextField.java b/gui/src/main/java/io/bitsquare/gui/components/TxIdTextField.java index 5a7dbc9770..458262d75d 100644 --- a/gui/src/main/java/io/bitsquare/gui/components/TxIdTextField.java +++ b/gui/src/main/java/io/bitsquare/gui/components/TxIdTextField.java @@ -23,7 +23,7 @@ import io.bitsquare.btc.WalletService; import io.bitsquare.btc.listeners.TxConfidenceListener; import io.bitsquare.common.util.Utilities; import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.user.Preferences; import javafx.scene.control.Label; import javafx.scene.control.TextField; diff --git a/gui/src/main/java/io/bitsquare/gui/main/MainView.java b/gui/src/main/java/io/bitsquare/gui/main/MainView.java index 1da315307c..f9236ca6bd 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/MainView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/MainView.java @@ -31,7 +31,8 @@ import io.bitsquare.gui.main.funds.FundsView; import io.bitsquare.gui.main.markets.MarketView; import io.bitsquare.gui.main.offer.BuyOfferView; import io.bitsquare.gui.main.offer.SellOfferView; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.Overlay; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.gui.main.portfolio.PortfolioView; import io.bitsquare.gui.main.settings.SettingsView; import io.bitsquare.gui.util.Transitions; @@ -90,7 +91,7 @@ public class MainView extends InitializableView { private Label btcSplashInfo; private List persistedFilesCorrupted; private BorderPane baseApplicationContainer; - private Popup p2PNetworkWarnMsgPopup, btcNetworkWarnMsgPopup; + private Overlay p2PNetworkWarnMsgPopup, btcNetworkWarnMsgPopup; private static StackPane rootContainer; @Inject diff --git a/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java b/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java index 07353da7e1..79479092e2 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java +++ b/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java @@ -40,11 +40,11 @@ import io.bitsquare.gui.common.model.ViewModel; import io.bitsquare.gui.components.BalanceTextField; import io.bitsquare.gui.components.BalanceWithConfirmationTextField; import io.bitsquare.gui.components.TxIdTextField; -import io.bitsquare.gui.main.notifications.NotificationCenter; -import io.bitsquare.gui.main.popups.DisplayAlertMessagePopup; -import io.bitsquare.gui.main.popups.Popup; -import io.bitsquare.gui.main.popups.TacPopup; -import io.bitsquare.gui.main.popups.WalletPasswordPopup; +import io.bitsquare.gui.main.overlays.notifications.NotificationCenter; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.DisplayAlertMessageWindow; +import io.bitsquare.gui.main.overlays.windows.TacWindow; +import io.bitsquare.gui.main.overlays.windows.WalletPasswordWindow; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.locale.CountryUtil; import io.bitsquare.locale.CurrencyUtil; @@ -89,9 +89,9 @@ public class MainViewModel implements ViewModel { private final DisputeManager disputeManager; private final Preferences preferences; private final AlertManager alertManager; - private final WalletPasswordPopup walletPasswordPopup; + private final WalletPasswordWindow walletPasswordWindow; private final NotificationCenter notificationCenter; - private final TacPopup tacPopup; + private final TacWindow tacWindow; private Clock clock; private final Navigation navigation; private final BSFormatter formatter; @@ -149,8 +149,8 @@ public class MainViewModel implements ViewModel { PriceFeed priceFeed, ArbitratorManager arbitratorManager, P2PService p2PService, TradeManager tradeManager, OpenOfferManager openOfferManager, DisputeManager disputeManager, Preferences preferences, - User user, AlertManager alertManager, WalletPasswordPopup walletPasswordPopup, - NotificationCenter notificationCenter, TacPopup tacPopup, Clock clock, + User user, AlertManager alertManager, WalletPasswordWindow walletPasswordWindow, + NotificationCenter notificationCenter, TacWindow tacWindow, Clock clock, Navigation navigation, BSFormatter formatter) { this.priceFeed = priceFeed; this.user = user; @@ -163,9 +163,9 @@ public class MainViewModel implements ViewModel { this.disputeManager = disputeManager; this.preferences = preferences; this.alertManager = alertManager; - this.walletPasswordPopup = walletPasswordPopup; + this.walletPasswordWindow = walletPasswordWindow; this.notificationCenter = notificationCenter; - this.tacPopup = tacPopup; + this.tacWindow = tacWindow; this.clock = clock; this.navigation = navigation; this.formatter = formatter; @@ -426,7 +426,7 @@ public class MainViewModel implements ViewModel { (openOfferManager.getOpenOffers().size() > 0 || tradeManager.getTrades().size() > 0 || disputeManager.getDisputesAsObservableList().size() > 0)) { - walletPasswordPopup.onAesKey(aesKey -> tradeWalletService.setAesKey(aesKey)).show(); + walletPasswordWindow.onAesKey(aesKey -> tradeWalletService.setAesKey(aesKey)).show(); } walletService.addBalanceListener(new BalanceListener() { @Override @@ -447,7 +447,7 @@ public class MainViewModel implements ViewModel { setupDevDummyPaymentAccount(); setupMarketPriceFeed(); - tacPopup.showIfNeeded(); + tacWindow.showIfNeeded(); showAppScreen.set(true); } @@ -512,15 +512,15 @@ public class MainViewModel implements ViewModel { else if (trade.getCheckPaymentTimeAsBlockHeight() > 0 && bestChainHeight >= trade.getCheckPaymentTimeAsBlockHeight()) trade.setTradePeriodState(Trade.TradePeriodState.HALF_REACHED); - String id; + String key; String limitDate = formatter.addBlocksToNowDateFormatted(trade.getOpenDisputeTimeAsBlockHeight() - tradeWalletService.getBestChainHeight()); switch (trade.getTradePeriodState()) { case NORMAL: break; case HALF_REACHED: - id = "displayHalfTradePeriodOver" + trade.getId(); - if (preferences.showAgain(id) && !BitsquareApp.DEV_MODE) { - preferences.dontShowAgain(id); + key = "displayHalfTradePeriodOver" + trade.getId(); + if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) { + preferences.dontShowAgain(key, true); new Popup().warning("Your trade with ID " + trade.getShortId() + " has reached the half of the max. allowed trading period and " + "is still not completed.\n\n" + @@ -530,9 +530,9 @@ public class MainViewModel implements ViewModel { } break; case TRADE_PERIOD_OVER: - id = "displayTradePeriodOver" + trade.getId(); - if (preferences.showAgain(id) && !BitsquareApp.DEV_MODE) { - preferences.dontShowAgain(id); + key = "displayTradePeriodOver" + trade.getId(); + if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) { + preferences.dontShowAgain(key, true); new Popup().warning("Your trade with ID " + trade.getShortId() + " has reached the max. allowed trading period and is " + "not completed.\n\n" + @@ -624,7 +624,7 @@ public class MainViewModel implements ViewModel { user.setDisplayedAlert(alert); if (alert != null && !alreadyDisplayed) { - new DisplayAlertMessagePopup().alertMessage(alert).show(); + new DisplayAlertMessageWindow().alertMessage(alert).show(); } } diff --git a/gui/src/main/java/io/bitsquare/gui/main/account/arbitratorregistration/ArbitratorRegistrationView.java b/gui/src/main/java/io/bitsquare/gui/main/account/arbitratorregistration/ArbitratorRegistrationView.java index f781d27944..a753a38883 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/account/arbitratorregistration/ArbitratorRegistrationView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/account/arbitratorregistration/ArbitratorRegistrationView.java @@ -24,8 +24,8 @@ import io.bitsquare.common.UserThread; import io.bitsquare.common.util.Tuple2; import io.bitsquare.gui.common.view.ActivatableViewAndModel; import io.bitsquare.gui.common.view.FxmlView; -import io.bitsquare.gui.main.popups.EnterPrivKeyPopup; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.EnterPrivKeyWindow; import io.bitsquare.gui.util.FormBuilder; import io.bitsquare.gui.util.ImageUtil; import io.bitsquare.gui.util.Layout; @@ -57,7 +57,7 @@ public class ArbitratorRegistrationView extends ActivatableViewAndModel arbitratorChangeListener; - private EnterPrivKeyPopup enterPrivKeyPopup; + private EnterPrivKeyWindow enterPrivKeyWindow; private ListChangeListener listChangeListener; @@ -94,9 +94,9 @@ public class ArbitratorRegistrationView extends ActivatableViewAndModel enterPrivKeyPopup = null) + if (model.registrationPubKeyAsHex.get() == null && enterPrivKeyWindow == null) { + enterPrivKeyWindow = new EnterPrivKeyWindow(); + enterPrivKeyWindow.onClose(() -> enterPrivKeyWindow = null) .onKey(privKey -> model.setPrivKeyAndCheckPubKey(privKey)) .width(700) .show(); diff --git a/gui/src/main/java/io/bitsquare/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java b/gui/src/main/java/io/bitsquare/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java index 3291e03849..248643e415 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java @@ -23,7 +23,7 @@ import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.components.TitledGroupBg; import io.bitsquare.gui.components.paymentmethods.BlockChainForm; import io.bitsquare.gui.components.paymentmethods.PaymentMethodForm; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.gui.util.FormBuilder; import io.bitsquare.gui.util.ImageUtil; import io.bitsquare.gui.util.Layout; diff --git a/gui/src/main/java/io/bitsquare/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java b/gui/src/main/java/io/bitsquare/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java index 0ed3a33c53..2baa64f259 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java @@ -22,7 +22,7 @@ import io.bitsquare.common.util.Tuple2; import io.bitsquare.gui.common.view.ActivatableViewAndModel; import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.components.TableGroupHeadline; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.gui.util.ImageUtil; import io.bitsquare.gui.util.Layout; import io.bitsquare.locale.LanguageUtil; diff --git a/gui/src/main/java/io/bitsquare/gui/main/account/content/backup/BackupView.java b/gui/src/main/java/io/bitsquare/gui/main/account/content/backup/BackupView.java index e336511478..3fb339af32 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/account/content/backup/BackupView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/account/content/backup/BackupView.java @@ -20,7 +20,7 @@ package io.bitsquare.gui.main.account.content.backup; import io.bitsquare.app.BitsquareEnvironment; import io.bitsquare.gui.common.view.ActivatableView; import io.bitsquare.gui.common.view.FxmlView; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.Layout; import io.bitsquare.user.Preferences; diff --git a/gui/src/main/java/io/bitsquare/gui/main/account/content/fiataccounts/FiatAccountsView.java b/gui/src/main/java/io/bitsquare/gui/main/account/content/fiataccounts/FiatAccountsView.java index a833b98e25..bf55700b19 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/account/content/fiataccounts/FiatAccountsView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/account/content/fiataccounts/FiatAccountsView.java @@ -22,7 +22,7 @@ import io.bitsquare.gui.common.view.ActivatableViewAndModel; import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.components.TitledGroupBg; import io.bitsquare.gui.components.paymentmethods.*; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.gui.util.FormBuilder; import io.bitsquare.gui.util.ImageUtil; import io.bitsquare.gui.util.Layout; diff --git a/gui/src/main/java/io/bitsquare/gui/main/account/content/password/PasswordView.java b/gui/src/main/java/io/bitsquare/gui/main/account/content/password/PasswordView.java index 06c71accd1..029cf79d68 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/account/content/password/PasswordView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/account/content/password/PasswordView.java @@ -26,7 +26,7 @@ import io.bitsquare.gui.common.view.ActivatableView; import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.components.PasswordTextField; import io.bitsquare.gui.components.TitledGroupBg; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.gui.util.Layout; import io.bitsquare.gui.util.validation.InputValidator; import io.bitsquare.gui.util.validation.PasswordValidator; diff --git a/gui/src/main/java/io/bitsquare/gui/main/account/content/seedwords/SeedWordsView.java b/gui/src/main/java/io/bitsquare/gui/main/account/content/seedwords/SeedWordsView.java index 74a172c70a..a90f8a33d8 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/account/content/seedwords/SeedWordsView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/account/content/seedwords/SeedWordsView.java @@ -24,8 +24,8 @@ import io.bitsquare.btc.WalletService; import io.bitsquare.common.UserThread; import io.bitsquare.gui.common.view.ActivatableView; import io.bitsquare.gui.common.view.FxmlView; -import io.bitsquare.gui.main.popups.Popup; -import io.bitsquare.gui.main.popups.WalletPasswordPopup; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.WalletPasswordWindow; import io.bitsquare.gui.util.Layout; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; @@ -54,7 +54,7 @@ import static javafx.beans.binding.Bindings.createBooleanBinding; @FxmlView public class SeedWordsView extends ActivatableView { private final WalletService walletService; - private final WalletPasswordPopup walletPasswordPopup; + private final WalletPasswordWindow walletPasswordWindow; private Button restoreButton; private TextArea seedWordsTextArea; @@ -75,9 +75,9 @@ public class SeedWordsView extends ActivatableView { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - private SeedWordsView(WalletService walletService, WalletPasswordPopup walletPasswordPopup) { + private SeedWordsView(WalletService walletService, WalletPasswordWindow walletPasswordWindow) { this.walletService = walletService; - this.walletPasswordPopup = walletPasswordPopup; + this.walletPasswordWindow = walletPasswordWindow; } @Override @@ -126,7 +126,7 @@ public class SeedWordsView extends ActivatableView { private void askForPassword() { - walletPasswordPopup.onAesKey(aesKey -> { + walletPasswordWindow.onAesKey(aesKey -> { Wallet wallet = walletService.getWallet(); KeyCrypter keyCrypter = wallet.getKeyCrypter(); keyChainSeed = wallet.getKeyChainSeed(); diff --git a/gui/src/main/java/io/bitsquare/gui/main/disputes/arbitrator/ArbitratorDisputeView.java b/gui/src/main/java/io/bitsquare/gui/main/disputes/arbitrator/ArbitratorDisputeView.java index 49ee5daa10..151751ae79 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/disputes/arbitrator/ArbitratorDisputeView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/disputes/arbitrator/ArbitratorDisputeView.java @@ -22,9 +22,9 @@ import io.bitsquare.arbitration.DisputeManager; import io.bitsquare.common.crypto.KeyRing; import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.main.disputes.trader.TraderDisputeView; -import io.bitsquare.gui.main.popups.ContractPopup; -import io.bitsquare.gui.main.popups.DisputeSummaryPopup; -import io.bitsquare.gui.main.popups.TradeDetailsPopup; +import io.bitsquare.gui.main.overlays.windows.ContractWindow; +import io.bitsquare.gui.main.overlays.windows.DisputeSummaryWindow; +import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.trade.TradeManager; import javafx.collections.transformation.FilteredList; @@ -38,10 +38,10 @@ public class ArbitratorDisputeView extends TraderDisputeView { @Inject public ArbitratorDisputeView(DisputeManager disputeManager, KeyRing keyRing, TradeManager tradeManager, Stage stage, - BSFormatter formatter, DisputeSummaryPopup disputeSummaryPopup, - ContractPopup contractPopup, TradeDetailsPopup tradeDetailsPopup) { + BSFormatter formatter, DisputeSummaryWindow disputeSummaryWindow, + ContractWindow contractWindow, TradeDetailsWindow tradeDetailsWindow) { super(disputeManager, keyRing, tradeManager, stage, formatter, - disputeSummaryPopup, contractPopup, tradeDetailsPopup); + disputeSummaryWindow, contractWindow, tradeDetailsWindow); } @Override diff --git a/gui/src/main/java/io/bitsquare/gui/main/disputes/trader/TraderDisputeView.java b/gui/src/main/java/io/bitsquare/gui/main/disputes/trader/TraderDisputeView.java index 99919de7c3..a756638ac2 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/disputes/trader/TraderDisputeView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/disputes/trader/TraderDisputeView.java @@ -30,10 +30,10 @@ import io.bitsquare.gui.common.view.ActivatableView; import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.components.HyperlinkWithIcon; import io.bitsquare.gui.components.TableGroupHeadline; -import io.bitsquare.gui.main.popups.ContractPopup; -import io.bitsquare.gui.main.popups.DisputeSummaryPopup; -import io.bitsquare.gui.main.popups.Popup; -import io.bitsquare.gui.main.popups.TradeDetailsPopup; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.ContractWindow; +import io.bitsquare.gui.main.overlays.windows.DisputeSummaryWindow; +import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.GUIUtil; import io.bitsquare.p2p.network.Connection; @@ -80,9 +80,9 @@ public class TraderDisputeView extends ActivatableView { private final TradeManager tradeManager; private final Stage stage; private final BSFormatter formatter; - private final DisputeSummaryPopup disputeSummaryPopup; - private final ContractPopup contractPopup; - private final TradeDetailsPopup tradeDetailsPopup; + private final DisputeSummaryWindow disputeSummaryWindow; + private final ContractWindow contractWindow; + private final TradeDetailsWindow tradeDetailsWindow; private final List tempAttachments = new ArrayList<>(); @@ -110,16 +110,16 @@ public class TraderDisputeView extends ActivatableView { @Inject public TraderDisputeView(DisputeManager disputeManager, KeyRing keyRing, TradeManager tradeManager, Stage stage, - BSFormatter formatter, DisputeSummaryPopup disputeSummaryPopup, - ContractPopup contractPopup, TradeDetailsPopup tradeDetailsPopup) { + BSFormatter formatter, DisputeSummaryWindow disputeSummaryWindow, + ContractWindow contractWindow, TradeDetailsWindow tradeDetailsWindow) { this.disputeManager = disputeManager; this.keyRing = keyRing; this.tradeManager = tradeManager; this.stage = stage; this.formatter = formatter; - this.disputeSummaryPopup = disputeSummaryPopup; - this.contractPopup = contractPopup; - this.tradeDetailsPopup = tradeDetailsPopup; + this.disputeSummaryWindow = disputeSummaryWindow; + this.contractWindow = contractWindow; + this.tradeDetailsWindow = tradeDetailsWindow; } @Override @@ -198,7 +198,7 @@ public class TraderDisputeView extends ActivatableView { /////////////////////////////////////////////////////////////////////////////////////////// private void onOpenContract(Dispute dispute) { - contractPopup.show(dispute); + contractWindow.show(dispute); } private void onSendMessage(String inputText, Dispute dispute) { @@ -256,7 +256,7 @@ public class TraderDisputeView extends ActivatableView { } private void onCloseDispute(Dispute dispute) { - disputeSummaryPopup.onFinalizeDispute(() -> messagesAnchorPane.getChildren().remove(messagesInputBox)) + disputeSummaryWindow.onFinalizeDispute(() -> messagesAnchorPane.getChildren().remove(messagesInputBox)) .show(dispute); } @@ -654,7 +654,7 @@ public class TraderDisputeView extends ActivatableView { if (tradeOptional.isPresent()) { field.setMouseTransparent(false); field.setTooltip(new Tooltip("Open popup for details")); - field.setOnAction(event -> tradeDetailsPopup.show(tradeOptional.get())); + field.setOnAction(event -> tradeDetailsWindow.show(tradeOptional.get())); } else { field.setMouseTransparent(true); } diff --git a/gui/src/main/java/io/bitsquare/gui/main/funds/FundsView.java b/gui/src/main/java/io/bitsquare/gui/main/funds/FundsView.java index 2a04a3a510..63b3ecbadd 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/funds/FundsView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/funds/FundsView.java @@ -26,7 +26,7 @@ import io.bitsquare.gui.main.MainView; import io.bitsquare.gui.main.funds.reserved.ReservedView; import io.bitsquare.gui.main.funds.transactions.TransactionsView; import io.bitsquare.gui.main.funds.withdrawal.WithdrawalView; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.user.Preferences; import javafx.beans.value.ChangeListener; import javafx.fxml.FXML; @@ -86,7 +86,7 @@ public class FundsView extends ActivatableViewAndModel { navigation.navigateTo(MainView.class, FundsView.class, TransactionsView.class); String key = "tradeWalletInfoAtFunds"; - if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) + if (!BitsquareApp.DEV_MODE) new Popup().backgroundInfo("Bitsquare does not use a single application wallet, but dedicated wallets for every trade.\n\n" + "Funding of the wallet will be done when needed, for instance when you create or take an offer.\n" + "Withdrawing funds can be done after a trade is completed.\n\n" + diff --git a/gui/src/main/java/io/bitsquare/gui/main/funds/reserved/ReservedView.java b/gui/src/main/java/io/bitsquare/gui/main/funds/reserved/ReservedView.java index dcca9b30b3..99970161ed 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/funds/reserved/ReservedView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/funds/reserved/ReservedView.java @@ -25,9 +25,9 @@ import io.bitsquare.common.util.Utilities; import io.bitsquare.gui.common.view.ActivatableView; import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.components.HyperlinkWithIcon; -import io.bitsquare.gui.main.popups.OfferDetailsPopup; -import io.bitsquare.gui.main.popups.Popup; -import io.bitsquare.gui.main.popups.TradeDetailsPopup; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow; +import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.trade.Tradable; import io.bitsquare.trade.Trade; @@ -62,8 +62,8 @@ public class ReservedView extends ActivatableView { private final OpenOfferManager openOfferManager; private final Preferences preferences; private final BSFormatter formatter; - private final OfferDetailsPopup offerDetailsPopup; - private final TradeDetailsPopup tradeDetailsPopup; + private final OfferDetailsWindow offerDetailsWindow; + private final TradeDetailsWindow tradeDetailsWindow; private final ObservableList reservedAddresses = FXCollections.observableArrayList(); private BalanceListener balanceListener; @@ -74,14 +74,14 @@ public class ReservedView extends ActivatableView { @Inject private ReservedView(WalletService walletService, TradeManager tradeManager, OpenOfferManager openOfferManager, Preferences preferences, - BSFormatter formatter, OfferDetailsPopup offerDetailsPopup, TradeDetailsPopup tradeDetailsPopup) { + BSFormatter formatter, OfferDetailsWindow offerDetailsWindow, TradeDetailsWindow tradeDetailsWindow) { this.walletService = walletService; this.tradeManager = tradeManager; this.openOfferManager = openOfferManager; this.preferences = preferences; this.formatter = formatter; - this.offerDetailsPopup = offerDetailsPopup; - this.tradeDetailsPopup = tradeDetailsPopup; + this.offerDetailsWindow = offerDetailsWindow; + this.tradeDetailsWindow = tradeDetailsWindow; } @@ -157,9 +157,9 @@ public class ReservedView extends ActivatableView { if (tradableOptional.isPresent()) { Tradable tradable = tradableOptional.get(); if (tradable instanceof Trade) { - tradeDetailsPopup.show((Trade) tradable); + tradeDetailsWindow.show((Trade) tradable); } else if (tradable instanceof OpenOffer) { - offerDetailsPopup.show(tradable.getOffer()); + offerDetailsWindow.show(tradable.getOffer()); } } } diff --git a/gui/src/main/java/io/bitsquare/gui/main/funds/transactions/TransactionsView.java b/gui/src/main/java/io/bitsquare/gui/main/funds/transactions/TransactionsView.java index 528e1b4a99..f008b42fd9 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/funds/transactions/TransactionsView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/funds/transactions/TransactionsView.java @@ -25,9 +25,9 @@ import io.bitsquare.gui.common.view.ActivatableView; import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.components.AddressWithIconAndDirection; import io.bitsquare.gui.components.HyperlinkWithIcon; -import io.bitsquare.gui.main.popups.OfferDetailsPopup; -import io.bitsquare.gui.main.popups.Popup; -import io.bitsquare.gui.main.popups.TradeDetailsPopup; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow; +import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.trade.Tradable; import io.bitsquare.trade.Trade; @@ -72,9 +72,9 @@ public class TransactionsView extends ActivatableView { private final FailedTradesManager failedTradesManager; private final BSFormatter formatter; private final Preferences preferences; - private final TradeDetailsPopup tradeDetailsPopup; + private final TradeDetailsWindow tradeDetailsWindow; private final DisputeManager disputeManager; - private final OfferDetailsPopup offerDetailsPopup; + private final OfferDetailsWindow offerDetailsWindow; private WalletEventListener walletEventListener; @@ -85,9 +85,9 @@ public class TransactionsView extends ActivatableView { @Inject private TransactionsView(WalletService walletService, TradeManager tradeManager, OpenOfferManager openOfferManager, ClosedTradableManager closedTradableManager, FailedTradesManager failedTradesManager, - BSFormatter formatter, Preferences preferences, TradeDetailsPopup tradeDetailsPopup, + BSFormatter formatter, Preferences preferences, TradeDetailsWindow tradeDetailsWindow, DisputeManager disputeManager, - OfferDetailsPopup offerDetailsPopup) { + OfferDetailsWindow offerDetailsWindow) { this.walletService = walletService; this.tradeManager = tradeManager; this.openOfferManager = openOfferManager; @@ -95,9 +95,9 @@ public class TransactionsView extends ActivatableView { this.failedTradesManager = failedTradesManager; this.formatter = formatter; this.preferences = preferences; - this.tradeDetailsPopup = tradeDetailsPopup; + this.tradeDetailsWindow = tradeDetailsWindow; this.disputeManager = disputeManager; - this.offerDetailsPopup = offerDetailsPopup; + this.offerDetailsWindow = offerDetailsWindow; } @Override @@ -222,9 +222,9 @@ public class TransactionsView extends ActivatableView { private void openDetailPopup(TransactionsListItem item) { if (item.getTradable() instanceof OpenOffer) - offerDetailsPopup.show(item.getTradable().getOffer()); + offerDetailsWindow.show(item.getTradable().getOffer()); else if (item.getTradable() instanceof Trade) - tradeDetailsPopup.show((Trade) item.getTradable()); + tradeDetailsWindow.show((Trade) item.getTradable()); } diff --git a/gui/src/main/java/io/bitsquare/gui/main/funds/withdrawal/WithdrawalView.java b/gui/src/main/java/io/bitsquare/gui/main/funds/withdrawal/WithdrawalView.java index f2ac7970f2..7726f4f2be 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/funds/withdrawal/WithdrawalView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/funds/withdrawal/WithdrawalView.java @@ -28,10 +28,10 @@ import io.bitsquare.common.util.Utilities; import io.bitsquare.gui.common.view.ActivatableView; import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.components.HyperlinkWithIcon; -import io.bitsquare.gui.main.popups.OfferDetailsPopup; -import io.bitsquare.gui.main.popups.Popup; -import io.bitsquare.gui.main.popups.TradeDetailsPopup; -import io.bitsquare.gui.main.popups.WalletPasswordPopup; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow; +import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow; +import io.bitsquare.gui.main.overlays.windows.WalletPasswordWindow; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.validation.BtcAddressValidator; import io.bitsquare.trade.Tradable; @@ -86,9 +86,9 @@ public class WithdrawalView extends ActivatableView { private final BSFormatter formatter; private final Preferences preferences; private final BtcAddressValidator btcAddressValidator; - private final WalletPasswordPopup walletPasswordPopup; - private final OfferDetailsPopup offerDetailsPopup; - private final TradeDetailsPopup tradeDetailsPopup; + private final WalletPasswordWindow walletPasswordWindow; + private final OfferDetailsWindow offerDetailsWindow; + private final TradeDetailsWindow tradeDetailsWindow; private final ObservableList fundedAddresses = FXCollections.observableArrayList(); private Set selectedItems = new HashSet<>(); private BalanceListener balanceListener; @@ -104,8 +104,8 @@ public class WithdrawalView extends ActivatableView { ClosedTradableManager closedTradableManager, FailedTradesManager failedTradesManager, OpenOfferManager openOfferManager, BSFormatter formatter, Preferences preferences, - BtcAddressValidator btcAddressValidator, WalletPasswordPopup walletPasswordPopup, - OfferDetailsPopup offerDetailsPopup, TradeDetailsPopup tradeDetailsPopup) { + BtcAddressValidator btcAddressValidator, WalletPasswordWindow walletPasswordWindow, + OfferDetailsWindow offerDetailsWindow, TradeDetailsWindow tradeDetailsWindow) { this.walletService = walletService; this.tradeManager = tradeManager; this.closedTradableManager = closedTradableManager; @@ -114,9 +114,9 @@ public class WithdrawalView extends ActivatableView { this.formatter = formatter; this.preferences = preferences; this.btcAddressValidator = btcAddressValidator; - this.walletPasswordPopup = walletPasswordPopup; - this.offerDetailsPopup = offerDetailsPopup; - this.tradeDetailsPopup = tradeDetailsPopup; + this.walletPasswordWindow = walletPasswordWindow; + this.offerDetailsWindow = offerDetailsWindow; + this.tradeDetailsWindow = tradeDetailsWindow; } @Override @@ -270,9 +270,9 @@ public class WithdrawalView extends ActivatableView { if (tradableOptional.isPresent()) { Tradable tradable = tradableOptional.get(); if (tradable instanceof Trade) { - tradeDetailsPopup.show((Trade) tradable); + tradeDetailsWindow.show((Trade) tradable); } else if (tradable instanceof OpenOffer) { - offerDetailsPopup.show(tradable.getOffer()); + offerDetailsWindow.show(tradable.getOffer()); } } } @@ -313,7 +313,7 @@ public class WithdrawalView extends ActivatableView { private void doWithdraw(Coin amount, FutureCallback callback) { if (walletService.getWallet().isEncrypted()) { - walletPasswordPopup.onAesKey(aesKey -> sendFunds(amount, aesKey, callback)).show(); + walletPasswordWindow.onAesKey(aesKey -> sendFunds(amount, aesKey, callback)).show(); } else { sendFunds(amount, null, callback); } diff --git a/gui/src/main/java/io/bitsquare/gui/main/help/Help.java b/gui/src/main/java/io/bitsquare/gui/main/help/Help.java index e8ba0a27cb..e2ebe6f967 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/help/Help.java +++ b/gui/src/main/java/io/bitsquare/gui/main/help/Help.java @@ -18,7 +18,7 @@ package io.bitsquare.gui.main.help; import io.bitsquare.common.util.Utilities; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/gui/src/main/java/io/bitsquare/gui/main/intructions/Instruction.java b/gui/src/main/java/io/bitsquare/gui/main/intructions/Instruction.java deleted file mode 100644 index 13f9b0f993..0000000000 --- a/gui/src/main/java/io/bitsquare/gui/main/intructions/Instruction.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.bitsquare.gui.main.intructions; - -import com.google.inject.Inject; -import io.bitsquare.gui.main.popups.Popup; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Instruction extends Popup { - private static final Logger log = LoggerFactory.getLogger(Instruction.class); - - @Inject - public Instruction() { - - } -} diff --git a/gui/src/main/java/io/bitsquare/gui/main/intructions/InstructionCenter.java b/gui/src/main/java/io/bitsquare/gui/main/intructions/InstructionCenter.java deleted file mode 100644 index cc8af4d2ed..0000000000 --- a/gui/src/main/java/io/bitsquare/gui/main/intructions/InstructionCenter.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.bitsquare.gui.main.intructions; - -import com.google.inject.Inject; -import io.bitsquare.trade.TradeManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class InstructionCenter { - private final Logger log = LoggerFactory.getLogger(InstructionCenter.class); - - private final TradeManager tradeManager; - - @Inject - public InstructionCenter(TradeManager tradeManager) { - this.tradeManager = tradeManager; - } -} diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/OfferView.java b/gui/src/main/java/io/bitsquare/gui/main/offer/OfferView.java index d5358a6fa0..71430ce7f7 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/OfferView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/OfferView.java @@ -28,7 +28,7 @@ import io.bitsquare.gui.main.MainView; import io.bitsquare.gui.main.offer.createoffer.CreateOfferView; import io.bitsquare.gui.main.offer.offerbook.OfferBookView; import io.bitsquare.gui.main.offer.takeoffer.TakeOfferView; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.locale.CurrencyUtil; import io.bitsquare.locale.TradeCurrency; import io.bitsquare.trade.offer.Offer; diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferDataModel.java b/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferDataModel.java index 26851366f0..56db1b9952 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferDataModel.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferDataModel.java @@ -29,9 +29,9 @@ import io.bitsquare.btc.pricefeed.PriceFeed; import io.bitsquare.common.UserThread; import io.bitsquare.common.crypto.KeyRing; import io.bitsquare.gui.common.model.ActivatableDataModel; -import io.bitsquare.gui.main.notifications.Notification; -import io.bitsquare.gui.main.popups.Popup; -import io.bitsquare.gui.main.popups.WalletPasswordPopup; +import io.bitsquare.gui.main.overlays.notifications.Notification; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.WalletPasswordWindow; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.locale.Country; import io.bitsquare.locale.TradeCurrency; @@ -75,7 +75,7 @@ class CreateOfferDataModel extends ActivatableDataModel { private final KeyRing keyRing; private final P2PService p2PService; private final PriceFeed priceFeed; - private final WalletPasswordPopup walletPasswordPopup; + private final WalletPasswordWindow walletPasswordWindow; private final BlockchainService blockchainService; private final BSFormatter formatter; private final String offerId; @@ -107,6 +107,7 @@ class CreateOfferDataModel extends ActivatableDataModel { private PaymentAccount paymentAccount; private boolean isTabSelected; + private Notification walletFundedNotification; /////////////////////////////////////////////////////////////////////////////////////////// @@ -116,7 +117,7 @@ class CreateOfferDataModel extends ActivatableDataModel { @Inject CreateOfferDataModel(OpenOfferManager openOfferManager, WalletService walletService, TradeWalletService tradeWalletService, Preferences preferences, User user, KeyRing keyRing, P2PService p2PService, PriceFeed priceFeed, - WalletPasswordPopup walletPasswordPopup, BlockchainService blockchainService, BSFormatter formatter) { + WalletPasswordWindow walletPasswordWindow, BlockchainService blockchainService, BSFormatter formatter) { this.openOfferManager = openOfferManager; this.walletService = walletService; this.tradeWalletService = tradeWalletService; @@ -125,7 +126,7 @@ class CreateOfferDataModel extends ActivatableDataModel { this.keyRing = keyRing; this.p2PService = p2PService; this.priceFeed = priceFeed; - this.walletPasswordPopup = walletPasswordPopup; + this.walletPasswordWindow = walletPasswordWindow; this.blockchainService = blockchainService; this.formatter = formatter; @@ -273,7 +274,7 @@ class CreateOfferDataModel extends ActivatableDataModel { void onPlaceOffer(Offer offer, TransactionResultHandler resultHandler) { if (walletService.getWallet().isEncrypted() && tradeWalletService.getAesKey() == null) { - walletPasswordPopup.onAesKey(aesKey -> { + walletPasswordWindow.onAesKey(aesKey -> { tradeWalletService.setAesKey(aesKey); doPlaceOffer(offer, resultHandler); }).show(); @@ -384,12 +385,15 @@ class CreateOfferDataModel extends ActivatableDataModel { if (isWalletFunded.get()) { walletService.removeBalanceListener(balanceListener); - new Notification() - .headLine("Trading wallet update") - .notification("Your trading wallet is sufficiently funded.\n" + - "Amount: " + formatter.formatCoinWithCode(totalToPayAsCoin.get())) - .autoClose() - .show(); + if (walletFundedNotification == null) { + walletFundedNotification = new Notification() + .headLine("Trading wallet update") + .notification("Your trading wallet is sufficiently funded.\n" + + "Amount: " + formatter.formatCoinWithCode(totalToPayAsCoin.get())) + .autoClose(); + + walletFundedNotification.show(); + } } } diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferView.java b/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferView.java index ce4c3d4b2f..f04cd1ea37 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferView.java @@ -38,8 +38,8 @@ import io.bitsquare.gui.main.account.settings.AccountSettingsView; import io.bitsquare.gui.main.funds.FundsView; import io.bitsquare.gui.main.funds.withdrawal.WithdrawalView; import io.bitsquare.gui.main.offer.OfferView; -import io.bitsquare.gui.main.popups.OfferDetailsPopup; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow; import io.bitsquare.gui.main.portfolio.PortfolioView; import io.bitsquare.gui.main.portfolio.openoffer.OpenOffersView; import io.bitsquare.gui.util.FormBuilder; @@ -74,7 +74,7 @@ import static javafx.beans.binding.Bindings.createStringBinding; public class CreateOfferView extends ActivatableViewAndModel { private final Navigation navigation; - private final OfferDetailsPopup offerDetailsPopup; + private final OfferDetailsWindow offerDetailsWindow; private ScrollPane scrollPane; private GridPane gridPane; @@ -120,11 +120,11 @@ public class CreateOfferView extends ActivatableViewAndModel navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, ArbitratorSelectionView.class)) + .show(); } } else { new Popup().warning("You need to wait until your client is bootstrapped in the network.\n" + @@ -259,37 +254,33 @@ public class CreateOfferView extends ActivatableViewAndModel Utilities.openWebPage("https://bitsquare.io/faq#6")) - .actionButtonText("I understand") - .onAction(() -> { - }) - .dontShowAgainId(id, preferences) - .show(); - } + String key = "securityDepositInfo"; + new Popup().backgroundInfo("To ensure that both traders follow the trade protocol they need to pay a security deposit.\n\n" + + "The deposit will stay in your local trading wallet until the offer gets accepted by another trader.\n" + + "It will be refunded to you after the trade has successfully completed.") + .closeButtonText("I want to learn more") + .onClose(() -> Utilities.openWebPage("https://bitsquare.io/faq#6")) + .actionButtonText("I understand") + .onAction(() -> { + }) + .dontShowAgainId(key, preferences) + .show(); - id = "createOfferFundWalletInfo"; - if (model.dataModel.getPreferences().showAgain(id)) { - String tradeAmountText = model.isSellOffer() ? "the trade amount, " : ""; - new Popup().headLine("Fund your trading wallet").instruction("You need to pay in " + - model.totalToPay.get() + " to your local Bitsquare trading wallet.\n" + - "The amount is the sum of " + tradeAmountText + "the security deposit, the trading fee and " + - "the bitcoin mining fee.\n\n" + - "Please send from your external Bitcoin wallet the exact amount to the address: " + - model.getAddressAsString() + "\n" + - "(you can copy the address in the screen below after closing that popup)\n\n" + - "Make sure you use a sufficiently high mining fee of at least " + - model.formatter.formatCoinWithCode(FeePolicy.getMinRequiredFeeForFundingTx()) + - " to avoid problems that your transaction does not get confirmed in the blockchain.\n\n" + - "You can see the status of your incoming payment and all the details in the screen below.") - .dontShowAgainId(id, preferences) - .show(); - } + key = "createOfferFundWalletInfo"; + String tradeAmountText = model.isSellOffer() ? "the trade amount, " : ""; + new Popup().headLine("Fund your trading wallet").instruction("You need to pay in " + + model.totalToPay.get() + " to your local Bitsquare trading wallet.\n" + + "The amount is the sum of " + tradeAmountText + "the security deposit, the trading fee and " + + "the bitcoin mining fee.\n\n" + + "Please send from your external Bitcoin wallet the exact amount to the address: " + + model.getAddressAsString() + "\n" + + "(you can copy the address in the screen below after closing that popup)\n\n" + + "Make sure you use a sufficiently high mining fee of at least " + + model.formatter.formatCoinWithCode(FeePolicy.getMinRequiredFeeForFundingTx()) + + " to avoid problems that your transaction does not get confirmed in the blockchain.\n\n" + + "You can see the status of your incoming payment and all the details in the screen below.") + .dontShowAgainId(key, preferences) + .show(); } nextButton.setVisible(false); diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookView.java b/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookView.java index 5561f01848..4bd50a85e1 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookView.java @@ -30,8 +30,8 @@ import io.bitsquare.gui.main.account.settings.AccountSettingsView; import io.bitsquare.gui.main.funds.FundsView; import io.bitsquare.gui.main.funds.withdrawal.WithdrawalView; import io.bitsquare.gui.main.offer.OfferView; -import io.bitsquare.gui.main.popups.OfferDetailsPopup; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow; import io.bitsquare.gui.util.Layout; import io.bitsquare.locale.BSResources; import io.bitsquare.locale.TradeCurrency; @@ -57,7 +57,7 @@ import static javafx.beans.binding.Bindings.createStringBinding; public class OfferBookView extends ActivatableViewAndModel { private final Navigation navigation; - private final OfferDetailsPopup offerDetailsPopup; + private final OfferDetailsWindow offerDetailsWindow; private ComboBox currencyComboBox; private ComboBox paymentMethodComboBox; @@ -75,11 +75,11 @@ public class OfferBookView extends ActivatableViewAndModel offerDetailsPopup.show(item.getOffer())); + field.setOnAction(event -> offerDetailsWindow.show(item.getOffer())); field.setTooltip(new Tooltip(model.getPaymentMethodToolTip(item))); setGraphic(field); } else { diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferDataModel.java b/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferDataModel.java index d4d6b92cdf..95b15417a6 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferDataModel.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferDataModel.java @@ -30,9 +30,9 @@ import io.bitsquare.btc.pricefeed.PriceFeed; import io.bitsquare.common.UserThread; import io.bitsquare.common.handlers.ResultHandler; import io.bitsquare.gui.common.model.ActivatableDataModel; -import io.bitsquare.gui.main.notifications.Notification; -import io.bitsquare.gui.main.popups.Popup; -import io.bitsquare.gui.main.popups.WalletPasswordPopup; +import io.bitsquare.gui.main.overlays.notifications.Notification; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.WalletPasswordWindow; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.locale.CurrencyUtil; import io.bitsquare.locale.TradeCurrency; @@ -68,7 +68,7 @@ class TakeOfferDataModel extends ActivatableDataModel { private final TradeWalletService tradeWalletService; private final WalletService walletService; private final User user; - private final WalletPasswordPopup walletPasswordPopup; + private final WalletPasswordWindow walletPasswordWindow; private final Preferences preferences; private final PriceFeed priceFeed; private final BlockchainService blockchainService; @@ -92,6 +92,7 @@ class TakeOfferDataModel extends ActivatableDataModel { private BalanceListener balanceListener; private PaymentAccount paymentAccount; private boolean isTabSelected; + private Notification walletFundedNotification; /////////////////////////////////////////////////////////////////////////////////////////// @@ -101,14 +102,14 @@ class TakeOfferDataModel extends ActivatableDataModel { @Inject TakeOfferDataModel(TradeManager tradeManager, TradeWalletService tradeWalletService, - WalletService walletService, User user, WalletPasswordPopup walletPasswordPopup, + WalletService walletService, User user, WalletPasswordWindow walletPasswordWindow, Preferences preferences, PriceFeed priceFeed, BlockchainService blockchainService, BSFormatter formatter) { this.tradeManager = tradeManager; this.tradeWalletService = tradeWalletService; this.walletService = walletService; this.user = user; - this.walletPasswordPopup = walletPasswordPopup; + this.walletPasswordWindow = walletPasswordWindow; this.preferences = preferences; this.priceFeed = priceFeed; this.blockchainService = blockchainService; @@ -222,7 +223,7 @@ class TakeOfferDataModel extends ActivatableDataModel { // have it persisted as well. void onTakeOffer(TradeResultHandler tradeResultHandler) { if (walletService.getWallet().isEncrypted() && tradeWalletService.getAesKey() == null) { - walletPasswordPopup.onAesKey(aesKey -> { + walletPasswordWindow.onAesKey(aesKey -> { tradeWalletService.setAesKey(aesKey); doTakeOffer(tradeResultHandler); }).show(); @@ -327,12 +328,14 @@ class TakeOfferDataModel extends ActivatableDataModel { if (isWalletFunded.get()) { walletService.removeBalanceListener(balanceListener); - new Notification() - .headLine("Trading wallet update") - .notification("Your trading wallet is sufficiently funded.\n" + - "Amount: " + formatter.formatCoinWithCode(totalToPayAsCoin.get())) - .autoClose() - .show(); + if (walletFundedNotification == null) { + walletFundedNotification = new Notification() + .headLine("Trading wallet update") + .notification("Your trading wallet is sufficiently funded.\n" + + "Amount: " + formatter.formatCoinWithCode(totalToPayAsCoin.get())) + .autoClose(); + walletFundedNotification.show(); + } } } diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferView.java b/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferView.java index cce9d5f61b..b0d574de81 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferView.java @@ -35,8 +35,9 @@ import io.bitsquare.gui.main.account.settings.AccountSettingsView; import io.bitsquare.gui.main.funds.FundsView; import io.bitsquare.gui.main.funds.withdrawal.WithdrawalView; import io.bitsquare.gui.main.offer.OfferView; -import io.bitsquare.gui.main.popups.OfferDetailsPopup; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.Overlay; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow; import io.bitsquare.gui.main.portfolio.PortfolioView; import io.bitsquare.gui.main.portfolio.pendingtrades.PendingTradesView; import io.bitsquare.gui.util.BSFormatter; @@ -72,7 +73,7 @@ import static javafx.beans.binding.Bindings.createStringBinding; public class TakeOfferView extends ActivatableViewAndModel { private final Navigation navigation; private final BSFormatter formatter; - private final OfferDetailsPopup offerDetailsPopup; + private final OfferDetailsWindow offerDetailsWindow; private final Preferences preferences; private ScrollPane scrollPane; private GridPane gridPane; @@ -102,7 +103,7 @@ public class TakeOfferView extends ActivatableViewAndModel isOfferAvailablePopup; private ChangeListener feeFromFundingTxListener; @@ -112,12 +113,12 @@ public class TakeOfferView extends ActivatableViewAndModel model.onTakeOffer()) - .dontShowAgainId(id) - .show(offer, model.dataModel.amountAsCoin.get()); - } else { - if (model.hasAcceptedArbitrators()) { - model.onTakeOffer(); - } else { - new Popup().warning("You have no arbitrator selected.\n" + - "Please select at least one arbitrator.").show(); + if (model.hasAcceptedArbitrators()) { + offerDetailsWindow.onTakeOffer(() -> model.onTakeOffer()) + .show(model.getOffer(), model.dataModel.amountAsCoin.get()); - navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, ArbitratorSelectionView.class); - } + } else { + new Popup().warning("You have no arbitrator selected.\n" + + "You need to select at least one arbitrator.") + .actionButtonText("Go to \"Arbitrator selection\"") + .onAction(() -> navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, ArbitratorSelectionView.class)) + .show(); } } @@ -402,36 +398,32 @@ public class TakeOfferView extends ActivatableViewAndModel Utilities.openWebPage("https://bitsquare.io/faq#6")) - .actionButtonText("I understand") - .onAction(() -> { - }) - .dontShowAgainId(id, preferences) - .show(); - } + String key = "securityDepositInfo"; + new Popup().backgroundInfo("To ensure that both traders follow the trade protocol they need to pay a security deposit.\n\n" + + "The deposit will stay in your local trading wallet until the offer gets accepted by another trader.\n" + + "It will be refunded to you after the trade has successfully completed.") + .closeButtonText("I want to learn more") + .onClose(() -> Utilities.openWebPage("https://bitsquare.io/faq#6")) + .actionButtonText("I understand") + .onAction(() -> { + }) + .dontShowAgainId(key, preferences) + .show(); - id = "takeOfferFundWalletInfo"; - if (model.dataModel.getPreferences().showAgain(id)) { - String tradeAmountText = model.isSeller() ? "the trade amount, " : ""; - new Popup().headLine("Fund your trading wallet").instruction("You need to pay in " + - model.totalToPay.get() + " to your local Bitsquare trading wallet.\n" + - "The amount is the sum of " + tradeAmountText + "the security deposit, the trading fee and " + - "the bitcoin mining fee.\n\n" + - "Please send from your external Bitcoin wallet the exact amount to the address: " + - model.getAddressAsString() + "\n(you can copy the address in the screen below after closing that popup)\n\n" + - "Make sure you use a sufficiently high mining fee of at least " + - model.formatter.formatCoinWithCode(FeePolicy.getMinRequiredFeeForFundingTx()) + - " to avoid problems that your transaction does not get confirmed in the blockchain.\n\n" + - "You can see the status of your incoming payment and all the details in the screen below.") - .dontShowAgainId(id, preferences) - .show(); - } + key = "takeOfferFundWalletInfo"; + String tradeAmountText = model.isSeller() ? "the trade amount, " : ""; + new Popup().headLine("Fund your trading wallet").instruction("You need to pay in " + + model.totalToPay.get() + " to your local Bitsquare trading wallet.\n" + + "The amount is the sum of " + tradeAmountText + "the security deposit, the trading fee and " + + "the bitcoin mining fee.\n\n" + + "Please send from your external Bitcoin wallet the exact amount to the address: " + + model.getAddressAsString() + "\n(you can copy the address in the screen below after closing that popup)\n\n" + + "Make sure you use a sufficiently high mining fee of at least " + + model.formatter.formatCoinWithCode(FeePolicy.getMinRequiredFeeForFundingTx()) + + " to avoid problems that your transaction does not get confirmed in the blockchain.\n\n" + + "You can see the status of your incoming payment and all the details in the screen below.") + .dontShowAgainId(key, preferences) + .show(); } nextButton.setVisible(false); diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/Popup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/Overlay.java similarity index 87% rename from gui/src/main/java/io/bitsquare/gui/main/popups/Popup.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/Overlay.java index 9bb61ac9fb..7f63504884 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/Popup.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/Overlay.java @@ -15,7 +15,7 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays; import de.jensd.fx.fontawesome.AwesomeIcon; import io.bitsquare.common.Timer; @@ -47,7 +47,7 @@ import java.util.Optional; import static io.bitsquare.gui.util.FormBuilder.addCheckBox; -public class Popup { +public abstract class Overlay { protected final Logger log = LoggerFactory.getLogger(this.getClass()); protected final static double DEFAULT_WIDTH = 600; @@ -72,8 +72,8 @@ public class Popup { protected Label headLineLabel; protected String dontShowAgainId; private Preferences preferences; - private ChangeListener positionListener; - private Timer centerTime; + protected ChangeListener positionListener; + protected Timer centerTime; protected double buttonDistance = 20; private String type; private AwesomeIcon awesomeIcon; @@ -83,25 +83,30 @@ public class Popup { // Public API /////////////////////////////////////////////////////////////////////////////////////////// - public Popup() { + public Overlay() { } public void show() { - createGridPane(); - addHeadLine(); - addSeparator(); + if (dontShowAgainId == null || preferences == null || preferences.showAgain(dontShowAgainId)) { + createGridPane(); + addHeadLine(); + addSeparator(); - if (showProgressIndicator) - addProgressIndicator(); + if (showProgressIndicator) + addProgressIndicator(); - addMessage(); - if (showReportErrorButtons) - addReportErrorButtons(); + addMessage(); + if (showReportErrorButtons) + addReportErrorButtons(); - addCloseButton(); - addDontShowAgainCheckBox(); - applyStyles(); - PopupManager.queueForDisplay(this); + addCloseButton(); + addDontShowAgainCheckBox(); + applyStyles(); + onShow(); + } + } + + protected void onShow() { } public void hide() { @@ -126,11 +131,14 @@ public class Popup { log.warn("Stage is null"); cleanup(); - PopupManager.isHidden(Popup.this); + onHidden(); } }); } + protected void onHidden() { + } + protected void animateHide(Runnable onFinishedHandler) { onFinishedHandler.run(); } @@ -139,76 +147,76 @@ public class Popup { } - public Popup onClose(Runnable closeHandler) { + public T onClose(Runnable closeHandler) { this.closeHandlerOptional = Optional.of(closeHandler); - return this; + return (T) this; } - public Popup onAction(Runnable actionHandler) { + public T onAction(Runnable actionHandler) { this.actionHandlerOptional = Optional.of(actionHandler); - return this; + return (T) this; } - public Popup headLine(String headLine) { + public T headLine(String headLine) { this.headLine = headLine; - return this; + return (T) this; } - public Popup notification(String message) { + public T notification(String message) { type = "notification"; if (headLine == null) this.headLine = "Notification"; this.message = message; setTruncatedMessage(); - return this; + return (T) this; } - public Popup instruction(String message) { + public T instruction(String message) { type = "instruction"; if (headLine == null) this.headLine = "Instruction"; this.message = message; setTruncatedMessage(); - return this; + return (T) this; } - public Popup backgroundInfo(String message) { + public T backgroundInfo(String message) { type = "backgroundInfo"; if (headLine == null) this.headLine = "Background information"; this.message = message; setTruncatedMessage(); - return this; + return (T) this; } - public Popup feedback(String message) { + public T feedback(String message) { type = "feedback"; if (headLine == null) this.headLine = "Feedback"; this.message = message; setTruncatedMessage(); - return this; + return (T) this; } - public Popup confirmation(String message) { + public T confirmation(String message) { type = "confirmation"; if (headLine == null) this.headLine = "Confirmation"; this.message = message; setTruncatedMessage(); - return this; + return (T) this; } - public Popup information(String message) { + public T information(String message) { type = "information"; if (headLine == null) this.headLine = "Information"; this.message = message; setTruncatedMessage(); - return this; + return (T) this; } - public Popup warning(String message) { + public T warning(String message) { type = "warning"; awesomeIcon = AwesomeIcon.LIGHTBULB; @@ -216,54 +224,54 @@ public class Popup { this.headLine = "Warning"; this.message = message; setTruncatedMessage(); - return this; + return (T) this; } - public Popup error(String message) { + public T error(String message) { type = "error"; showReportErrorButtons(); if (headLine == null) this.headLine = "Error"; this.message = message; setTruncatedMessage(); - return this; + return (T) this; } - public Popup showReportErrorButtons() { + public T showReportErrorButtons() { this.showReportErrorButtons = true; - return this; + return (T) this; } - public Popup message(String message) { + public T message(String message) { this.message = message; setTruncatedMessage(); - return this; + return (T) this; } - public Popup closeButtonText(String closeButtonText) { + public T closeButtonText(String closeButtonText) { this.closeButtonText = closeButtonText; - return this; + return (T) this; } - public Popup actionButtonText(String actionButtonText) { + public T actionButtonText(String actionButtonText) { this.actionButtonText = actionButtonText; - return this; + return (T) this; } - public Popup width(double width) { + public T width(double width) { this.width = width; - return this; + return (T) this; } - public Popup showProgressIndicator() { + public T showProgressIndicator() { this.showProgressIndicator = true; - return this; + return (T) this; } - public Popup dontShowAgainId(String dontShowAgainId, Preferences preferences) { - this.dontShowAgainId = type + "_" + dontShowAgainId; + public T dontShowAgainId(String key, Preferences preferences) { + this.dontShowAgainId = key; this.preferences = preferences; - return this; + return (T) this; } /////////////////////////////////////////////////////////////////////////////////////////// @@ -458,15 +466,12 @@ public class Popup { gridPane.getChildren().add(progressIndicator); } - private void addDontShowAgainCheckBox() { + protected void addDontShowAgainCheckBox() { if (dontShowAgainId != null && preferences != null) { CheckBox dontShowAgainCheckBox = addCheckBox(gridPane, rowIndex, "Don't show again", buttonDistance - 1); GridPane.setColumnIndex(dontShowAgainCheckBox, 0); GridPane.setHalignment(dontShowAgainCheckBox, HPos.LEFT); - dontShowAgainCheckBox.setOnAction(e -> { - if (dontShowAgainCheckBox.isSelected()) - preferences.dontShowAgain(dontShowAgainId); - }); + dontShowAgainCheckBox.setOnAction(e -> preferences.dontShowAgain(dontShowAgainId, dontShowAgainCheckBox.isSelected())); } } diff --git a/gui/src/main/java/io/bitsquare/gui/main/notifications/Notification.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/notifications/Notification.java similarity index 92% rename from gui/src/main/java/io/bitsquare/gui/main/notifications/Notification.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/notifications/Notification.java index 9a432491d2..d54a6c15c8 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/notifications/Notification.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/notifications/Notification.java @@ -1,8 +1,8 @@ -package io.bitsquare.gui.main.notifications; +package io.bitsquare.gui.main.overlays.notifications; import io.bitsquare.common.Timer; import io.bitsquare.common.UserThread; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.Overlay; import javafx.animation.Interpolator; import javafx.animation.KeyFrame; import javafx.animation.KeyValue; @@ -18,7 +18,7 @@ import javafx.util.Duration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class Notification extends Popup { +public class Notification extends Overlay { private static final Logger log = LoggerFactory.getLogger(Notification.class); private boolean hasBeenDisplayed; private boolean autoClose; @@ -29,26 +29,30 @@ public class Notification extends Popup { NotificationCenter.add(this); } - public Notification headLine(String headLine) { - return (Notification) super.headLine(headLine); + public void onReadyForDisplay() { + super.display(); + if (autoClose && autoCloseTimer == null) + autoCloseTimer = UserThread.runAfter(this::hide, 5); + } + + @Override + protected void onShow() { + NotificationManager.queueForDisplay(this); + } + + @Override + protected void onHidden() { + NotificationManager.onHidden(this); } public Notification tradeHeadLine(String tradeId) { return headLine("Notification for trade with ID " + tradeId); } - public Notification notification(String message) { - return (Notification) super.notification(message); - } - public Notification disputeHeadLine(String tradeId) { return headLine("Support ticket for trade with ID " + tradeId); } - public Notification message(String message) { - return (Notification) super.message(message); - } - @Override protected void addSeparator() { // dont show a separator @@ -60,19 +64,12 @@ public class Notification extends Popup { hasBeenDisplayed = true; } + public Notification autoClose() { autoClose = true; return this; } - @Override - public void display() { - super.display(); - - if (autoClose && autoCloseTimer == null) - autoCloseTimer = UserThread.runAfter(this::hide, 5); - } - @Override protected void animateHide(Runnable onFinishedHandler) { if (autoCloseTimer != null) { diff --git a/gui/src/main/java/io/bitsquare/gui/main/notifications/NotificationCenter.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/notifications/NotificationCenter.java similarity index 99% rename from gui/src/main/java/io/bitsquare/gui/main/notifications/NotificationCenter.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/notifications/NotificationCenter.java index d617629297..71a3749ace 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/notifications/NotificationCenter.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/notifications/NotificationCenter.java @@ -1,4 +1,4 @@ -package io.bitsquare.gui.main.notifications; +package io.bitsquare.gui.main.overlays.notifications; import com.google.inject.Inject; import io.bitsquare.app.Log; diff --git a/gui/src/main/java/io/bitsquare/gui/main/overlays/notifications/NotificationManager.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/notifications/NotificationManager.java new file mode 100644 index 0000000000..fe27da6d01 --- /dev/null +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/notifications/NotificationManager.java @@ -0,0 +1,40 @@ +package io.bitsquare.gui.main.overlays.notifications; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Queue; +import java.util.concurrent.LinkedBlockingQueue; + +public class NotificationManager { + private static final Logger log = LoggerFactory.getLogger(NotificationManager.class); + private static final Queue popups = new LinkedBlockingQueue<>(5); + private static Notification displayedPopup; + + public static void queueForDisplay(Notification popup) { + boolean result = popups.offer(popup); + if (!result) + log.warn("The capacity is full with popups in the queue.\n\t" + + "Not added new popup=" + popup); + displayNext(); + } + + public static void onHidden(Notification popup) { + if (displayedPopup == null || displayedPopup == popup) { + displayedPopup = null; + displayNext(); + } else { + log.warn("We got a isHidden called with a wrong popup.\n\t" + + "popup (argument)=" + popup + "\n\tdisplayedPopup=" + displayedPopup); + } + } + + private static void displayNext() { + if (displayedPopup == null) { + if (!popups.isEmpty()) { + displayedPopup = popups.poll(); + displayedPopup.onReadyForDisplay(); + } + } + } +} diff --git a/gui/src/main/java/io/bitsquare/gui/main/overlays/popups/Popup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/popups/Popup.java new file mode 100644 index 0000000000..127f25d837 --- /dev/null +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/popups/Popup.java @@ -0,0 +1,40 @@ +/* + * This file is part of Bitsquare. + * + * Bitsquare is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bitsquare is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bitsquare. If not, see . + */ + +package io.bitsquare.gui.main.overlays.popups; + +import io.bitsquare.gui.main.overlays.Overlay; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Popup extends Overlay { + protected final Logger log = LoggerFactory.getLogger(this.getClass()); + + public void onReadyForDisplay() { + super.display(); + } + + @Override + protected void onShow() { + PopupManager.queueForDisplay(this); + } + + @Override + protected void onHidden() { + PopupManager.onHidden(this); + } +} diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/PopupManager.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/popups/PopupManager.java similarity index 81% rename from gui/src/main/java/io/bitsquare/gui/main/popups/PopupManager.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/popups/PopupManager.java index 0da8417347..329de06c50 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/PopupManager.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/popups/PopupManager.java @@ -1,4 +1,4 @@ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays.popups; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -6,12 +6,12 @@ import org.slf4j.LoggerFactory; import java.util.Queue; import java.util.concurrent.LinkedBlockingQueue; -class PopupManager { +public class PopupManager { private static final Logger log = LoggerFactory.getLogger(PopupManager.class); - private static final Queue popups = new LinkedBlockingQueue<>(3); + private static final Queue popups = new LinkedBlockingQueue<>(5); private static Popup displayedPopup; - static void queueForDisplay(Popup popup) { + public static void queueForDisplay(Popup popup) { boolean result = popups.offer(popup); if (!result) log.warn("The capacity is full with popups in the queue.\n\t" + @@ -19,7 +19,7 @@ class PopupManager { displayNext(); } - static void isHidden(Popup popup) { + public static void onHidden(Popup popup) { if (displayedPopup == null || displayedPopup == popup) { displayedPopup = null; displayNext(); @@ -33,7 +33,7 @@ class PopupManager { if (displayedPopup == null) { if (!popups.isEmpty()) { displayedPopup = popups.poll(); - displayedPopup.display(); + displayedPopup.onReadyForDisplay(); } } } diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/ContractPopup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/ContractWindow.java similarity index 95% rename from gui/src/main/java/io/bitsquare/gui/main/popups/ContractPopup.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/windows/ContractWindow.java index 05b5a47069..282c6e369e 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/ContractPopup.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/ContractWindow.java @@ -15,10 +15,11 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays.windows; import com.google.common.base.Joiner; import io.bitsquare.arbitration.Dispute; +import io.bitsquare.gui.main.overlays.Overlay; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.Layout; import io.bitsquare.locale.BSResources; @@ -38,12 +39,11 @@ import org.slf4j.LoggerFactory; import javax.inject.Inject; import java.util.List; -import java.util.Optional; import static io.bitsquare.gui.util.FormBuilder.*; -public class ContractPopup extends Popup { - protected static final Logger log = LoggerFactory.getLogger(ContractPopup.class); +public class ContractWindow extends Overlay { + protected static final Logger log = LoggerFactory.getLogger(ContractWindow.class); private final BSFormatter formatter; private Dispute dispute; @@ -54,11 +54,11 @@ public class ContractPopup extends Popup { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public ContractPopup(BSFormatter formatter) { + public ContractWindow(BSFormatter formatter) { this.formatter = formatter; } - public ContractPopup show(Dispute dispute) { + public void show(Dispute dispute) { this.dispute = dispute; rowIndex = -1; @@ -66,12 +66,6 @@ public class ContractPopup extends Popup { createGridPane(); addContent(); display(); - return this; - } - - public ContractPopup onClose(Runnable closeHandler) { - this.closeHandlerOptional = Optional.of(closeHandler); - return this; } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/DisplayAlertMessagePopup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/DisplayAlertMessageWindow.java similarity index 84% rename from gui/src/main/java/io/bitsquare/gui/main/popups/DisplayAlertMessagePopup.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/windows/DisplayAlertMessageWindow.java index 105ace21b2..002e3a4a1c 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/DisplayAlertMessagePopup.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/DisplayAlertMessageWindow.java @@ -15,27 +15,24 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays.windows; import io.bitsquare.alert.Alert; import io.bitsquare.common.util.Utilities; import io.bitsquare.gui.components.HyperlinkWithIcon; +import io.bitsquare.gui.main.overlays.Overlay; import javafx.geometry.Insets; import javafx.scene.control.Button; -import javafx.scene.control.Label; import javafx.scene.layout.GridPane; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Optional; - import static com.google.common.base.Preconditions.checkNotNull; import static io.bitsquare.gui.util.FormBuilder.addLabelHyperlinkWithIcon; import static io.bitsquare.gui.util.FormBuilder.addMultilineLabel; -public class DisplayAlertMessagePopup extends Popup { - private static final Logger log = LoggerFactory.getLogger(DisplayAlertMessagePopup.class); - private Label msgLabel; +public class DisplayAlertMessageWindow extends Overlay { + private static final Logger log = LoggerFactory.getLogger(DisplayAlertMessageWindow.class); private Alert alert; @@ -43,7 +40,7 @@ public class DisplayAlertMessagePopup extends Popup { // Public API /////////////////////////////////////////////////////////////////////////////////////////// - public DisplayAlertMessagePopup() { + public DisplayAlertMessageWindow() { } public void show() { @@ -55,26 +52,21 @@ public class DisplayAlertMessagePopup extends Popup { addSeparator(); addContent(); applyStyles(); - PopupManager.queueForDisplay(this); + display(); } - public DisplayAlertMessagePopup alertMessage(Alert alert) { + public DisplayAlertMessageWindow alertMessage(Alert alert) { this.alert = alert; return this; } - public DisplayAlertMessagePopup onClose(Runnable closeHandler) { - this.closeHandlerOptional = Optional.of(closeHandler); - return this; - } - /////////////////////////////////////////////////////////////////////////////////////////// // Protected /////////////////////////////////////////////////////////////////////////////////////////// private void addContent() { checkNotNull(alert, "alertMessage must not be null"); - msgLabel = addMultilineLabel(gridPane, ++rowIndex, alert.message, 10); + addMultilineLabel(gridPane, ++rowIndex, alert.message, 10); if (alert.isUpdateInfo) { headLine = "Important update information!"; headLineLabel.setStyle("-fx-text-fill: -fx-accent; -fx-font-weight: bold; -fx-font-size: 22;"); diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/DisputeSummaryPopup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/DisputeSummaryWindow.java similarity index 97% rename from gui/src/main/java/io/bitsquare/gui/main/popups/DisputeSummaryPopup.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/windows/DisputeSummaryWindow.java index 7d4e0c140f..fc9786da69 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/DisputeSummaryPopup.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/DisputeSummaryWindow.java @@ -15,7 +15,7 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays.windows; import io.bitsquare.arbitration.Dispute; import io.bitsquare.arbitration.DisputeManager; @@ -26,6 +26,8 @@ import io.bitsquare.btc.TradeWalletService; import io.bitsquare.btc.WalletService; import io.bitsquare.btc.exceptions.TransactionVerificationException; import io.bitsquare.common.util.Tuple2; +import io.bitsquare.gui.main.overlays.Overlay; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.Layout; import io.bitsquare.gui.util.Transitions; @@ -53,9 +55,9 @@ import java.util.Optional; import static io.bitsquare.gui.util.FormBuilder.*; -public class DisputeSummaryPopup extends Popup { - private static final Logger log = LoggerFactory.getLogger(DisputeSummaryPopup.class); - +public class DisputeSummaryWindow extends Overlay { + private static final Logger log = LoggerFactory.getLogger(DisputeSummaryWindow.class); + private final BSFormatter formatter; private final DisputeManager disputeManager; private final WalletService walletService; @@ -83,7 +85,7 @@ public class DisputeSummaryPopup extends Popup { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public DisputeSummaryPopup(BSFormatter formatter, DisputeManager disputeManager, WalletService walletService, TradeWalletService tradeWalletService) { + public DisputeSummaryWindow(BSFormatter formatter, DisputeManager disputeManager, WalletService walletService, TradeWalletService tradeWalletService) { this.formatter = formatter; this.disputeManager = disputeManager; this.walletService = walletService; @@ -97,15 +99,10 @@ public class DisputeSummaryPopup extends Popup { width = 850; createGridPane(); addContent(); - PopupManager.queueForDisplay(this); + display(); } - public DisputeSummaryPopup onClose(Runnable closeHandler) { - this.closeHandlerOptional = Optional.of(closeHandler); - return this; - } - - public DisputeSummaryPopup onFinalizeDispute(Runnable finalizeDisputeHandler) { + public DisputeSummaryWindow onFinalizeDispute(Runnable finalizeDisputeHandler) { this.finalizeDisputeHandlerOptional = Optional.of(finalizeDisputeHandler); return this; } diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/EmptyWalletPopup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/EmptyWalletWindow.java similarity index 91% rename from gui/src/main/java/io/bitsquare/gui/main/popups/EmptyWalletPopup.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/windows/EmptyWalletWindow.java index 68684dcd58..dd0240918d 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/EmptyWalletPopup.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/EmptyWalletWindow.java @@ -15,12 +15,14 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays.windows; import io.bitsquare.btc.Restrictions; import io.bitsquare.btc.WalletService; import io.bitsquare.common.util.Tuple2; import io.bitsquare.gui.components.InputTextField; +import io.bitsquare.gui.main.overlays.Overlay; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.Transitions; import javafx.geometry.Insets; @@ -39,14 +41,13 @@ import org.spongycastle.crypto.params.KeyParameter; import javax.inject.Inject; import java.time.Duration; -import java.util.Optional; import static io.bitsquare.gui.util.FormBuilder.*; -public class EmptyWalletPopup extends Popup { - private static final Logger log = LoggerFactory.getLogger(EmptyWalletPopup.class); +public class EmptyWalletWindow extends Overlay { + private static final Logger log = LoggerFactory.getLogger(EmptyWalletWindow.class); private final WalletService walletService; - private final WalletPasswordPopup walletPasswordPopup; + private final WalletPasswordWindow walletPasswordWindow; private final BSFormatter formatter; private Button emptyWalletButton; private InputTextField addressInputTextField; @@ -58,9 +59,9 @@ public class EmptyWalletPopup extends Popup { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public EmptyWalletPopup(WalletService walletService, WalletPasswordPopup walletPasswordPopup, BSFormatter formatter) { + public EmptyWalletWindow(WalletService walletService, WalletPasswordWindow walletPasswordWindow, BSFormatter formatter) { this.walletService = walletService; - this.walletPasswordPopup = walletPasswordPopup; + this.walletPasswordWindow = walletPasswordWindow; this.formatter = formatter; } @@ -74,12 +75,7 @@ public class EmptyWalletPopup extends Popup { addSeparator(); addContent(); applyStyles(); - PopupManager.queueForDisplay(this); - } - - public EmptyWalletPopup onClose(Runnable closeHandler) { - this.closeHandlerOptional = Optional.of(closeHandler); - return this; + display(); } /////////////////////////////////////////////////////////////////////////////////////////// @@ -106,7 +102,7 @@ public class EmptyWalletPopup extends Popup { emptyWalletButton.setOnAction(e -> { if (addressInputTextField.getText().length() > 0 && isBalanceSufficient) { if (walletService.getWallet().isEncrypted()) { - walletPasswordPopup + walletPasswordWindow .onClose(() -> blurAgain()) .onAesKey(aesKey -> doEmptyWallet(aesKey)) .show(); diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/EnterPrivKeyPopup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/EnterPrivKeyWindow.java similarity index 91% rename from gui/src/main/java/io/bitsquare/gui/main/popups/EnterPrivKeyPopup.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/windows/EnterPrivKeyWindow.java index e83be636b6..dd681d21d4 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/EnterPrivKeyPopup.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/EnterPrivKeyWindow.java @@ -15,10 +15,12 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays.windows; import io.bitsquare.app.BitsquareApp; import io.bitsquare.gui.components.InputTextField; +import io.bitsquare.gui.main.overlays.Overlay; +import io.bitsquare.gui.main.overlays.popups.Popup; import javafx.beans.value.ChangeListener; import javafx.geometry.Insets; import javafx.scene.control.Button; @@ -26,9 +28,7 @@ import javafx.scene.control.Label; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; -import java.util.Optional; - -public class EnterPrivKeyPopup extends Popup { +public class EnterPrivKeyWindow extends Overlay { private Button unlockButton; private InputTextField keyInputTextField; private PrivKeyHandler privKeyHandler; @@ -48,7 +48,7 @@ public class EnterPrivKeyPopup extends Popup { // Public API /////////////////////////////////////////////////////////////////////////////////////////// - public EnterPrivKeyPopup() { + public EnterPrivKeyWindow() { if (keyInputTextField != null) keyInputTextField.textProperty().addListener(changeListener); } @@ -68,15 +68,10 @@ public class EnterPrivKeyPopup extends Popup { addInputFields(); addButtons(); applyStyles(); - PopupManager.queueForDisplay(this); + display(); } - public EnterPrivKeyPopup onClose(Runnable closeHandler) { - this.closeHandlerOptional = Optional.of(closeHandler); - return this; - } - - public EnterPrivKeyPopup onKey(PrivKeyHandler privKeyHandler) { + public EnterPrivKeyWindow onKey(PrivKeyHandler privKeyHandler) { this.privKeyHandler = privKeyHandler; return this; } diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/OfferDetailsPopup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/OfferDetailsWindow.java similarity index 88% rename from gui/src/main/java/io/bitsquare/gui/main/popups/OfferDetailsPopup.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/windows/OfferDetailsWindow.java index cc7ef36efb..ae9ac492b2 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/OfferDetailsPopup.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/OfferDetailsWindow.java @@ -15,7 +15,7 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays.windows; import com.google.common.base.Joiner; import io.bitsquare.common.crypto.KeyRing; @@ -25,6 +25,8 @@ import io.bitsquare.gui.main.MainView; import io.bitsquare.gui.main.account.AccountView; import io.bitsquare.gui.main.account.content.arbitratorselection.ArbitratorSelectionView; import io.bitsquare.gui.main.account.settings.AccountSettingsView; +import io.bitsquare.gui.main.overlays.Overlay; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.Layout; import io.bitsquare.locale.BSResources; @@ -37,6 +39,7 @@ import javafx.geometry.Insets; import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.scene.control.Tooltip; +import javafx.scene.image.ImageView; import org.bitcoinj.core.Coin; import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; @@ -49,8 +52,8 @@ import java.util.function.Consumer; import static io.bitsquare.gui.util.FormBuilder.*; -public class OfferDetailsPopup extends Popup { - protected static final Logger log = LoggerFactory.getLogger(OfferDetailsPopup.class); +public class OfferDetailsWindow extends Overlay { + protected static final Logger log = LoggerFactory.getLogger(OfferDetailsWindow.class); private final BSFormatter formatter; protected final Preferences preferences; @@ -68,7 +71,7 @@ public class OfferDetailsPopup extends Popup { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public OfferDetailsPopup(BSFormatter formatter, Preferences preferences, User user, KeyRing keyRing, Navigation navigation) { + public OfferDetailsWindow(BSFormatter formatter, Preferences preferences, User user, KeyRing keyRing, Navigation navigation) { this.formatter = formatter; this.preferences = preferences; this.user = user; @@ -76,7 +79,7 @@ public class OfferDetailsPopup extends Popup { this.navigation = navigation; } - public OfferDetailsPopup show(Offer offer, Coin tradeAmount) { + public void show(Offer offer, Coin tradeAmount) { this.offer = offer; this.tradeAmount = tradeAmount; @@ -85,39 +88,28 @@ public class OfferDetailsPopup extends Popup { createGridPane(); addContent(); display(); - return this; } - public OfferDetailsPopup show(Offer offer) { + public void show(Offer offer) { this.offer = offer; - rowIndex = -1; width = 850; createGridPane(); addContent(); display(); - return this; } - public OfferDetailsPopup dontShowAgainId(String dontShowAgainId) { - this.dontShowAgainId = dontShowAgainId; - return this; - } - public OfferDetailsPopup onPlaceOffer(Consumer placeOfferHandler) { + public OfferDetailsWindow onPlaceOffer(Consumer placeOfferHandler) { this.placeOfferHandlerOptional = Optional.of(placeOfferHandler); return this; } - public OfferDetailsPopup onTakeOffer(Runnable takeOfferHandler) { + public OfferDetailsWindow onTakeOffer(Runnable takeOfferHandler) { this.takeOfferHandlerOptional = Optional.of(takeOfferHandler); return this; } - public OfferDetailsPopup onClose(Runnable closeHandler) { - this.closeHandlerOptional = Optional.of(closeHandler); - return this; - } /////////////////////////////////////////////////////////////////////////////////////////// @@ -241,15 +233,23 @@ public class OfferDetailsPopup extends Popup { @NotNull private void addConfirmAndCancelButtons(boolean isPlaceOffer) { + boolean isBuyOffer = offer.getDirection() == Offer.Direction.BUY; + boolean isBuyerRole = isPlaceOffer ? isBuyOffer : !isBuyOffer; + + String placeOffer = isBuyerRole ? "Confirm place offer for buying bitcoin" : "Confirm place offer for selling bitcoin"; + String takeOffer = isBuyerRole ? "Confirm take offer for buying bitcoin" : "Confirm take offer for selling bitcoin"; Tuple2 tuple = add2ButtonsAfterGroup(gridPane, ++rowIndex, - isPlaceOffer ? "Confirm place offer" : "Confirm take offer", + isPlaceOffer ? placeOffer : takeOffer, "Cancel"); Button placeButton = tuple.first; - boolean isBuyOffer = offer.getDirection() == Offer.Direction.BUY; - boolean isBuyStyle = isPlaceOffer ? isBuyOffer : !isBuyOffer; - placeButton.setId(isBuyStyle ? "buy-button" : "sell-button"); + ImageView iconView = new ImageView(); + iconView.setId(isBuyerRole ? "image-buy-white" : "image-sell-white"); + placeButton.setGraphicTextGap(10); + placeButton.setGraphic(iconView); + + placeButton.setId(isBuyerRole ? "buy-button" : "sell-button"); placeButton.setOnAction(e -> { if (user.getAcceptedArbitrators().size() > 0) { diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/OpenEmergencyTicketPopup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/OpenEmergencyTicketWindow.java similarity index 86% rename from gui/src/main/java/io/bitsquare/gui/main/popups/OpenEmergencyTicketPopup.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/windows/OpenEmergencyTicketWindow.java index 3e11e4d327..983223fabe 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/OpenEmergencyTicketPopup.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/OpenEmergencyTicketWindow.java @@ -15,9 +15,10 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays.windows; import io.bitsquare.common.handlers.ResultHandler; +import io.bitsquare.gui.main.overlays.Overlay; import javafx.geometry.Insets; import javafx.scene.control.Button; import javafx.scene.layout.GridPane; @@ -25,12 +26,10 @@ import javafx.scene.layout.HBox; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Optional; - import static io.bitsquare.gui.util.FormBuilder.addMultilineLabel; -public class OpenEmergencyTicketPopup extends Popup { - private static final Logger log = LoggerFactory.getLogger(OpenEmergencyTicketPopup.class); +public class OpenEmergencyTicketWindow extends Overlay { + private static final Logger log = LoggerFactory.getLogger(OpenEmergencyTicketWindow.class); private Button openTicketButton; private ResultHandler openTicketHandler; @@ -39,7 +38,7 @@ public class OpenEmergencyTicketPopup extends Popup { // Public API /////////////////////////////////////////////////////////////////////////////////////////// - public OpenEmergencyTicketPopup() { + public OpenEmergencyTicketWindow() { } public void show() { @@ -52,18 +51,14 @@ public class OpenEmergencyTicketPopup extends Popup { addSeparator(); addContent(); applyStyles(); - PopupManager.queueForDisplay(this); + display(); } - public OpenEmergencyTicketPopup onOpenTicket(ResultHandler openTicketHandler) { + public OpenEmergencyTicketWindow onOpenTicket(ResultHandler openTicketHandler) { this.openTicketHandler = openTicketHandler; return this; } - public OpenEmergencyTicketPopup onClose(Runnable closeHandler) { - this.closeHandlerOptional = Optional.of(closeHandler); - return this; - } /////////////////////////////////////////////////////////////////////////////////////////// // Protected diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/SelectDepositTxPopup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/SelectDepositTxWindow.java similarity index 90% rename from gui/src/main/java/io/bitsquare/gui/main/popups/SelectDepositTxPopup.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/windows/SelectDepositTxWindow.java index 451e279dc9..fab1a3ddd7 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/SelectDepositTxPopup.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/SelectDepositTxWindow.java @@ -15,9 +15,10 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays.windows; import io.bitsquare.common.util.Tuple2; +import io.bitsquare.gui.main.overlays.Overlay; import javafx.collections.FXCollections; import javafx.geometry.Insets; import javafx.scene.control.ComboBox; @@ -36,8 +37,8 @@ import java.util.function.Consumer; import static io.bitsquare.gui.util.FormBuilder.addLabelComboBox; import static io.bitsquare.gui.util.FormBuilder.addMultilineLabel; -public class SelectDepositTxPopup extends Popup { - private static final Logger log = LoggerFactory.getLogger(SelectDepositTxPopup.class); +public class SelectDepositTxWindow extends Overlay { + private static final Logger log = LoggerFactory.getLogger(SelectDepositTxWindow.class); private ComboBox transactionsComboBox; private List transaction; private Optional> selectHandlerOptional; @@ -48,7 +49,7 @@ public class SelectDepositTxPopup extends Popup { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public SelectDepositTxPopup() { + public SelectDepositTxWindow() { } public void show() { @@ -62,15 +63,15 @@ public class SelectDepositTxPopup extends Popup { addContent(); addCloseButton(); applyStyles(); - PopupManager.queueForDisplay(this); + display(); } - public SelectDepositTxPopup onSelect(Consumer selectHandler) { + public SelectDepositTxWindow onSelect(Consumer selectHandler) { this.selectHandlerOptional = Optional.of(selectHandler); return this; } - public SelectDepositTxPopup transactions(List transaction) { + public SelectDepositTxWindow transactions(List transaction) { this.transaction = transaction; return this; } diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/SendAlertMessagePopup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/SendAlertMessageWindow.java similarity index 89% rename from gui/src/main/java/io/bitsquare/gui/main/popups/SendAlertMessagePopup.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/windows/SendAlertMessageWindow.java index b2e679d9df..934d380dcf 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/SendAlertMessagePopup.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/SendAlertMessageWindow.java @@ -15,12 +15,14 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays.windows; import io.bitsquare.alert.Alert; import io.bitsquare.app.BitsquareApp; import io.bitsquare.common.util.Tuple2; import io.bitsquare.gui.components.InputTextField; +import io.bitsquare.gui.main.overlays.Overlay; +import io.bitsquare.gui.main.overlays.popups.Popup; import javafx.geometry.Insets; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; @@ -31,12 +33,10 @@ import javafx.scene.layout.HBox; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Optional; - import static io.bitsquare.gui.util.FormBuilder.*; -public class SendAlertMessagePopup extends Popup { - private static final Logger log = LoggerFactory.getLogger(SendAlertMessagePopup.class); +public class SendAlertMessageWindow extends Overlay { + private static final Logger log = LoggerFactory.getLogger(SendAlertMessageWindow.class); private Button sendButton; private SendAlertMessageHandler sendAlertMessageHandler; private RemoveAlertMessageHandler removeAlertMessageHandler; @@ -58,7 +58,7 @@ public class SendAlertMessagePopup extends Popup { // Public API /////////////////////////////////////////////////////////////////////////////////////////// - public SendAlertMessagePopup() { + public SendAlertMessageWindow() { } public void show() { @@ -71,24 +71,19 @@ public class SendAlertMessagePopup extends Popup { addSeparator(); addContent(); applyStyles(); - PopupManager.queueForDisplay(this); + display(); } - public SendAlertMessagePopup onAddAlertMessage(SendAlertMessageHandler sendAlertMessageHandler) { + public SendAlertMessageWindow onAddAlertMessage(SendAlertMessageHandler sendAlertMessageHandler) { this.sendAlertMessageHandler = sendAlertMessageHandler; return this; } - public SendAlertMessagePopup onRemoveAlertMessage(RemoveAlertMessageHandler removeAlertMessageHandler) { + public SendAlertMessageWindow onRemoveAlertMessage(RemoveAlertMessageHandler removeAlertMessageHandler) { this.removeAlertMessageHandler = removeAlertMessageHandler; return this; } - public SendAlertMessagePopup onClose(Runnable closeHandler) { - this.closeHandlerOptional = Optional.of(closeHandler); - return this; - } - /////////////////////////////////////////////////////////////////////////////////////////// // Protected /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/TacPopup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/TacWindow.java similarity index 90% rename from gui/src/main/java/io/bitsquare/gui/main/popups/TacPopup.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/windows/TacWindow.java index f7466e36c4..22413d4abc 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/TacPopup.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/TacWindow.java @@ -1,21 +1,23 @@ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays.windows; import com.google.inject.Inject; import io.bitsquare.app.BitsquareApp; import io.bitsquare.btc.BitcoinNetwork; import io.bitsquare.common.UserThread; +import io.bitsquare.gui.main.overlays.Overlay; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.user.Preferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit; -public class TacPopup extends Popup { - private static final Logger log = LoggerFactory.getLogger(TacPopup.class); +public class TacWindow extends Overlay { + private static final Logger log = LoggerFactory.getLogger(TacWindow.class); private final Preferences preferences; @Inject - public TacPopup(Preferences preferences) { + public TacWindow(Preferences preferences) { this.preferences = preferences; } @@ -60,4 +62,10 @@ public class TacPopup extends Popup { super.show(); } } + + @Override + protected void onShow() { + display(); + } + } diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/TradeDetailsPopup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/TradeDetailsWindow.java similarity index 95% rename from gui/src/main/java/io/bitsquare/gui/main/popups/TradeDetailsPopup.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/windows/TradeDetailsWindow.java index 9799cf9b39..81eeb781ee 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/TradeDetailsPopup.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/TradeDetailsWindow.java @@ -15,9 +15,10 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays.windows; import io.bitsquare.arbitration.DisputeManager; +import io.bitsquare.gui.main.overlays.Overlay; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.Layout; import io.bitsquare.locale.BSResources; @@ -38,12 +39,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.inject.Inject; -import java.util.Optional; import static io.bitsquare.gui.util.FormBuilder.*; -public class TradeDetailsPopup extends Popup { - protected static final Logger log = LoggerFactory.getLogger(TradeDetailsPopup.class); +public class TradeDetailsWindow extends Overlay { + protected static final Logger log = LoggerFactory.getLogger(TradeDetailsWindow.class); private final BSFormatter formatter; private final DisputeManager disputeManager; @@ -58,13 +58,13 @@ public class TradeDetailsPopup extends Popup { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public TradeDetailsPopup(BSFormatter formatter, DisputeManager disputeManager, TradeManager tradeManager) { + public TradeDetailsWindow(BSFormatter formatter, DisputeManager disputeManager, TradeManager tradeManager) { this.formatter = formatter; this.disputeManager = disputeManager; this.tradeManager = tradeManager; } - public TradeDetailsPopup show(Trade trade) { + public void show(Trade trade) { this.trade = trade; rowIndex = -1; @@ -72,13 +72,8 @@ public class TradeDetailsPopup extends Popup { createGridPane(); addContent(); display(); - return this; } - public TradeDetailsPopup onClose(Runnable closeHandler) { - this.closeHandlerOptional = Optional.of(closeHandler); - return this; - } /////////////////////////////////////////////////////////////////////////////////////////// // Protected diff --git a/gui/src/main/java/io/bitsquare/gui/main/popups/WalletPasswordPopup.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/WalletPasswordWindow.java similarity index 92% rename from gui/src/main/java/io/bitsquare/gui/main/popups/WalletPasswordPopup.java rename to gui/src/main/java/io/bitsquare/gui/main/overlays/windows/WalletPasswordWindow.java index 0e330a1507..8668ba038d 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/popups/WalletPasswordPopup.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/WalletPasswordWindow.java @@ -15,11 +15,13 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.popups; +package io.bitsquare.gui.main.overlays.windows; import io.bitsquare.btc.WalletService; import io.bitsquare.crypto.ScryptUtil; import io.bitsquare.gui.components.PasswordTextField; +import io.bitsquare.gui.main.overlays.Overlay; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.gui.util.Transitions; import io.bitsquare.gui.util.validation.PasswordValidator; import javafx.beans.value.ChangeListener; @@ -37,10 +39,9 @@ import org.spongycastle.crypto.params.KeyParameter; import javax.inject.Inject; import java.time.Duration; -import java.util.Optional; -public class WalletPasswordPopup extends Popup { - private static final Logger log = LoggerFactory.getLogger(WalletPasswordPopup.class); +public class WalletPasswordWindow extends Overlay { + private static final Logger log = LoggerFactory.getLogger(WalletPasswordWindow.class); private final WalletService walletService; private Button unlockButton; private AesKeyHandler aesKeyHandler; @@ -68,7 +69,7 @@ public class WalletPasswordPopup extends Popup { } @Inject - public WalletPasswordPopup(WalletService walletService) { + public WalletPasswordWindow(WalletService walletService) { this.walletService = walletService; } @@ -87,15 +88,11 @@ public class WalletPasswordPopup extends Popup { addInputFields(); addButtons(); applyStyles(); - PopupManager.queueForDisplay(this); + display(); } - public WalletPasswordPopup onClose(Runnable closeHandler) { - this.closeHandlerOptional = Optional.of(closeHandler); - return this; - } - public WalletPasswordPopup onAesKey(AesKeyHandler aesKeyHandler) { + public WalletPasswordWindow onAesKey(AesKeyHandler aesKeyHandler) { this.aesKeyHandler = aesKeyHandler; return this; } diff --git a/gui/src/main/java/io/bitsquare/gui/main/portfolio/closedtrades/ClosedTradesView.java b/gui/src/main/java/io/bitsquare/gui/main/portfolio/closedtrades/ClosedTradesView.java index 84e3cfd872..e69dfcc45c 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/portfolio/closedtrades/ClosedTradesView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/portfolio/closedtrades/ClosedTradesView.java @@ -20,8 +20,8 @@ package io.bitsquare.gui.main.portfolio.closedtrades; import io.bitsquare.gui.common.view.ActivatableViewAndModel; import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.components.HyperlinkWithIcon; -import io.bitsquare.gui.main.popups.OfferDetailsPopup; -import io.bitsquare.gui.main.popups.TradeDetailsPopup; +import io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow; +import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.trade.Tradable; import io.bitsquare.trade.Trade; @@ -43,15 +43,15 @@ public class ClosedTradesView extends ActivatableViewAndModel priceColumn, amountColumn, volumeColumn, directionColumn, dateColumn, tradeIdColumn, stateColumn; private final BSFormatter formatter; - private final OfferDetailsPopup offerDetailsPopup; - private final TradeDetailsPopup tradeDetailsPopup; + private final OfferDetailsWindow offerDetailsWindow; + private final TradeDetailsWindow tradeDetailsWindow; @Inject - public ClosedTradesView(ClosedTradesViewModel model, BSFormatter formatter, OfferDetailsPopup offerDetailsPopup, TradeDetailsPopup tradeDetailsPopup) { + public ClosedTradesView(ClosedTradesViewModel model, BSFormatter formatter, OfferDetailsWindow offerDetailsWindow, TradeDetailsWindow tradeDetailsWindow) { super(model); this.formatter = formatter; - this.offerDetailsPopup = offerDetailsPopup; - this.tradeDetailsPopup = tradeDetailsPopup; + this.offerDetailsWindow = offerDetailsWindow; + this.tradeDetailsWindow = tradeDetailsWindow; } @Override @@ -94,9 +94,9 @@ public class ClosedTradesView extends ActivatableViewAndModel { Tradable tradable = item.getTradable(); if (tradable instanceof Trade) - tradeDetailsPopup.show((Trade) tradable); + tradeDetailsWindow.show((Trade) tradable); else if (tradable instanceof OpenOffer) - offerDetailsPopup.show(tradable.getOffer()); + offerDetailsWindow.show(tradable.getOffer()); }); field.setTooltip(new Tooltip("Open popup for details")); setGraphic(field); diff --git a/gui/src/main/java/io/bitsquare/gui/main/portfolio/failedtrades/FailedTradesView.java b/gui/src/main/java/io/bitsquare/gui/main/portfolio/failedtrades/FailedTradesView.java index b2014df52d..667702ab0c 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/portfolio/failedtrades/FailedTradesView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/portfolio/failedtrades/FailedTradesView.java @@ -20,7 +20,7 @@ package io.bitsquare.gui.main.portfolio.failedtrades; import io.bitsquare.gui.common.view.ActivatableViewAndModel; import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.components.HyperlinkWithIcon; -import io.bitsquare.gui.main.popups.TradeDetailsPopup; +import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.fxml.FXML; import javafx.scene.control.*; @@ -37,12 +37,12 @@ public class FailedTradesView extends ActivatableViewAndModel priceColumn, amountColumn, volumeColumn, directionColumn, dateColumn, tradeIdColumn, stateColumn; - private final TradeDetailsPopup tradeDetailsPopup; + private final TradeDetailsWindow tradeDetailsWindow; @Inject - public FailedTradesView(FailedTradesViewModel model, TradeDetailsPopup tradeDetailsPopup) { + public FailedTradesView(FailedTradesViewModel model, TradeDetailsWindow tradeDetailsWindow) { super(model); - this.tradeDetailsPopup = tradeDetailsPopup; + this.tradeDetailsWindow = tradeDetailsWindow; } @Override @@ -81,7 +81,7 @@ public class FailedTradesView extends ActivatableViewAndModel tradeDetailsPopup.show(item.getTrade())); + field.setOnAction(event -> tradeDetailsWindow.show(item.getTrade())); field.setTooltip(new Tooltip("Open popup for details")); setGraphic(field); } else { diff --git a/gui/src/main/java/io/bitsquare/gui/main/portfolio/openoffer/OpenOffersView.java b/gui/src/main/java/io/bitsquare/gui/main/portfolio/openoffer/OpenOffersView.java index 4a8310cd12..59ac25b1e1 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/portfolio/openoffer/OpenOffersView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/portfolio/openoffer/OpenOffersView.java @@ -24,8 +24,8 @@ import io.bitsquare.gui.components.HyperlinkWithIcon; import io.bitsquare.gui.main.MainView; import io.bitsquare.gui.main.funds.FundsView; import io.bitsquare.gui.main.funds.withdrawal.WithdrawalView; -import io.bitsquare.gui.main.popups.OfferDetailsPopup; -import io.bitsquare.gui.main.popups.Popup; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow; import io.bitsquare.trade.offer.OpenOffer; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.fxml.FXML; @@ -45,13 +45,13 @@ public class OpenOffersView extends ActivatableViewAndModel priceColumn, amountColumn, volumeColumn, directionColumn, dateColumn, offerIdColumn, removeItemColumn; private final Navigation navigation; - private final OfferDetailsPopup offerDetailsPopup; + private final OfferDetailsWindow offerDetailsWindow; @Inject - public OpenOffersView(OpenOffersViewModel model, Navigation navigation, OfferDetailsPopup offerDetailsPopup) { + public OpenOffersView(OpenOffersViewModel model, Navigation navigation, OfferDetailsWindow offerDetailsWindow) { super(model); this.navigation = navigation; - this.offerDetailsPopup = offerDetailsPopup; + this.offerDetailsWindow = offerDetailsWindow; } @Override @@ -119,7 +119,7 @@ public class OpenOffersView extends ActivatableViewAndModel offerDetailsPopup.show(item.getOffer())); + field.setOnAction(event -> offerDetailsWindow.show(item.getOffer())); field.setTooltip(new Tooltip("Open popup for details")); setGraphic(field); } else { diff --git a/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/PendingTradesDataModel.java b/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/PendingTradesDataModel.java index b7da4a389c..4a7112a5e6 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/PendingTradesDataModel.java +++ b/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/PendingTradesDataModel.java @@ -32,9 +32,9 @@ import io.bitsquare.gui.Navigation; import io.bitsquare.gui.common.model.ActivatableDataModel; import io.bitsquare.gui.main.MainView; import io.bitsquare.gui.main.disputes.DisputesView; -import io.bitsquare.gui.main.notifications.NotificationCenter; -import io.bitsquare.gui.main.popups.SelectDepositTxPopup; -import io.bitsquare.gui.main.popups.WalletPasswordPopup; +import io.bitsquare.gui.main.overlays.notifications.NotificationCenter; +import io.bitsquare.gui.main.overlays.windows.SelectDepositTxWindow; +import io.bitsquare.gui.main.overlays.windows.WalletPasswordWindow; import io.bitsquare.payment.PaymentAccountContractData; import io.bitsquare.trade.BuyerTrade; import io.bitsquare.trade.SellerTrade; @@ -71,7 +71,7 @@ public class PendingTradesDataModel extends ActivatableDataModel { private final KeyRing keyRing; public final DisputeManager disputeManager; public final Navigation navigation; - private final WalletPasswordPopup walletPasswordPopup; + private final WalletPasswordWindow walletPasswordWindow; private final NotificationCenter notificationCenter; final ObservableList list = FXCollections.observableArrayList(); @@ -91,7 +91,7 @@ public class PendingTradesDataModel extends ActivatableDataModel { @Inject public PendingTradesDataModel(TradeManager tradeManager, WalletService walletService, TradeWalletService tradeWalletService, User user, KeyRing keyRing, DisputeManager disputeManager, Preferences preferences, - Navigation navigation, WalletPasswordPopup walletPasswordPopup, NotificationCenter notificationCenter) { + Navigation navigation, WalletPasswordWindow walletPasswordWindow, NotificationCenter notificationCenter) { this.tradeManager = tradeManager; this.walletService = walletService; this.tradeWalletService = tradeWalletService; @@ -100,7 +100,7 @@ public class PendingTradesDataModel extends ActivatableDataModel { this.disputeManager = disputeManager; this.preferences = preferences; this.navigation = navigation; - this.walletPasswordPopup = walletPasswordPopup; + this.walletPasswordWindow = walletPasswordWindow; this.notificationCenter = notificationCenter; tradesListChangeListener = change -> onListChanged(); @@ -150,7 +150,7 @@ public class PendingTradesDataModel extends ActivatableDataModel { public void onWithdrawRequest(String toAddress, ResultHandler resultHandler, FaultHandler faultHandler) { checkNotNull(getTrade(), "trade must not be null"); if (walletService.getWallet().isEncrypted()) { - walletPasswordPopup.onAesKey(aesKey -> doWithdrawRequest(toAddress, aesKey, resultHandler, faultHandler)).show(); + walletPasswordWindow.onAesKey(aesKey -> doWithdrawRequest(toAddress, aesKey, resultHandler, faultHandler)).show(); } else doWithdrawRequest(toAddress, null, resultHandler, faultHandler); } @@ -327,7 +327,7 @@ public class PendingTradesDataModel extends ActivatableDataModel { if (candidates.size() == 1) doOpenDispute(isSupportTicket, candidates.get(0)); else if (candidates.size() > 1) - new SelectDepositTxPopup().transactions(candidates) + new SelectDepositTxWindow().transactions(candidates) .onSelect(transaction -> doOpenDispute(isSupportTicket, transaction)) .closeButtonText("Cancel") .show(); diff --git a/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/PendingTradesView.java b/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/PendingTradesView.java index 54d05c26bc..be054509a5 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/PendingTradesView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/PendingTradesView.java @@ -22,8 +22,8 @@ import io.bitsquare.common.UserThread; import io.bitsquare.gui.common.view.ActivatableViewAndModel; import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.components.HyperlinkWithIcon; -import io.bitsquare.gui.main.popups.OpenEmergencyTicketPopup; -import io.bitsquare.gui.main.popups.TradeDetailsPopup; +import io.bitsquare.gui.main.overlays.windows.OpenEmergencyTicketWindow; +import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow; import io.bitsquare.gui.util.BSFormatter; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.event.EventHandler; @@ -49,7 +49,7 @@ import javax.inject.Inject; @FxmlView public class PendingTradesView extends ActivatableViewAndModel { - private final TradeDetailsPopup tradeDetailsPopup; + private final TradeDetailsWindow tradeDetailsWindow; private final BSFormatter formatter; @FXML TableView table; @@ -73,9 +73,9 @@ public class PendingTradesView extends ActivatableViewAndModel