Rename Overlay- and NaviagtionController

This commit is contained in:
Manfred Karrer 2014-09-15 15:29:27 +02:00
parent ed52955a19
commit 1a5d9b6d6c
11 changed files with 77 additions and 77 deletions

View File

@ -22,8 +22,8 @@ import io.bitsquare.btc.BlockChainFacade;
import io.bitsquare.btc.FeePolicy;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.crypto.CryptoFacade;
import io.bitsquare.gui.NavigationController;
import io.bitsquare.gui.OverlayController;
import io.bitsquare.gui.NavigationManager;
import io.bitsquare.gui.OverlayManager;
import io.bitsquare.gui.main.trade.orderbook.OrderBook;
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.gui.util.validation.BankAccountNumberValidator;
@ -71,8 +71,8 @@ public class BitSquareModule extends AbstractModule {
bind(TradeManager.class).asEagerSingleton();
bind(OrderBook.class).asEagerSingleton();
bind(NavigationController.class).asEagerSingleton();
bind(OverlayController.class).asEagerSingleton();
bind(NavigationManager.class).asEagerSingleton();
bind(OverlayManager.class).asEagerSingleton();
bind(BSFormatter.class).asEagerSingleton();
bind(BankAccountNumberValidator.class).asEagerSingleton();

View File

@ -25,8 +25,8 @@ import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class NavigationController {
private static final Logger log = LoggerFactory.getLogger(NavigationController.class);
public class NavigationManager {
private static final Logger log = LoggerFactory.getLogger(NavigationManager.class);
///////////////////////////////////////////////////////////////////////////////////////////
// Interface
@ -47,7 +47,7 @@ public class NavigationController {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public NavigationController() {
public NavigationManager() {
}
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -25,8 +25,8 @@ import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class OverlayController {
private static final Logger log = LoggerFactory.getLogger(OverlayController.class);
public class OverlayManager {
private static final Logger log = LoggerFactory.getLogger(OverlayManager.class);
private List<OverlayListener> listeners = new ArrayList<>();
@ -36,7 +36,7 @@ public class OverlayController {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public OverlayController() {
public OverlayManager() {
}
public void blurContent() {

View File

@ -18,7 +18,7 @@
package io.bitsquare.gui.components;
import io.bitsquare.BitSquare;
import io.bitsquare.gui.OverlayController;
import io.bitsquare.gui.OverlayManager;
import io.bitsquare.locale.BSResources;
import com.google.bitcoin.store.BlockStoreException;
@ -51,11 +51,11 @@ public class Popups {
private static final Logger log = LoggerFactory.getLogger(Popups.class);
// TODO just temporary, class will be removed completely
public static void setOverlayController(OverlayController overlayController) {
Popups.overlayController = overlayController;
public static void setOverlayManager(OverlayManager overlayManager) {
Popups.overlayManager = overlayManager;
}
private static OverlayController overlayController;
private static OverlayManager overlayManager;
// Information
public static void openInfo(String message) {
@ -64,7 +64,7 @@ public class Popups {
// Supports blurring the content background
public static void openInfo(String message, String masthead) {
overlayController.blurContent();
overlayManager.blurContent();
List<Action> actions = new ArrayList<>();
// Dialogs are a bit limited. There is no callback for the InformationDialog button click, so we added
@ -73,7 +73,7 @@ public class Popups {
@Override
public void handle(ActionEvent actionEvent) {
Dialog.Actions.CLOSE.handle(actionEvent);
overlayController.removeBlurContent();
overlayManager.removeBlurContent();
}
});
openInfo(message, masthead, actions);

View File

@ -17,7 +17,7 @@
package io.bitsquare.gui.components.btc;
import io.bitsquare.gui.OverlayController;
import io.bitsquare.gui.OverlayManager;
import io.bitsquare.gui.components.Popups;
import com.google.bitcoin.core.Coin;
@ -60,7 +60,7 @@ public class AddressTextField extends AnchorPane {
private final StringProperty address = new SimpleStringProperty();
private final StringProperty paymentLabel = new SimpleStringProperty();
public final ObjectProperty<Coin> amountAsCoin = new SimpleObjectProperty<>();
private OverlayController overlayController;
private OverlayManager overlayManager;
///////////////////////////////////////////////////////////////////////////////////////////
@ -125,16 +125,16 @@ public class AddressTextField extends AnchorPane {
popOver.setDetachedTitle("Scan QR code for this address");
popOver.setDetached(true);
popOver.setOnHiding(windowEvent -> {
if (overlayController != null)
overlayController.removeBlurContent();
if (overlayManager != null)
overlayManager.removeBlurContent();
});
Window window = getScene().getWindow();
double x = Math.round(window.getX() + (window.getWidth() - 320) / 2);
double y = Math.round(window.getY() + (window.getHeight() - 240) / 2);
popOver.show(getScene().getWindow(), x, y);
if (overlayController != null)
overlayController.blurContent();
if (overlayManager != null)
overlayManager.blurContent();
}
});
@ -188,8 +188,8 @@ public class AddressTextField extends AnchorPane {
}
// TODO find better solution
public void setOverlayController(OverlayController overlayController) {
this.overlayController = overlayController;
public void setOverlayManager(OverlayManager overlayManager) {
this.overlayManager = overlayManager;
}

View File

@ -19,9 +19,9 @@ package io.bitsquare.gui.main;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.gui.AWTSystemTray;
import io.bitsquare.gui.NavigationController;
import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.OverlayController;
import io.bitsquare.gui.NavigationManager;
import io.bitsquare.gui.OverlayManager;
import io.bitsquare.gui.ViewCB;
import io.bitsquare.gui.components.NetworkSyncPane;
import io.bitsquare.gui.components.Popups;
@ -53,8 +53,8 @@ import org.slf4j.LoggerFactory;
public class MainViewCB extends ViewCB<MainPM> {
private static final Logger log = LoggerFactory.getLogger(MainViewCB.class);
private final NavigationController navigationController;
private final OverlayController overlayController;
private final NavigationManager navigationManager;
private final OverlayManager overlayManager;
private final ToggleGroup navButtonsGroup = new ToggleGroup();
private NavigationItem mainNavigationItem;
@ -74,12 +74,12 @@ public class MainViewCB extends ViewCB<MainPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private MainViewCB(MainPM presentationModel, NavigationController navigationController,
OverlayController overlayController) {
private MainViewCB(MainPM presentationModel, NavigationManager navigationManager,
OverlayManager overlayManager) {
super(presentationModel);
this.navigationController = navigationController;
this.overlayController = overlayController;
this.navigationManager = navigationManager;
this.overlayManager = overlayManager;
}
@ -94,9 +94,9 @@ public class MainViewCB extends ViewCB<MainPM> {
Profiler.printMsgWithTime("MainController.initialize");
// just temp. ugly hack... Popups will be removed
Popups.setOverlayController(overlayController);
Popups.setOverlayManager(overlayManager);
navigationController.addListener(navigationItems -> {
navigationManager.addListener(navigationItems -> {
if (navigationItems != null) {
for (NavigationItem navigationItem : navigationItems) {
if (navigationItem.getLevel() == 1) {
@ -113,7 +113,7 @@ public class MainViewCB extends ViewCB<MainPM> {
selectMainMenuButton(mainNavigationItem);
});
overlayController.addListener(new OverlayController.OverlayListener() {
overlayManager.addListener(new OverlayManager.OverlayListener() {
@Override
public void onBlurContentRequested() {
Transitions.blur(baseApplicationContainer);
@ -204,14 +204,14 @@ public class MainViewCB extends ViewCB<MainPM> {
alertButton.setId("nav-alert-button");
alertButton.relocate(36, 19);
alertButton.setOnAction((e) ->
navigationController.navigationTo(NavigationItem.ORDERS, NavigationItem.PENDING_TRADE));
navigationManager.navigationTo(NavigationItem.ORDERS, NavigationItem.PENDING_TRADE));
Tooltip.install(alertButton, new Tooltip("Your offer has been accepted"));
ordersButtonButtonPane.getChildren().add(alertButton);
AWTSystemTray.setAlert();
});
navigationController.navigationTo(presentationModel.getSelectedNavigationItems());
navigationManager.navigationTo(presentationModel.getSelectedNavigationItems());
onContentAdded();
}

View File

@ -18,8 +18,8 @@
package io.bitsquare.gui.main.account;
import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.NavigationController;
import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.NavigationManager;
import io.bitsquare.gui.ViewCB;
import io.bitsquare.gui.main.account.setup.AccountSetupViewCB;
import io.bitsquare.util.ViewLoader;
@ -44,7 +44,7 @@ public class AccountViewCB extends CachedViewCB<AccountPM> {
private static final Logger log = LoggerFactory.getLogger(AccountViewCB.class);
public Tab tab;
private NavigationController navigationController;
private NavigationManager navigationManager;
///////////////////////////////////////////////////////////////////////////////////////////
@ -52,9 +52,9 @@ public class AccountViewCB extends CachedViewCB<AccountPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private AccountViewCB(AccountPM presentationModel, NavigationController navigationController) {
private AccountViewCB(AccountPM presentationModel, NavigationManager navigationManager) {
super(presentationModel);
this.navigationController = navigationController;
this.navigationManager = navigationManager;
}
@ -133,7 +133,7 @@ public class AccountViewCB extends CachedViewCB<AccountPM> {
private void removeSetup() {
childController = null;
navigationController.navigationTo(navigationController.getPreviousMainNavigationItems());
navigationManager.navigationTo(navigationManager.getPreviousMainNavigationItems());
}
}

View File

@ -18,7 +18,7 @@
package io.bitsquare.gui.main.account.content.registration;
import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.OverlayController;
import io.bitsquare.gui.OverlayManager;
import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.components.btc.AddressTextField;
import io.bitsquare.gui.components.btc.BalanceTextField;
@ -52,7 +52,7 @@ public class RegistrationViewCB extends CachedViewCB<RegistrationPM> implements
private static final Logger log = LoggerFactory.getLogger(RegistrationViewCB.class);
private OverlayController overlayController;
private OverlayManager overlayManager;
@FXML private TextField feeTextField;
@FXML private AddressTextField addressTextField;
@ -65,9 +65,9 @@ public class RegistrationViewCB extends CachedViewCB<RegistrationPM> implements
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private RegistrationViewCB(RegistrationPM presentationModel, OverlayController overlayController) {
private RegistrationViewCB(RegistrationPM presentationModel, OverlayManager overlayManager) {
super(presentationModel);
this.overlayController = overlayController;
this.overlayManager = overlayManager;
}
@ -85,7 +85,7 @@ public class RegistrationViewCB extends CachedViewCB<RegistrationPM> implements
addressTextField.setAddress(presentationModel.getAddressAsString());
// TODO find better solution
addressTextField.setOverlayController(overlayController);
addressTextField.setOverlayManager(overlayManager);
balanceTextField.setup(presentationModel.getWalletFacade(), presentationModel.address.get());
@ -101,7 +101,7 @@ public class RegistrationViewCB extends CachedViewCB<RegistrationPM> implements
presentationModel.showTransactionPublishedScreen.addListener((o, oldValue, newValue) -> {
if (newValue) {
overlayController.blurContent();
overlayManager.blurContent();
List<Action> actions = new ArrayList<>();
actions.add(new AbstractAction(BSResources.get("shared.copyTxId")) {
@ -123,7 +123,7 @@ public class RegistrationViewCB extends CachedViewCB<RegistrationPM> implements
e.printStackTrace();
}
Dialog.Actions.CLOSE.handle(actionEvent);
overlayController.removeBlurContent();
overlayManager.removeBlurContent();
}
});

View File

@ -18,8 +18,8 @@
package io.bitsquare.gui.main.account.settings;
import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.NavigationController;
import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.NavigationManager;
import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.ViewCB;
import io.bitsquare.gui.main.account.content.ContextAware;
@ -55,17 +55,17 @@ public class AccountSettingsViewCB extends CachedViewCB<AccountSettingsPM> {
public VBox leftVBox;
public AnchorPane content;
private MenuItem seedWords, password, restrictions, fiatAccount, registration;
private NavigationController navigationController;
private NavigationManager navigationManager;
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private AccountSettingsViewCB(AccountSettingsPM presentationModel, NavigationController navigationController) {
private AccountSettingsViewCB(AccountSettingsPM presentationModel, NavigationManager navigationManager) {
super(presentationModel);
this.navigationController = navigationController;
this.navigationManager = navigationManager;
}
@ -101,7 +101,7 @@ public class AccountSettingsViewCB extends CachedViewCB<AccountSettingsPM> {
public void activate() {
super.activate();
NavigationItem[] navigationItems = navigationController.getCurrentNavigationItems();
NavigationItem[] navigationItems = navigationManager.getCurrentNavigationItems();
for (int i = 0; i < navigationItems.length; i++) {
if (navigationItems[i].getLevel() == 3) {
subMenuNavigationItem = navigationItems[i];

View File

@ -19,9 +19,9 @@ package io.bitsquare.gui.main.trade.createoffer;
import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.CloseListener;
import io.bitsquare.gui.NavigationController;
import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.OverlayController;
import io.bitsquare.gui.NavigationManager;
import io.bitsquare.gui.OverlayManager;
import io.bitsquare.gui.components.InfoDisplay;
import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.components.Popups;
@ -74,8 +74,8 @@ import static javafx.beans.binding.Bindings.createStringBinding;
public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
private static final Logger log = LoggerFactory.getLogger(CreateOfferViewCB.class);
private NavigationController navigationController;
private OverlayController overlayController;
private NavigationManager navigationManager;
private OverlayManager overlayManager;
private CloseListener closeListener;
private boolean detailsVisible;
@ -109,11 +109,11 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private CreateOfferViewCB(CreateOfferPM presentationModel, NavigationController navigationController,
OverlayController overlayController) {
private CreateOfferViewCB(CreateOfferPM presentationModel, NavigationManager navigationManager,
OverlayManager overlayManager) {
super(presentationModel);
this.navigationController = navigationController;
this.overlayController = overlayController;
this.navigationManager = navigationManager;
this.overlayManager = overlayManager;
}
@ -237,7 +237,7 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
///////////////////////////////////////////////////////////////////////////////////////////
private void openAccountSettings() {
navigationController.navigationTo(NavigationItem.ACCOUNT,
navigationManager.navigationTo(NavigationItem.ACCOUNT,
NavigationItem.ACCOUNT_SETTINGS,
NavigationItem.RESTRICTIONS);
}
@ -312,7 +312,7 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
presentationModel.showTransactionPublishedScreen.addListener((o, oldValue, newValue) -> {
if (newValue) {
overlayController.blurContent();
overlayManager.blurContent();
// Dialogs are a bit limited. There is no callback for the InformationDialog button click, so we added
// our own actions.
@ -335,7 +335,7 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
e.printStackTrace();
}
Dialog.Actions.CLOSE.handle(actionEvent);
overlayController.removeBlurContent();
overlayManager.removeBlurContent();
}
});

View File

@ -18,10 +18,10 @@
package io.bitsquare.gui.main.trade.orderbook;
import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.NavigationController;
import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.NavigationListener;
import io.bitsquare.gui.OverlayController;
import io.bitsquare.gui.NavigationManager;
import io.bitsquare.gui.OverlayManager;
import io.bitsquare.gui.ViewCB;
import io.bitsquare.gui.ViewController;
import io.bitsquare.gui.components.InputTextField;
@ -70,8 +70,8 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
private static final Logger log = LoggerFactory.getLogger(OrderBookViewCB.class);
//TODO nav?
private NavigationController navigationController;
private OverlayController overlayController;
private NavigationManager navigationManager;
private OverlayManager overlayManager;
private OptionalBtcValidator optionalBtcValidator;
private OptionalFiatValidator optionalFiatValidator;
private NavigationListener navigationListener;
@ -101,14 +101,14 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
@Inject
private OrderBookViewCB(OrderBookPM presentationModel,
NavigationController navigationController,
OverlayController overlayController,
NavigationManager navigationManager,
OverlayManager overlayManager,
OptionalBtcValidator optionalBtcValidator,
OptionalFiatValidator optionalFiatValidator) {
super(presentationModel);
this.navigationController = navigationController;
this.overlayController = overlayController;
this.navigationManager = navigationManager;
this.overlayManager = overlayManager;
this.optionalBtcValidator = optionalBtcValidator;
this.optionalFiatValidator = optionalFiatValidator;
}
@ -262,14 +262,14 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
///////////////////////////////////////////////////////////////////////////////////////////
private void openSetupScreen() {
overlayController.blurContent();
overlayManager.blurContent();
List<Action> actions = new ArrayList<>();
actions.add(new AbstractAction(BSResources.get("shared.ok")) {
@Override
public void handle(ActionEvent actionEvent) {
Dialog.Actions.OK.handle(actionEvent);
overlayController.removeBlurContent();
navigationController.navigationTo(NavigationItem.ACCOUNT, NavigationItem.ACCOUNT_SETUP);
overlayManager.removeBlurContent();
navigationManager.navigationTo(NavigationItem.ACCOUNT, NavigationItem.ACCOUNT_SETUP);
}
});
Popups.openInfo("You need to setup your trading account before you can trade.",
@ -320,7 +320,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
actions);
if (response == Dialog.Actions.YES)
navigationController.navigationTo(NavigationItem.ACCOUNT, NavigationItem.ACCOUNT_SETTINGS,
navigationManager.navigationTo(NavigationItem.ACCOUNT, NavigationItem.ACCOUNT_SETTINGS,
NavigationItem.RESTRICTIONS);
else
orderBookTable.getSelectionModel().clearSelection();