mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-20 13:54:32 +01:00
Refactor navigation
This commit is contained in:
parent
0403eb82e5
commit
1db44639bf
46 changed files with 477 additions and 219 deletions
|
@ -22,7 +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.view.MainViewCB;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.OverlayController;
|
||||
import io.bitsquare.msg.BootstrappedPeerFactory;
|
||||
import io.bitsquare.msg.MessageFacade;
|
||||
import io.bitsquare.msg.P2PNode;
|
||||
|
@ -64,7 +65,8 @@ public class BitSquareModule extends AbstractModule {
|
|||
bind(BootstrappedPeerFactory.class).asEagerSingleton();
|
||||
|
||||
bind(TradeManager.class).asEagerSingleton();
|
||||
bind(MainViewCB.class).asEagerSingleton();
|
||||
bind(NavigationController.class).asEagerSingleton();
|
||||
bind(OverlayController.class).asEagerSingleton();
|
||||
|
||||
|
||||
//bind(String.class).annotatedWith(Names.named("networkType")).toInstance(WalletFacade.MAIN_NET);
|
||||
|
|
90
src/main/java/io/bitsquare/gui/NavigationController.java
Normal file
90
src/main/java/io/bitsquare/gui/NavigationController.java
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class NavigationController {
|
||||
private static final Logger log = LoggerFactory.getLogger(NavigationController.class);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public interface NavigationListener {
|
||||
void onNavigationRequested(NavigationItem... navigationItems);
|
||||
}
|
||||
|
||||
|
||||
private List<NavigationListener> listeners = new ArrayList<>();
|
||||
private NavigationItem[] previousMainNavigationItems;
|
||||
private NavigationItem[] currentNavigationItems;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public NavigationController() {
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void navigationTo(NavigationItem... navigationItems) {
|
||||
previousMainNavigationItems = currentNavigationItems;
|
||||
currentNavigationItems = navigationItems;
|
||||
|
||||
listeners.stream().forEach((e) -> e.onNavigationRequested(currentNavigationItems));
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Listeners
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void addListener(NavigationListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeListener(NavigationListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public NavigationItem[] getPreviousMainNavigationItems() {
|
||||
return previousMainNavigationItems;
|
||||
}
|
||||
|
||||
public NavigationItem[] getCurrentNavigationItems() {
|
||||
return currentNavigationItems;
|
||||
}
|
||||
|
||||
}
|
|
@ -21,65 +21,102 @@ import io.bitsquare.gui.util.ImageUtil;
|
|||
|
||||
public enum NavigationItem {
|
||||
|
||||
// app
|
||||
MAIN("/io/bitsquare/gui/view/MainView.fxml"),
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Application
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// main menu screens
|
||||
HOME("/io/bitsquare/gui/home/HomeView.fxml", ImageUtil.HOME, ImageUtil.HOME_ACTIVE),
|
||||
ORDERS("/io/bitsquare/gui/orders/OrdersView.fxml", ImageUtil.ORDERS, ImageUtil.ORDERS_ACTIVE),
|
||||
FUNDS("/io/bitsquare/gui/funds/FundsView.fxml", ImageUtil.FUNDS, ImageUtil.FUNDS_ACTIVE),
|
||||
MSG("/io/bitsquare/gui/msg/MsgView.fxml", ImageUtil.MSG, ImageUtil.MSG_ACTIVE),
|
||||
SETTINGS("/io/bitsquare/gui/settings/SettingsView.fxml", ImageUtil.SETTINGS, ImageUtil.SETTINGS_ACTIVE),
|
||||
ACCOUNT("/io/bitsquare/gui/view/AccountView.fxml", ImageUtil.ACCOUNT, ImageUtil.ACCOUNT_ACTIVE),
|
||||
MAIN(0, "/io/bitsquare/gui/view/MainView.fxml"),
|
||||
|
||||
// trade
|
||||
ORDER_BOOK("/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml"),
|
||||
BUY("/io/bitsquare/gui/trade/BuyView.fxml", ImageUtil.NAV_BUY, ImageUtil.NAV_BUY_ACTIVE),
|
||||
SELL("/io/bitsquare/gui/trade/SellView.fxml", ImageUtil.NAV_SELL, ImageUtil.NAV_SELL_ACTIVE),
|
||||
CREATE_OFFER("/io/bitsquare/gui/view/trade/CreateOfferView.fxml"),
|
||||
TAKE_OFFER("/io/bitsquare/gui/trade/takeoffer/TakeOfferView.fxml"),
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Main menu screens
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
HOME(1, "/io/bitsquare/gui/home/HomeView.fxml", ImageUtil.HOME, ImageUtil.HOME_ACTIVE),
|
||||
BUY(1, "/io/bitsquare/gui/trade/BuyView.fxml", ImageUtil.NAV_BUY, ImageUtil.NAV_BUY_ACTIVE),
|
||||
SELL(1, "/io/bitsquare/gui/trade/SellView.fxml", ImageUtil.NAV_SELL, ImageUtil.NAV_SELL_ACTIVE),
|
||||
ORDERS(1, "/io/bitsquare/gui/orders/OrdersView.fxml", ImageUtil.ORDERS, ImageUtil.ORDERS_ACTIVE),
|
||||
FUNDS(1, "/io/bitsquare/gui/funds/FundsView.fxml", ImageUtil.FUNDS, ImageUtil.FUNDS_ACTIVE),
|
||||
MSG(1, "/io/bitsquare/gui/msg/MsgView.fxml", ImageUtil.MSG, ImageUtil.MSG_ACTIVE),
|
||||
SETTINGS(1, "/io/bitsquare/gui/settings/SettingsView.fxml", ImageUtil.SETTINGS, ImageUtil.SETTINGS_ACTIVE),
|
||||
ACCOUNT(1, "/io/bitsquare/gui/view/AccountView.fxml", ImageUtil.ACCOUNT, ImageUtil.ACCOUNT_ACTIVE),
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Sub menus
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// buy/sell (trade)
|
||||
ORDER_BOOK(2, "/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml"),
|
||||
CREATE_OFFER(2, "/io/bitsquare/gui/view/trade/CreateOfferView.fxml"),
|
||||
TAKE_OFFER(2, "/io/bitsquare/gui/trade/takeoffer/TakeOfferView.fxml"),
|
||||
|
||||
// orders
|
||||
OFFER("/io/bitsquare/gui/orders/offer/OfferView.fxml"),
|
||||
PENDING_TRADE("/io/bitsquare/gui/orders/pending/PendingTradeView.fxml"),
|
||||
CLOSED_TRADE("/io/bitsquare/gui/orders/closed/ClosedTradeView.fxml"),
|
||||
OFFER(2, "/io/bitsquare/gui/orders/offer/OfferView.fxml"),
|
||||
PENDING_TRADE(2, "/io/bitsquare/gui/orders/pending/PendingTradeView.fxml"),
|
||||
CLOSED_TRADE(2, "/io/bitsquare/gui/orders/closed/ClosedTradeView.fxml"),
|
||||
|
||||
// funds
|
||||
DEPOSIT("/io/bitsquare/gui/funds/deposit/DepositView.fxml"),
|
||||
WITHDRAWAL("/io/bitsquare/gui/funds/withdrawal/WithdrawalView.fxml"),
|
||||
TRANSACTIONS("/io/bitsquare/gui/funds/transactions/TransactionsView.fxml"),
|
||||
DEPOSIT(2, "/io/bitsquare/gui/funds/deposit/DepositView.fxml"),
|
||||
WITHDRAWAL(2, "/io/bitsquare/gui/funds/withdrawal/WithdrawalView.fxml"),
|
||||
TRANSACTIONS(2, "/io/bitsquare/gui/funds/transactions/TransactionsView.fxml"),
|
||||
|
||||
// account
|
||||
ACCOUNT_SETUP("/io/bitsquare/gui/view/account/AccountSetupView.fxml"),
|
||||
ACCOUNT_SETTINGS("/io/bitsquare/gui/view/account/AccountSettingsView.fxml"),
|
||||
ACCOUNT_SETUP(2, "/io/bitsquare/gui/view/account/AccountSetupView.fxml"),
|
||||
ACCOUNT_SETTINGS(2, "/io/bitsquare/gui/view/account/AccountSettingsView.fxml"),
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Content in sub menus
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// account content
|
||||
SEED_WORDS("/io/bitsquare/gui/view/account/content/SeedWordsView.fxml"),
|
||||
ADD_PASSWORD("/io/bitsquare/gui/view/account/content/PasswordView.fxml"),
|
||||
CHANGE_PASSWORD("/io/bitsquare/gui/view/account/content/PasswordView.fxml"),
|
||||
RESTRICTIONS("/io/bitsquare/gui/view/account/content/RestrictionsView.fxml"),
|
||||
REGISTRATION("/io/bitsquare/gui/view/account/content/RegistrationView.fxml"),
|
||||
FIAT_ACCOUNT("/io/bitsquare/gui/view/account/content/FiatAccountView.fxml"),
|
||||
SEED_WORDS(3, "/io/bitsquare/gui/view/account/content/SeedWordsView.fxml"),
|
||||
ADD_PASSWORD(3, "/io/bitsquare/gui/view/account/content/PasswordView.fxml"),
|
||||
CHANGE_PASSWORD(3, "/io/bitsquare/gui/view/account/content/PasswordView.fxml"),
|
||||
RESTRICTIONS(3, "/io/bitsquare/gui/view/account/content/RestrictionsView.fxml"),
|
||||
REGISTRATION(3, "/io/bitsquare/gui/view/account/content/RegistrationView.fxml"),
|
||||
FIAT_ACCOUNT(3, "/io/bitsquare/gui/view/account/content/FiatAccountView.fxml"),
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Popups
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// arbitrator
|
||||
ARBITRATOR_PROFILE("/io/bitsquare/gui/arbitrators/profile/ArbitratorProfileView.fxml"),
|
||||
ARBITRATOR_BROWSER("/io/bitsquare/gui/arbitrators/browser/ArbitratorBrowserView.fxml"),
|
||||
ARBITRATOR_REGISTRATION("/io/bitsquare/gui/arbitrators/registration/ArbitratorRegistrationView.fxml");
|
||||
ARBITRATOR_PROFILE(2, "/io/bitsquare/gui/arbitrators/profile/ArbitratorProfileView.fxml"),
|
||||
ARBITRATOR_BROWSER(-1, "/io/bitsquare/gui/arbitrators/browser/ArbitratorBrowserView.fxml"),
|
||||
ARBITRATOR_REGISTRATION(-1, "/io/bitsquare/gui/arbitrators/registration/ArbitratorRegistrationView.fxml");
|
||||
|
||||
|
||||
private int level;
|
||||
private final String fxmlUrl;
|
||||
private String icon;
|
||||
private String activeIcon;
|
||||
|
||||
NavigationItem(String fxmlUrl, String icon, String activeIcon) {
|
||||
/**
|
||||
* @param level The navigation hierarchy depth. 0 is main app level, 1 is main menu items, 2 is sub-menus,
|
||||
* 3 content in sub-menus, -1 is popup window
|
||||
* @param fxmlUrl
|
||||
* @param icon
|
||||
* @param activeIcon
|
||||
*/
|
||||
NavigationItem(int level, String fxmlUrl, String icon, String activeIcon) {
|
||||
this.level = level;
|
||||
this.fxmlUrl = fxmlUrl;
|
||||
this.icon = icon;
|
||||
this.activeIcon = activeIcon;
|
||||
}
|
||||
|
||||
NavigationItem(String fxmlUrl) {
|
||||
NavigationItem(int level, String fxmlUrl) {
|
||||
this.level = level;
|
||||
this.fxmlUrl = fxmlUrl;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public String getFxmlUrl() {
|
||||
return fxmlUrl;
|
||||
}
|
||||
|
|
63
src/main/java/io/bitsquare/gui/OverlayController.java
Normal file
63
src/main/java/io/bitsquare/gui/OverlayController.java
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class OverlayController {
|
||||
private static final Logger log = LoggerFactory.getLogger(OverlayController.class);
|
||||
|
||||
private List<OverlayListener> listeners = new ArrayList<>();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public OverlayController() {
|
||||
}
|
||||
|
||||
public void blurContent() {
|
||||
listeners.stream().forEach((e) -> e.onBlurContentRequested());
|
||||
}
|
||||
|
||||
public void removeBlurContent() {
|
||||
listeners.stream().forEach((e) -> e.onRemoveBlurContentRequested());
|
||||
}
|
||||
|
||||
public void addListener(OverlayListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeListener(OverlayListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
public interface OverlayListener {
|
||||
void onBlurContentRequested();
|
||||
|
||||
void onRemoveBlurContentRequested();
|
||||
}
|
||||
}
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package io.bitsquare.gui;
|
||||
|
||||
import io.bitsquare.gui.view.CodeBehind;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package io.bitsquare.gui.components;
|
||||
|
||||
import io.bitsquare.BitSquare;
|
||||
import io.bitsquare.gui.view.MainViewCB;
|
||||
import io.bitsquare.gui.OverlayController;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
|
||||
import com.google.bitcoin.store.BlockStoreException;
|
||||
|
@ -49,6 +49,13 @@ import org.slf4j.LoggerFactory;
|
|||
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;
|
||||
}
|
||||
|
||||
private static OverlayController overlayController;
|
||||
|
||||
// Information
|
||||
public static void openInfo(String message) {
|
||||
openInfo(message, null, null);
|
||||
|
@ -56,7 +63,7 @@ public class Popups {
|
|||
|
||||
// Supports blurring the content background
|
||||
public static void openInfo(String message, String masthead) {
|
||||
MainViewCB.getInstance().blurContentScreen();
|
||||
overlayController.blurContent();
|
||||
List<Action> actions = new ArrayList<>();
|
||||
|
||||
// Dialogs are a bit limited. There is no callback for the InformationDialog button click, so we added
|
||||
|
@ -65,7 +72,7 @@ public class Popups {
|
|||
@Override
|
||||
public void handle(ActionEvent actionEvent) {
|
||||
Dialog.Actions.CLOSE.handle(actionEvent);
|
||||
MainViewCB.getInstance().removeContentScreenBlur();
|
||||
overlayController.removeBlurContent();
|
||||
}
|
||||
});
|
||||
openInfo(message, masthead, actions);
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
package io.bitsquare.gui.components.btc;
|
||||
|
||||
import io.bitsquare.gui.OverlayController;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.view.MainViewCB;
|
||||
|
||||
import com.google.bitcoin.core.Coin;
|
||||
import com.google.bitcoin.uri.BitcoinURI;
|
||||
|
@ -60,6 +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;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -67,7 +68,6 @@ public class AddressTextField extends AnchorPane {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public AddressTextField() {
|
||||
|
||||
TextField addressLabel = new TextField();
|
||||
addressLabel.setId("address-text-field");
|
||||
addressLabel.setEditable(false);
|
||||
|
@ -124,13 +124,17 @@ public class AddressTextField extends AnchorPane {
|
|||
PopOver popOver = new PopOver(pane);
|
||||
popOver.setDetachedTitle("Scan QR code for this address");
|
||||
popOver.setDetached(true);
|
||||
popOver.setOnHiding(windowEvent -> MainViewCB.getInstance().removeContentScreenBlur());
|
||||
popOver.setOnHiding(windowEvent -> {
|
||||
if (overlayController != null)
|
||||
overlayController.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);
|
||||
MainViewCB.getInstance().blurContentScreen();
|
||||
if (overlayController != null)
|
||||
overlayController.blurContent();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -183,6 +187,11 @@ public class AddressTextField extends AnchorPane {
|
|||
this.paymentLabel.set(paymentLabel);
|
||||
}
|
||||
|
||||
// TODO find better solution
|
||||
public void setOverlayController(OverlayController overlayController) {
|
||||
this.overlayController = overlayController;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package io.bitsquare.gui.model;
|
||||
|
||||
import io.bitsquare.gui.UIModel;
|
||||
import io.bitsquare.user.User;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
|
|
@ -21,7 +21,6 @@ import io.bitsquare.bank.BankAccount;
|
|||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.btc.listeners.BalanceListener;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.UIModel;
|
||||
import io.bitsquare.gui.util.Profiler;
|
||||
import io.bitsquare.msg.MessageFacade;
|
||||
import io.bitsquare.msg.listeners.BootstrapListener;
|
||||
|
@ -166,14 +165,12 @@ public class MainModel extends UIModel {
|
|||
return user.currentBankAccountProperty();
|
||||
}
|
||||
|
||||
public NavigationItem getSelectedNavigationItem() {
|
||||
NavigationItem selectedNavigationItem = (NavigationItem) persistence.read(this, "selectedNavigationItem");
|
||||
// Set default
|
||||
// TODO set HOME later
|
||||
if (selectedNavigationItem == null)
|
||||
selectedNavigationItem = NavigationItem.BUY;
|
||||
public NavigationItem[] getSelectedNavigationItems() {
|
||||
NavigationItem[] selectedNavigationItems = (NavigationItem[]) persistence.read(this, "selectedNavigationItems");
|
||||
if (selectedNavigationItems == null || selectedNavigationItems.length == 0)
|
||||
selectedNavigationItems = new NavigationItem[]{NavigationItem.BUY};
|
||||
|
||||
return selectedNavigationItem;
|
||||
return selectedNavigationItems;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package io.bitsquare.gui;
|
||||
package io.bitsquare.gui.model;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package io.bitsquare.gui.model.account;
|
||||
|
||||
import io.bitsquare.gui.UIModel;
|
||||
import io.bitsquare.gui.model.UIModel;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package io.bitsquare.gui.model.account;
|
||||
|
||||
import io.bitsquare.gui.UIModel;
|
||||
import io.bitsquare.gui.model.UIModel;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package io.bitsquare.gui.model.account.content;
|
||||
|
||||
import io.bitsquare.gui.UIModel;
|
||||
import io.bitsquare.gui.model.UIModel;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ package io.bitsquare.gui.model.account.content;
|
|||
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.bank.BankAccountType;
|
||||
import io.bitsquare.gui.UIModel;
|
||||
import io.bitsquare.gui.model.UIModel;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.CountryUtil;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package io.bitsquare.gui.model.account.content;
|
||||
|
||||
import io.bitsquare.gui.UIModel;
|
||||
import io.bitsquare.gui.model.UIModel;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import io.bitsquare.btc.AddressEntry;
|
|||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.btc.listeners.BalanceListener;
|
||||
import io.bitsquare.gui.UIModel;
|
||||
import io.bitsquare.gui.model.UIModel;
|
||||
import io.bitsquare.persistence.Persistence;
|
||||
import io.bitsquare.user.User;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ package io.bitsquare.gui.model.account.content;
|
|||
|
||||
import io.bitsquare.arbitrator.Arbitrator;
|
||||
import io.bitsquare.arbitrator.Reputation;
|
||||
import io.bitsquare.gui.UIModel;
|
||||
import io.bitsquare.gui.model.UIModel;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.CountryUtil;
|
||||
import io.bitsquare.locale.LanguageUtil;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package io.bitsquare.gui.model.account.content;
|
||||
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.gui.UIModel;
|
||||
import io.bitsquare.gui.model.UIModel;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import io.bitsquare.btc.AddressEntry;
|
|||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.btc.listeners.BalanceListener;
|
||||
import io.bitsquare.gui.UIModel;
|
||||
import io.bitsquare.gui.model.UIModel;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.settings.Settings;
|
||||
import io.bitsquare.trade.Direction;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package io.bitsquare.gui.pm;
|
||||
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.model.AccountModel;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
|
|
@ -19,7 +19,6 @@ package io.bitsquare.gui.pm;
|
|||
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.model.MainModel;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
|
||||
|
@ -137,8 +136,8 @@ public class MainPM extends PresentationModel<MainModel> {
|
|||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public NavigationItem getSelectedNavigationItem() {
|
||||
return model.getSelectedNavigationItem();
|
||||
public NavigationItem[] getSelectedNavigationItems() {
|
||||
return model.getSelectedNavigationItems();
|
||||
}
|
||||
|
||||
public ObservableList<BankAccount> getBankAccounts() {
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
package io.bitsquare.gui;
|
||||
package io.bitsquare.gui.pm;
|
||||
|
||||
import io.bitsquare.gui.model.UIModel;
|
||||
|
||||
public class PresentationModel<T extends UIModel> {
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
package io.bitsquare.gui.pm.account;
|
||||
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.model.account.AccountSettingsModel;
|
||||
import io.bitsquare.gui.pm.PresentationModel;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
package io.bitsquare.gui.pm.account;
|
||||
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.model.account.AccountSetupModel;
|
||||
import io.bitsquare.gui.pm.PresentationModel;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
package io.bitsquare.gui.pm.account.content;
|
||||
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.model.account.content.ChangePasswordModel;
|
||||
import io.bitsquare.gui.pm.PresentationModel;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.gui.util.validation.PasswordValidator;
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ package io.bitsquare.gui.pm.account.content;
|
|||
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.bank.BankAccountType;
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.model.account.content.FiatAccountModel;
|
||||
import io.bitsquare.gui.pm.PresentationModel;
|
||||
import io.bitsquare.gui.util.validation.BankAccountNumberValidator;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
package io.bitsquare.gui.pm.account.content;
|
||||
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.model.account.content.PasswordModel;
|
||||
import io.bitsquare.gui.pm.PresentationModel;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.gui.util.validation.PasswordValidator;
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
package io.bitsquare.gui.pm.account.content;
|
||||
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.model.account.content.RegistrationModel;
|
||||
import io.bitsquare.gui.pm.PresentationModel;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
|
||||
import com.google.bitcoin.core.Address;
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
package io.bitsquare.gui.pm.account.content;
|
||||
|
||||
import io.bitsquare.arbitrator.Arbitrator;
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.model.account.content.RestrictionsModel;
|
||||
import io.bitsquare.gui.pm.PresentationModel;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.Region;
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
package io.bitsquare.gui.pm.account.content;
|
||||
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.model.account.content.SeedWordsModel;
|
||||
import io.bitsquare.gui.pm.PresentationModel;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
package io.bitsquare.gui.pm.trade;
|
||||
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.model.trade.CreateOfferModel;
|
||||
import io.bitsquare.gui.pm.PresentationModel;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.validation.BtcValidator;
|
||||
import io.bitsquare.gui.util.validation.FiatValidator;
|
||||
|
|
|
@ -20,14 +20,15 @@ package io.bitsquare.gui.trade.orderbook;
|
|||
import io.bitsquare.bank.BankAccountType;
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.CodeBehind;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.OverlayController;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.trade.takeoffer.TakeOfferController;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.gui.view.MainViewCB;
|
||||
import io.bitsquare.gui.view.CodeBehind;
|
||||
import io.bitsquare.gui.view.trade.CreateOfferViewCB;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.locale.Country;
|
||||
|
@ -85,6 +86,8 @@ import org.slf4j.LoggerFactory;
|
|||
public class OrderBookController extends CachedViewController {
|
||||
private static final Logger log = LoggerFactory.getLogger(OrderBookController.class);
|
||||
|
||||
private NavigationController navigationController;
|
||||
private OverlayController overlayController;
|
||||
private final OrderBook orderBook;
|
||||
private final OrderBookFilter orderBookFilter;
|
||||
private final User user;
|
||||
|
@ -112,8 +115,13 @@ public class OrderBookController extends CachedViewController {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
private OrderBookController(OrderBook orderBook, User user, MessageFacade messageFacade,
|
||||
private OrderBookController(NavigationController navigationController,
|
||||
OverlayController overlayController,
|
||||
OrderBook orderBook, User user,
|
||||
MessageFacade messageFacade,
|
||||
WalletFacade walletFacade, Settings settings, Persistence persistence) {
|
||||
this.navigationController = navigationController;
|
||||
this.overlayController = overlayController;
|
||||
this.orderBook = orderBook;
|
||||
this.user = user;
|
||||
this.messageFacade = messageFacade;
|
||||
|
@ -269,19 +277,14 @@ public class OrderBookController extends CachedViewController {
|
|||
|
||||
|
||||
private void openSetupScreen() {
|
||||
|
||||
MainViewCB.getInstance().blurContentScreen();
|
||||
overlayController.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);
|
||||
MainViewCB.getInstance().removeContentScreenBlur();
|
||||
|
||||
MainViewCB.getInstance().triggerMainMenuButton(NavigationItem.ACCOUNT);
|
||||
MainViewCB.getInstance()
|
||||
.setPreviousNavigationItem((orderBookFilter.getDirection() == Direction.BUY) ?
|
||||
NavigationItem.BUY : NavigationItem.SELL);
|
||||
overlayController.removeBlurContent();
|
||||
navigationController.navigationTo(NavigationItem.ACCOUNT, NavigationItem.ACCOUNT_SETUP);
|
||||
}
|
||||
});
|
||||
Popups.openInfo("You need to setup your trading account before you can trade.",
|
||||
|
|
|
@ -106,25 +106,27 @@ public class Transitions {
|
|||
}
|
||||
|
||||
public static void removeBlur(Node node, int duration, boolean useDarken) {
|
||||
GaussianBlur blur = (GaussianBlur) node.getEffect();
|
||||
Timeline timeline = new Timeline();
|
||||
if (node != null) {
|
||||
GaussianBlur blur = (GaussianBlur) node.getEffect();
|
||||
Timeline timeline = new Timeline();
|
||||
|
||||
KeyValue kv1 = new KeyValue(blur.radiusProperty(), 0.0);
|
||||
KeyFrame kf1 = new KeyFrame(Duration.millis(DURATION), kv1);
|
||||
KeyValue kv1 = new KeyValue(blur.radiusProperty(), 0.0);
|
||||
KeyFrame kf1 = new KeyFrame(Duration.millis(DURATION), kv1);
|
||||
|
||||
|
||||
if (useDarken) {
|
||||
ColorAdjust darken = (ColorAdjust) blur.getInput();
|
||||
if (useDarken) {
|
||||
ColorAdjust darken = (ColorAdjust) blur.getInput();
|
||||
|
||||
KeyValue kv2 = new KeyValue(darken.brightnessProperty(), 0.0);
|
||||
KeyFrame kf2 = new KeyFrame(Duration.millis(duration), kv2);
|
||||
timeline.getKeyFrames().addAll(kf1, kf2);
|
||||
KeyValue kv2 = new KeyValue(darken.brightnessProperty(), 0.0);
|
||||
KeyFrame kf2 = new KeyFrame(Duration.millis(duration), kv2);
|
||||
timeline.getKeyFrames().addAll(kf1, kf2);
|
||||
}
|
||||
else {
|
||||
timeline.getKeyFrames().addAll(kf1);
|
||||
}
|
||||
|
||||
timeline.setOnFinished(actionEvent -> node.setEffect(null));
|
||||
timeline.play();
|
||||
}
|
||||
else {
|
||||
timeline.getKeyFrames().addAll(kf1);
|
||||
}
|
||||
|
||||
timeline.setOnFinished(actionEvent -> node.setEffect(null));
|
||||
timeline.play();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
|
||||
package io.bitsquare.gui.view;
|
||||
|
||||
import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.CodeBehind;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.pm.AccountPM;
|
||||
import io.bitsquare.gui.view.account.AccountSetupViewCB;
|
||||
|
@ -44,6 +43,7 @@ public class AccountViewCB extends CachedCodeBehind<AccountPM> {
|
|||
private static final Logger log = LoggerFactory.getLogger(AccountViewCB.class);
|
||||
|
||||
public Tab tab;
|
||||
private NavigationController navigationController;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -51,8 +51,9 @@ public class AccountViewCB extends CachedCodeBehind<AccountPM> {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
private AccountViewCB(AccountPM presentationModel) {
|
||||
private AccountViewCB(AccountPM presentationModel, NavigationController navigationController) {
|
||||
super(presentationModel);
|
||||
this.navigationController = navigationController;
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,11 +132,7 @@ public class AccountViewCB extends CachedCodeBehind<AccountPM> {
|
|||
private void removeSetup() {
|
||||
childController = null;
|
||||
|
||||
NavigationItem previousItem = MainViewCB.getInstance().getPreviousNavigationItem();
|
||||
if (previousItem == null)
|
||||
previousItem = NavigationItem.HOME;
|
||||
|
||||
MainViewCB.getInstance().triggerMainMenuButton(previousItem);
|
||||
navigationController.navigationTo(navigationController.getPreviousMainNavigationItems());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
package io.bitsquare.gui;
|
||||
package io.bitsquare.gui.view;
|
||||
|
||||
import io.bitsquare.gui.pm.PresentationModel;
|
||||
|
||||
import java.net.URL;
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
package io.bitsquare.gui;
|
||||
package io.bitsquare.gui.view;
|
||||
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.pm.PresentationModel;
|
||||
|
||||
import java.net.URL;
|
||||
|
|
@ -18,11 +18,11 @@
|
|||
package io.bitsquare.gui.view;
|
||||
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.CodeBehind;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.OverlayController;
|
||||
import io.bitsquare.gui.components.NetworkSyncPane;
|
||||
import io.bitsquare.gui.orders.OrdersController;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.pm.MainPM;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.gui.util.Profiler;
|
||||
|
@ -53,33 +53,23 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class MainViewCB extends CachedCodeBehind<MainPM> {
|
||||
private static final Logger log = LoggerFactory.getLogger(MainViewCB.class);
|
||||
//TODO
|
||||
private static MainViewCB instance;
|
||||
|
||||
private VBox baseOverlayContainer;
|
||||
private final ToggleGroup navButtonsGroup = new ToggleGroup();
|
||||
private NavigationItem previousNavigationItem;
|
||||
private NavigationItem mainNavigationItem;
|
||||
|
||||
private AnchorPane contentPane;
|
||||
private BorderPane baseApplicationContainer;
|
||||
private VBox baseOverlayContainer;
|
||||
private AnchorPane applicationContainer;
|
||||
private AnchorPane contentContainer;
|
||||
private HBox leftNavPane, rightNavPane;
|
||||
private NetworkSyncPane networkSyncPane;
|
||||
private BorderPane baseContentContainer;
|
||||
private AnchorPane contentScreen;
|
||||
private MenuBar menuBar;
|
||||
private Label loadingLabel;
|
||||
private ToggleButton buyButton, sellButton, homeButton, msgButton, ordersButton, fundsButton, settingsButton,
|
||||
accountButton;
|
||||
private Pane ordersButtonButtonPane;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Static
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//TODO
|
||||
public static MainViewCB getInstance() {
|
||||
return instance;
|
||||
}
|
||||
private NavigationController navigationController;
|
||||
private OverlayController overlayController;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -87,11 +77,41 @@ public class MainViewCB extends CachedCodeBehind<MainPM> {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
private MainViewCB(MainPM presentationModel) {
|
||||
private MainViewCB(MainPM presentationModel, NavigationController navigationController,
|
||||
OverlayController overlayController) {
|
||||
super(presentationModel);
|
||||
this.navigationController = navigationController;
|
||||
this.overlayController = overlayController;
|
||||
|
||||
//TODO
|
||||
MainViewCB.instance = this;
|
||||
// just temp. ugly hack... Popups will be removed
|
||||
Popups.setOverlayController(overlayController);
|
||||
|
||||
navigationController.addListener(navigationItems -> {
|
||||
if (navigationItems != null && navigationItems.length > 0) {
|
||||
NavigationItem navigationItem = navigationItems[0];
|
||||
if (navigationItem.getLevel() == 1) {
|
||||
mainNavigationItem = navigationItem;
|
||||
loadView(mainNavigationItem);
|
||||
selectMainMenuButton(mainNavigationItem);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mainNavigationItem = NavigationItem.HOME;
|
||||
loadView(mainNavigationItem);
|
||||
selectMainMenuButton(mainNavigationItem);
|
||||
}
|
||||
});
|
||||
overlayController.addListener(new OverlayController.OverlayListener() {
|
||||
@Override
|
||||
public void onBlurContentRequested() {
|
||||
Transitions.blur(baseApplicationContainer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoveBlurContentRequested() {
|
||||
Transitions.removeBlur(baseApplicationContainer);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -130,34 +150,36 @@ public class MainViewCB extends CachedCodeBehind<MainPM> {
|
|||
// Navigation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public Initializable triggerMainMenuButton(NavigationItem navigationItem) {
|
||||
public void selectMainMenuButton(NavigationItem navigationItem) {
|
||||
switch (navigationItem) {
|
||||
case HOME:
|
||||
homeButton.fire();
|
||||
homeButton.setSelected(true);
|
||||
break;
|
||||
case FUNDS:
|
||||
fundsButton.fire();
|
||||
fundsButton.setSelected(true);
|
||||
break;
|
||||
case MSG:
|
||||
msgButton.fire();
|
||||
msgButton.setSelected(true);
|
||||
break;
|
||||
case ORDERS:
|
||||
ordersButton.fire();
|
||||
ordersButton.setSelected(true);
|
||||
break;
|
||||
case SETTINGS:
|
||||
settingsButton.fire();
|
||||
settingsButton.setSelected(true);
|
||||
break;
|
||||
case SELL:
|
||||
sellButton.fire();
|
||||
sellButton.setSelected(true);
|
||||
break;
|
||||
case BUY:
|
||||
buyButton.fire();
|
||||
buyButton.setSelected(true);
|
||||
break;
|
||||
case ACCOUNT:
|
||||
accountButton.fire();
|
||||
accountButton.setSelected(true);
|
||||
break;
|
||||
default:
|
||||
log.error(navigationItem.getFxmlUrl() + " is no main navigation item");
|
||||
break;
|
||||
}
|
||||
return childController;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -167,7 +189,7 @@ public class MainViewCB extends CachedCodeBehind<MainPM> {
|
|||
final BSFXMLLoader loader = new BSFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()));
|
||||
try {
|
||||
final Node view = loader.load();
|
||||
contentPane.getChildren().setAll(view);
|
||||
contentContainer.getChildren().setAll(view);
|
||||
childController = loader.getController();
|
||||
|
||||
if (childController instanceof CodeBehind)
|
||||
|
@ -182,36 +204,15 @@ public class MainViewCB extends CachedCodeBehind<MainPM> {
|
|||
return null;
|
||||
}
|
||||
|
||||
public void setPreviousNavigationItem(NavigationItem previousNavigationItem) {
|
||||
this.previousNavigationItem = previousNavigationItem;
|
||||
}
|
||||
|
||||
public NavigationItem getPreviousNavigationItem() {
|
||||
return previousNavigationItem;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Blur
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void removeContentScreenBlur() {
|
||||
Transitions.removeBlur(baseContentContainer);
|
||||
}
|
||||
|
||||
public void blurContentScreen() {
|
||||
Transitions.blur(baseContentContainer);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private Methods: Startup
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void startup() {
|
||||
baseContentContainer = getBaseContentContainer();
|
||||
baseApplicationContainer = getBaseApplicationContainer();
|
||||
baseOverlayContainer = getSplashScreen();
|
||||
((StackPane) root).getChildren().addAll(baseContentContainer, baseOverlayContainer);
|
||||
((StackPane) root).getChildren().addAll(baseApplicationContainer, baseOverlayContainer);
|
||||
|
||||
onBaseContainersCreated();
|
||||
}
|
||||
|
@ -220,12 +221,10 @@ public class MainViewCB extends CachedCodeBehind<MainPM> {
|
|||
Profiler.printMsgWithTime("MainController.onBaseContainersCreated");
|
||||
|
||||
menuBar = getMenuBar();
|
||||
contentScreen = getContentScreen();
|
||||
applicationContainer = getApplicationContainer();
|
||||
|
||||
addNetworkSyncPane();
|
||||
|
||||
baseContentContainer.setTop(menuBar);
|
||||
baseContentContainer.setCenter(contentScreen);
|
||||
baseApplicationContainer.setTop(menuBar);
|
||||
baseApplicationContainer.setCenter(applicationContainer);
|
||||
|
||||
presentationModel.backendInited.addListener((ov, oldValue, newValue) -> {
|
||||
if (newValue)
|
||||
|
@ -247,18 +246,15 @@ public class MainViewCB extends CachedCodeBehind<MainPM> {
|
|||
final Button alertButton = new Button("", ImageUtil.getIconImageView(ImageUtil.MSG_ALERT));
|
||||
alertButton.setId("nav-alert-button");
|
||||
alertButton.relocate(36, 19);
|
||||
alertButton.setOnAction((e) -> {
|
||||
ordersButton.fire();
|
||||
//TODO
|
||||
OrdersController.GET_INSTANCE().setSelectedTabIndex(1);
|
||||
});
|
||||
alertButton.setOnAction((e) ->
|
||||
navigationController.navigationTo(NavigationItem.ORDERS, NavigationItem.PENDING_TRADE));
|
||||
Tooltip.install(alertButton, new Tooltip("Your offer has been accepted"));
|
||||
ordersButtonButtonPane.getChildren().add(alertButton);
|
||||
|
||||
AWTSystemTray.setAlert();
|
||||
});
|
||||
|
||||
triggerMainMenuButton(presentationModel.getSelectedNavigationItem());
|
||||
navigationController.navigationTo(presentationModel.getSelectedNavigationItems());
|
||||
onContentAdded();
|
||||
}
|
||||
|
||||
|
@ -272,7 +268,7 @@ public class MainViewCB extends CachedCodeBehind<MainPM> {
|
|||
// Private
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private BorderPane getBaseContentContainer() {
|
||||
private BorderPane getBaseApplicationContainer() {
|
||||
BorderPane borderPane = new BorderPane();
|
||||
borderPane.setId("base-content-container");
|
||||
return borderPane;
|
||||
|
@ -325,7 +321,7 @@ public class MainViewCB extends CachedCodeBehind<MainPM> {
|
|||
return menuBar;
|
||||
}
|
||||
|
||||
private AnchorPane getContentScreen() {
|
||||
private AnchorPane getApplicationContainer() {
|
||||
AnchorPane anchorPane = new AnchorPane();
|
||||
anchorPane.setId("content-pane");
|
||||
|
||||
|
@ -339,18 +335,13 @@ public class MainViewCB extends CachedCodeBehind<MainPM> {
|
|||
AnchorPane.setRightAnchor(rightNavPane, 10d);
|
||||
AnchorPane.setTopAnchor(rightNavPane, 0d);
|
||||
|
||||
contentPane = new AnchorPane();
|
||||
contentPane.setId("content-pane");
|
||||
AnchorPane.setLeftAnchor(contentPane, 0d);
|
||||
AnchorPane.setRightAnchor(contentPane, 0d);
|
||||
AnchorPane.setTopAnchor(contentPane, 60d);
|
||||
AnchorPane.setBottomAnchor(contentPane, 20d);
|
||||
contentContainer = new AnchorPane();
|
||||
contentContainer.setId("content-pane");
|
||||
AnchorPane.setLeftAnchor(contentContainer, 0d);
|
||||
AnchorPane.setRightAnchor(contentContainer, 0d);
|
||||
AnchorPane.setTopAnchor(contentContainer, 60d);
|
||||
AnchorPane.setBottomAnchor(contentContainer, 25d);
|
||||
|
||||
anchorPane.getChildren().addAll(leftNavPane, rightNavPane, contentPane);
|
||||
return anchorPane;
|
||||
}
|
||||
|
||||
private void addNetworkSyncPane() {
|
||||
networkSyncPane = new NetworkSyncPane();
|
||||
networkSyncPane.setSpacing(10);
|
||||
networkSyncPane.setPrefHeight(20);
|
||||
|
@ -362,7 +353,8 @@ public class MainViewCB extends CachedCodeBehind<MainPM> {
|
|||
networkSyncPane.downloadComplete();
|
||||
});
|
||||
|
||||
contentScreen.getChildren().addAll(networkSyncPane);
|
||||
anchorPane.getChildren().addAll(leftNavPane, rightNavPane, contentContainer, networkSyncPane);
|
||||
return anchorPane;
|
||||
}
|
||||
|
||||
private void addMainNavigation() {
|
||||
|
|
|
@ -17,11 +17,12 @@
|
|||
|
||||
package io.bitsquare.gui.view.account;
|
||||
|
||||
import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.CodeBehind;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.pm.PresentationModel;
|
||||
import io.bitsquare.gui.pm.account.AccountSettingsPM;
|
||||
import io.bitsquare.gui.view.CachedCodeBehind;
|
||||
import io.bitsquare.gui.view.CodeBehind;
|
||||
import io.bitsquare.gui.view.account.content.ContextAware;
|
||||
import io.bitsquare.util.BSFXMLLoader;
|
||||
|
||||
|
@ -48,6 +49,9 @@ import org.slf4j.LoggerFactory;
|
|||
public class AccountSettingsViewCB extends CachedCodeBehind<AccountSettingsPM> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(AccountSettingsViewCB.class);
|
||||
|
||||
public NavigationItem subMenuNavigationItem;
|
||||
|
||||
public VBox leftVBox;
|
||||
public AnchorPane content;
|
||||
|
||||
|
@ -56,8 +60,17 @@ public class AccountSettingsViewCB extends CachedCodeBehind<AccountSettingsPM> {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
private AccountSettingsViewCB(AccountSettingsPM presentationModel) {
|
||||
private AccountSettingsViewCB(AccountSettingsPM presentationModel, NavigationController navigationController) {
|
||||
super(presentationModel);
|
||||
|
||||
navigationController.addListener(navigationItem -> {
|
||||
if (navigationItem.length > 1) {
|
||||
NavigationItem subMenuNavigationItem1 = navigationItem[1];
|
||||
if (subMenuNavigationItem1.getLevel() == 2) {
|
||||
AccountSettingsViewCB.this.subMenuNavigationItem = subMenuNavigationItem1;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,7 +99,31 @@ public class AccountSettingsViewCB extends CachedCodeBehind<AccountSettingsPM> {
|
|||
leftVBox.getChildren().addAll(seedWords, password,
|
||||
restrictions, fiatAccount, registration);
|
||||
|
||||
seedWords.fire();
|
||||
if (subMenuNavigationItem == null)
|
||||
subMenuNavigationItem = NavigationItem.SEED_WORDS;
|
||||
|
||||
loadView(subMenuNavigationItem);
|
||||
|
||||
switch (subMenuNavigationItem) {
|
||||
case SEED_WORDS:
|
||||
seedWords.setSelected(true);
|
||||
break;
|
||||
case CHANGE_PASSWORD:
|
||||
password.setSelected(true);
|
||||
break;
|
||||
case RESTRICTIONS:
|
||||
restrictions.setSelected(true);
|
||||
break;
|
||||
case FIAT_ACCOUNT:
|
||||
fiatAccount.setSelected(true);
|
||||
break;
|
||||
case REGISTRATION:
|
||||
registration.setSelected(true);
|
||||
break;
|
||||
default:
|
||||
log.error(subMenuNavigationItem.getFxmlUrl() + " is no subMenuNavigationItem");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("EmptyMethod")
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
package io.bitsquare.gui.view.account;
|
||||
|
||||
import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.CodeBehind;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.pm.PresentationModel;
|
||||
import io.bitsquare.gui.pm.account.AccountSetupPM;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.gui.view.CachedCodeBehind;
|
||||
import io.bitsquare.gui.view.CodeBehind;
|
||||
import io.bitsquare.gui.view.account.content.ContextAware;
|
||||
import io.bitsquare.gui.view.account.content.FiatAccountViewCB;
|
||||
import io.bitsquare.gui.view.account.content.PasswordViewCB;
|
||||
|
@ -175,7 +175,7 @@ class WizardItem extends HBox {
|
|||
private final Parent content;
|
||||
private final NavigationItem navigationItem;
|
||||
|
||||
WizardItem(AccountSetupViewCB parentCB, Parent content, String title, String subTitle,
|
||||
WizardItem(AccountSetupViewCB parentCB, Parent content, String title, String subTitle,
|
||||
NavigationItem navigationItem) {
|
||||
this.parentCB = parentCB;
|
||||
this.content = content;
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
package io.bitsquare.gui.view.account.content;
|
||||
|
||||
import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.help.Help;
|
||||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.account.content.ChangePasswordPM;
|
||||
import io.bitsquare.gui.view.CachedCodeBehind;
|
||||
import io.bitsquare.gui.view.account.AccountSetupViewCB;
|
||||
|
||||
import java.net.URL;
|
||||
|
|
|
@ -19,13 +19,13 @@ package io.bitsquare.gui.view.account.content;
|
|||
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.bank.BankAccountType;
|
||||
import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.components.InputTextField;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.help.Help;
|
||||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.account.content.FiatAccountPm;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.gui.view.CachedCodeBehind;
|
||||
import io.bitsquare.gui.view.account.AccountSetupViewCB;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.Region;
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
package io.bitsquare.gui.view.account.content;
|
||||
|
||||
import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.help.Help;
|
||||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.account.content.PasswordPM;
|
||||
import io.bitsquare.gui.view.CachedCodeBehind;
|
||||
import io.bitsquare.gui.view.account.AccountSetupViewCB;
|
||||
|
||||
import java.net.URL;
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
|
||||
package io.bitsquare.gui.view.account.content;
|
||||
|
||||
import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.OverlayController;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.components.btc.AddressTextField;
|
||||
import io.bitsquare.gui.components.btc.BalanceTextField;
|
||||
import io.bitsquare.gui.help.Help;
|
||||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.account.content.RegistrationPM;
|
||||
import io.bitsquare.gui.view.MainViewCB;
|
||||
import io.bitsquare.gui.view.CachedCodeBehind;
|
||||
import io.bitsquare.gui.view.account.AccountSetupViewCB;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
|
||||
|
@ -52,6 +52,7 @@ public class RegistrationViewCB extends CachedCodeBehind<RegistrationPM> impleme
|
|||
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistrationViewCB.class);
|
||||
|
||||
private OverlayController overlayController;
|
||||
|
||||
@FXML private TextField feeTextField;
|
||||
@FXML private AddressTextField addressTextField;
|
||||
|
@ -64,8 +65,9 @@ public class RegistrationViewCB extends CachedCodeBehind<RegistrationPM> impleme
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
private RegistrationViewCB(RegistrationPM presentationModel) {
|
||||
private RegistrationViewCB(RegistrationPM presentationModel, OverlayController overlayController) {
|
||||
super(presentationModel);
|
||||
this.overlayController = overlayController;
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,6 +83,10 @@ public class RegistrationViewCB extends CachedCodeBehind<RegistrationPM> impleme
|
|||
addressTextField.setAmountAsCoin(presentationModel.getFeeAsCoin());
|
||||
addressTextField.setPaymentLabel(presentationModel.getPaymentLabel());
|
||||
addressTextField.setAddress(presentationModel.getAddressAsString());
|
||||
|
||||
// TODO find better solution
|
||||
addressTextField.setOverlayController(overlayController);
|
||||
|
||||
balanceTextField.setup(presentationModel.getWalletFacade(), presentationModel.address.get());
|
||||
|
||||
payButton.disableProperty().bind(presentationModel.isPayButtonDisabled);
|
||||
|
@ -95,7 +101,7 @@ public class RegistrationViewCB extends CachedCodeBehind<RegistrationPM> impleme
|
|||
|
||||
presentationModel.showTransactionPublishedScreen.addListener((o, oldValue, newValue) -> {
|
||||
if (newValue) {
|
||||
MainViewCB.getInstance().blurContentScreen();
|
||||
overlayController.blurContent();
|
||||
|
||||
List<Action> actions = new ArrayList<>();
|
||||
actions.add(new AbstractAction(BSResources.get("shared.copyTxId")) {
|
||||
|
@ -117,7 +123,7 @@ public class RegistrationViewCB extends CachedCodeBehind<RegistrationPM> impleme
|
|||
e.printStackTrace();
|
||||
}
|
||||
Dialog.Actions.CLOSE.handle(actionEvent);
|
||||
MainViewCB.getInstance().removeContentScreenBlur();
|
||||
overlayController.removeBlurContent();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ package io.bitsquare.gui.view.account.content;
|
|||
|
||||
import io.bitsquare.BitSquare;
|
||||
import io.bitsquare.arbitrator.Arbitrator;
|
||||
import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.help.Help;
|
||||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.account.content.RestrictionsPM;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.gui.view.CachedCodeBehind;
|
||||
import io.bitsquare.gui.view.account.AccountSetupViewCB;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.Region;
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
package io.bitsquare.gui.view.account.content;
|
||||
|
||||
import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.help.Help;
|
||||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.account.content.SeedWordsPM;
|
||||
import io.bitsquare.gui.view.CachedCodeBehind;
|
||||
import io.bitsquare.gui.view.account.AccountSetupViewCB;
|
||||
|
||||
import java.net.URL;
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
|
||||
package io.bitsquare.gui.view.trade;
|
||||
|
||||
import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.OverlayController;
|
||||
import io.bitsquare.gui.components.InfoDisplay;
|
||||
import io.bitsquare.gui.components.InputTextField;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
|
@ -28,7 +29,7 @@ import io.bitsquare.gui.help.Help;
|
|||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.trade.CreateOfferPM;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.gui.view.MainViewCB;
|
||||
import io.bitsquare.gui.view.CachedCodeBehind;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.trade.orderbook.OrderBookFilter;
|
||||
|
||||
|
@ -73,6 +74,9 @@ import static javafx.beans.binding.Bindings.createStringBinding;
|
|||
public class CreateOfferViewCB extends CachedCodeBehind<CreateOfferPM> {
|
||||
private static final Logger log = LoggerFactory.getLogger(CreateOfferViewCB.class);
|
||||
|
||||
private NavigationController navigationController;
|
||||
private OverlayController overlayController;
|
||||
|
||||
private boolean detailsVisible;
|
||||
private boolean advancedScreenInited;
|
||||
private Callable<Void> onCloseCallable;
|
||||
|
@ -105,8 +109,11 @@ public class CreateOfferViewCB extends CachedCodeBehind<CreateOfferPM> {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
private CreateOfferViewCB(CreateOfferPM presentationModel) {
|
||||
private CreateOfferViewCB(CreateOfferPM presentationModel, NavigationController navigationController,
|
||||
OverlayController overlayController) {
|
||||
super(presentationModel);
|
||||
this.navigationController = navigationController;
|
||||
this.overlayController = overlayController;
|
||||
}
|
||||
|
||||
|
||||
|
@ -234,7 +241,9 @@ public class CreateOfferViewCB extends CachedCodeBehind<CreateOfferPM> {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void openAccountSettings() {
|
||||
MainViewCB.getInstance().triggerMainMenuButton(NavigationItem.ACCOUNT);
|
||||
navigationController.navigationTo(NavigationItem.ACCOUNT,
|
||||
NavigationItem.ACCOUNT_SETTINGS,
|
||||
NavigationItem.RESTRICTIONS);
|
||||
}
|
||||
|
||||
private void close() {
|
||||
|
@ -242,6 +251,7 @@ public class CreateOfferViewCB extends CachedCodeBehind<CreateOfferPM> {
|
|||
tabPane.getTabs().remove(tabPane.getSelectionModel().getSelectedItem());
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private Methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -306,7 +316,7 @@ public class CreateOfferViewCB extends CachedCodeBehind<CreateOfferPM> {
|
|||
|
||||
presentationModel.showTransactionPublishedScreen.addListener((o, oldValue, newValue) -> {
|
||||
if (newValue) {
|
||||
MainViewCB.getInstance().blurContentScreen();
|
||||
overlayController.blurContent();
|
||||
|
||||
// Dialogs are a bit limited. There is no callback for the InformationDialog button click, so we added
|
||||
// our own actions.
|
||||
|
@ -329,7 +339,7 @@ public class CreateOfferViewCB extends CachedCodeBehind<CreateOfferPM> {
|
|||
e.printStackTrace();
|
||||
}
|
||||
Dialog.Actions.CLOSE.handle(actionEvent);
|
||||
MainViewCB.getInstance().removeContentScreenBlur();
|
||||
overlayController.removeBlurContent();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue