Refactored MainView

This commit is contained in:
Manfred Karrer 2014-09-09 15:42:49 +02:00
parent 11cff6dcdb
commit dcceb85669
32 changed files with 763 additions and 464 deletions

View File

@ -22,6 +22,7 @@ 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.msg.BootstrappedPeerFactory;
import io.bitsquare.msg.MessageFacade;
import io.bitsquare.msg.P2PNode;
@ -63,6 +64,7 @@ public class BitSquareModule extends AbstractModule {
bind(BootstrappedPeerFactory.class).asEagerSingleton();
bind(TradeManager.class).asEagerSingleton();
bind(MainViewCB.class).asEagerSingleton();
//bind(String.class).annotatedWith(Names.named("networkType")).toInstance(WalletFacade.MAIN_NET);

View File

@ -22,7 +22,7 @@ import io.bitsquare.gui.util.ImageUtil;
public enum NavigationItem {
// app
MAIN("/io/bitsquare/gui/MainView.fxml"),
MAIN("/io/bitsquare/gui/view/MainView.fxml"),
// main menu screens
HOME("/io/bitsquare/gui/home/HomeView.fxml", ImageUtil.HOME, ImageUtil.HOME_ACTIVE),

View File

@ -18,7 +18,7 @@
package io.bitsquare.gui.components;
import io.bitsquare.BitSquare;
import io.bitsquare.gui.MainController;
import io.bitsquare.gui.view.MainViewCB;
import io.bitsquare.locale.BSResources;
import com.google.bitcoin.store.BlockStoreException;
@ -56,7 +56,7 @@ public class Popups {
// Supports blurring the content background
public static void openInfo(String message, String masthead) {
MainController.GET_INSTANCE().blurContentScreen();
MainViewCB.getInstance().blurContentScreen();
List<Action> actions = new ArrayList<>();
// Dialogs are a bit limited. There is no callback for the InformationDialog button click, so we added
@ -65,7 +65,7 @@ public class Popups {
@Override
public void handle(ActionEvent actionEvent) {
Dialog.Actions.CLOSE.handle(actionEvent);
MainController.GET_INSTANCE().removeContentScreenBlur();
MainViewCB.getInstance().removeContentScreenBlur();
}
});
openInfo(message, masthead, actions);

View File

@ -17,8 +17,8 @@
package io.bitsquare.gui.components.btc;
import io.bitsquare.gui.MainController;
import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.view.MainViewCB;
import com.google.bitcoin.core.Coin;
import com.google.bitcoin.uri.BitcoinURI;
@ -124,13 +124,13 @@ public class AddressTextField extends AnchorPane {
PopOver popOver = new PopOver(pane);
popOver.setDetachedTitle("Scan QR code for this address");
popOver.setDetached(true);
popOver.setOnHiding(windowEvent -> MainController.GET_INSTANCE().removeContentScreenBlur());
popOver.setOnHiding(windowEvent -> MainViewCB.getInstance().removeContentScreenBlur());
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);
MainController.GET_INSTANCE().blurContentScreen();
MainViewCB.getInstance().blurContentScreen();
}
});

View File

@ -0,0 +1,210 @@
/*
* 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.model;
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;
import io.bitsquare.persistence.Persistence;
import io.bitsquare.trade.TradeManager;
import io.bitsquare.user.User;
import com.google.bitcoin.core.Coin;
import com.google.inject.Inject;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.ObservableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MainModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(MainModel.class);
private final User user;
private final WalletFacade walletFacade;
private final MessageFacade messageFacade;
private final TradeManager tradeManager;
private final Persistence persistence;
private boolean messageFacadeInited;
private boolean walletFacadeInited;
public final BooleanProperty backendInited = new SimpleBooleanProperty();
public final DoubleProperty networkSyncProgress = new SimpleDoubleProperty();
public final BooleanProperty networkSyncComplete = new SimpleBooleanProperty();
public final BooleanProperty takeOfferRequested = new SimpleBooleanProperty();
public final ObjectProperty<Coin> balance = new SimpleObjectProperty<>();
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private MainModel(User user, WalletFacade walletFacade, MessageFacade messageFacade,
TradeManager tradeManager, Persistence persistence) {
this.user = user;
this.walletFacade = walletFacade;
this.messageFacade = messageFacade;
this.tradeManager = tradeManager;
this.persistence = persistence;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Lifecycle
///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override
public void initialized() {
super.initialized();
}
@Override
public void activate() {
super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void terminate() {
super.terminate();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Public
///////////////////////////////////////////////////////////////////////////////////////////
public void initBackend() {
Profiler.printMsgWithTime("MainModel.initFacades");
messageFacade.init(new BootstrapListener() {
@Override
public void onCompleted() {
messageFacadeInited = true;
if (walletFacadeInited) onFacadesInitialised();
}
@Override
public void onFailed(Throwable throwable) {
log.error(throwable.toString());
}
});
walletFacade.initialize(() -> {
walletFacadeInited = true;
if (messageFacadeInited)
onFacadesInitialised();
walletFacade.addBalanceListener(new BalanceListener() {
@Override
public void onBalanceChanged(Coin balance) {
updateBalance(balance);
}
});
updateBalance(walletFacade.getWalletBalance());
});
}
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
public void setSelectedNavigationItem(NavigationItem navigationItem) {
persistence.write(this, "selectedNavigationItem", navigationItem);
}
public void setCurrentBankAccount(BankAccount bankAccount) {
user.setCurrentBankAccount(bankAccount);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Getters
///////////////////////////////////////////////////////////////////////////////////////////
public ObservableList<BankAccount> getBankAccounts() {
return user.getBankAccounts();
}
public ObjectProperty<BankAccount> currentBankAccountProperty() {
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;
return selectedNavigationItem;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Private
///////////////////////////////////////////////////////////////////////////////////////////
private void onFacadesInitialised() {
Profiler.printMsgWithTime("MainModel.onFacadesInitialised");
// TODO Check this: never called on regtest
// Consider to use version from Mike Hearn
walletFacade.addDownloadListener(new WalletFacade.DownloadListener() {
@Override
public void progress(double percent) {
networkSyncProgress.set(percent);
}
@Override
public void downloadComplete() {
networkSyncComplete.set(true);
}
});
tradeManager.addTakeOfferRequestListener((offerId, sender) -> takeOfferRequested.set(true));
backendInited.set(true);
}
private void updateBalance(Coin balance) {
this.balance.set(balance);
}
}

View File

@ -0,0 +1,166 @@
/*
* 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.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;
import com.google.inject.Inject;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.util.StringConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MainPM extends PresentationModel<MainModel> {
private static final Logger log = LoggerFactory.getLogger(MainPM.class);
public final BooleanProperty backendInited = new SimpleBooleanProperty();
public final StringProperty balance = new SimpleStringProperty();
public final StringProperty bankAccountsComboBoxPrompt = new SimpleStringProperty();
public final BooleanProperty bankAccountsComboBoxDisable = new SimpleBooleanProperty();
public final StringProperty splashScreenInfoText = new SimpleStringProperty();
public final BooleanProperty networkSyncComplete = new SimpleBooleanProperty();
public final BooleanProperty takeOfferRequested = new SimpleBooleanProperty();
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private MainPM(MainModel model) {
super(model);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Lifecycle
///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override
public void initialized() {
super.initialized();
backendInited.bind(model.backendInited);
networkSyncComplete.bind(model.networkSyncComplete);
takeOfferRequested.bind(model.takeOfferRequested);
model.networkSyncProgress.addListener((ov, oldValue, newValue) -> {
if ((double) newValue > 0)
splashScreenInfoText.set("Synchronise with network " + BSFormatter.formatToPercent((double) newValue));
else if ((double) newValue == 1)
splashScreenInfoText.set("Synchronise with network completed.");
else
splashScreenInfoText.set("Synchronise with network...");
});
model.balance.addListener((ov, oldValue, newValue) -> balance.set(BSFormatter.formatCoinWithCode
(newValue)));
model.getBankAccounts().addListener((ListChangeListener<BankAccount>) change -> {
bankAccountsComboBoxDisable.set(change.getList().isEmpty());
bankAccountsComboBoxPrompt.set(change.getList().isEmpty() ? "No accounts" : "");
});
bankAccountsComboBoxDisable.set(model.getBankAccounts().isEmpty());
bankAccountsComboBoxPrompt.set(model.getBankAccounts().isEmpty() ? "No accounts" : "");
}
@Override
public void activate() {
super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void terminate() {
super.terminate();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Public
///////////////////////////////////////////////////////////////////////////////////////////
public void initBackend() {
model.initBackend();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
public void setSelectedNavigationItem(NavigationItem navigationItem) {
model.setSelectedNavigationItem(navigationItem);
}
public void setCurrentBankAccount(BankAccount bankAccount) {
model.setCurrentBankAccount(bankAccount);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Getters
///////////////////////////////////////////////////////////////////////////////////////////
public NavigationItem getSelectedNavigationItem() {
return model.getSelectedNavigationItem();
}
public ObservableList<BankAccount> getBankAccounts() {
return model.getBankAccounts();
}
public ObjectProperty<BankAccount> currentBankAccountProperty() {
return model.currentBankAccountProperty();
}
public StringConverter<BankAccount> getBankAccountsConverter() {
return new StringConverter<BankAccount>() {
@Override
public String toString(BankAccount bankAccount) {
return bankAccount.getAccountTitle();
}
@Override
public BankAccount fromString(String s) {
return null;
}
};
}
}

View File

@ -22,7 +22,7 @@ import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.trade.orderbook.OrderBookController;
import io.bitsquare.gui.trade.takeoffer.TakeOfferController;
import io.bitsquare.gui.view.trade.CreateOfferCB;
import io.bitsquare.gui.view.trade.CreateOfferViewCB;
import io.bitsquare.trade.Direction;
import io.bitsquare.util.BSFXMLLoader;
@ -47,7 +47,7 @@ public class TradeController extends CachedViewController {
private static final Logger log = LoggerFactory.getLogger(TradeController.class);
protected OrderBookController orderBookController;
protected CreateOfferCB createOfferCodeBehind;
protected CreateOfferViewCB createOfferCodeBehind;
protected TakeOfferController takeOfferController;
protected BSFXMLLoader orderBookLoader;
private Node createOfferView;

View File

@ -21,14 +21,14 @@ import io.bitsquare.bank.BankAccountType;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.gui.CachedViewController;
import io.bitsquare.gui.CodeBehind;
import io.bitsquare.gui.MainController;
import io.bitsquare.gui.NavigationItem;
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.trade.CreateOfferCB;
import io.bitsquare.gui.view.MainViewCB;
import io.bitsquare.gui.view.trade.CreateOfferViewCB;
import io.bitsquare.locale.BSResources;
import io.bitsquare.locale.Country;
import io.bitsquare.locale.CurrencyUtil;
@ -245,7 +245,7 @@ public class OrderBookController extends CachedViewController {
}
if (nextController != null)
((CreateOfferCB) nextController).setOrderBookFilter(orderBookFilter);
((CreateOfferViewCB) nextController).setOrderBookFilter(orderBookFilter);
}
else {
openSetupScreen();
@ -270,16 +270,16 @@ public class OrderBookController extends CachedViewController {
private void openSetupScreen() {
MainController.GET_INSTANCE().blurContentScreen();
MainViewCB.getInstance().blurContentScreen();
List<Action> actions = new ArrayList<>();
actions.add(new AbstractAction(BSResources.get("shared.ok")) {
@Override
public void handle(ActionEvent actionEvent) {
Dialog.Actions.OK.handle(actionEvent);
MainController.GET_INSTANCE().removeContentScreenBlur();
MainViewCB.getInstance().removeContentScreenBlur();
MainController.GET_INSTANCE().loadViewAndGetChildController(NavigationItem.ACCOUNT);
MainController.GET_INSTANCE()
MainViewCB.getInstance().triggerMainMenuButton(NavigationItem.ACCOUNT);
MainViewCB.getInstance()
.setPreviousNavigationItem((orderBookFilter.getDirection() == Direction.BUY) ?
NavigationItem.BUY : NavigationItem.SELL);
}

View File

@ -291,6 +291,14 @@ public class BSFormatter {
return decimalFormat.format(collateral / 10) + " %";
}
public static String formatToPercent(double value) {
DecimalFormat decimalFormat = (DecimalFormat) DecimalFormat.getInstance(locale);
decimalFormat.setMinimumFractionDigits(1);
decimalFormat.setMaximumFractionDigits(1);
decimalFormat.setGroupingUsed(false);
return decimalFormat.format(value / 100) + " %";
}
public static String formatVolumeWithMinVolume(Fiat volume, Fiat minVolume) {
return formatFiat(volume) + " (" + formatFiat(minVolume) + ")";
}

View File

@ -19,7 +19,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<TabPane fx:id="root" fx:controller="io.bitsquare.gui.view.AccountCB"
<TabPane fx:id="root" fx:controller="io.bitsquare.gui.view.AccountViewCB"
prefHeight="630.0" prefWidth="1000.0"
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"

View File

@ -19,10 +19,9 @@ package io.bitsquare.gui.view;
import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.CodeBehind;
import io.bitsquare.gui.MainController;
import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.pm.AccountPM;
import io.bitsquare.gui.view.account.AccountSetupCB;
import io.bitsquare.gui.view.account.AccountSetupViewCB;
import io.bitsquare.util.BSFXMLLoader;
import java.io.IOException;
@ -40,9 +39,9 @@ import javafx.scene.layout.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AccountCB extends CachedCodeBehind<AccountPM> {
public class AccountViewCB extends CachedCodeBehind<AccountPM> {
private static final Logger log = LoggerFactory.getLogger(AccountCB.class);
private static final Logger log = LoggerFactory.getLogger(AccountViewCB.class);
public Tab tab;
@ -52,7 +51,7 @@ public class AccountCB extends CachedCodeBehind<AccountPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private AccountCB(AccountPM presentationModel) {
private AccountViewCB(AccountPM presentationModel) {
super(presentationModel);
}
@ -111,8 +110,8 @@ public class AccountCB extends CachedCodeBehind<AccountPM> {
Initializable childController = loader.getController();
((CodeBehind) childController).setParentController(this);
if (childController instanceof AccountSetupCB)
((AccountSetupCB) childController).setRemoveCallBack(() -> {
if (childController instanceof AccountSetupViewCB)
((AccountSetupViewCB) childController).setRemoveCallBack(() -> {
removeSetup();
return null;
});
@ -132,11 +131,11 @@ public class AccountCB extends CachedCodeBehind<AccountPM> {
private void removeSetup() {
childController = null;
NavigationItem previousItem = MainController.GET_INSTANCE().getPreviousNavigationItem();
NavigationItem previousItem = MainViewCB.getInstance().getPreviousNavigationItem();
if (previousItem == null)
previousItem = NavigationItem.HOME;
MainController.GET_INSTANCE().loadViewAndGetChildController(previousItem);
MainViewCB.getInstance().triggerMainMenuButton(previousItem);
}
}

View File

@ -17,7 +17,7 @@
-->
<?import javafx.scene.layout.*?>
<StackPane fx:id="root" fx:controller="io.bitsquare.gui.MainController"
<StackPane fx:id="root" fx:controller="io.bitsquare.gui.view.MainViewCB"
prefHeight="750" prefWidth="1000" stylesheets="/io/bitsquare/gui/bitsquare.css"
xmlns:fx="http://javafx.com/fxml">
</StackPane>

View File

@ -15,27 +15,21 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui;
package io.bitsquare.gui.view;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.btc.listeners.BalanceListener;
import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.CodeBehind;
import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.components.NetworkSyncPane;
import io.bitsquare.gui.orders.OrdersController;
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.gui.pm.MainPM;
import io.bitsquare.gui.util.ImageUtil;
import io.bitsquare.gui.util.Profiler;
import io.bitsquare.gui.util.Transitions;
import io.bitsquare.msg.MessageFacade;
import io.bitsquare.msg.listeners.BootstrapListener;
import io.bitsquare.persistence.Persistence;
import io.bitsquare.trade.TradeManager;
import io.bitsquare.user.User;
import io.bitsquare.util.AWTSystemTray;
import io.bitsquare.util.BSFXMLLoader;
import com.google.bitcoin.core.Coin;
import java.io.IOException;
import java.net.URL;
@ -45,9 +39,6 @@ import java.util.ResourceBundle;
import javax.inject.Inject;
import javafx.application.Platform;
import javafx.beans.Observable;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.Initializable;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
@ -55,9 +46,6 @@ import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.image.*;
import javafx.scene.layout.*;
import javafx.util.StringConverter;
import net.tomp2p.peers.PeerAddress;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -68,32 +56,35 @@ import org.slf4j.LoggerFactory;
* frozen for too long. Pre-loading of views is not implemented yet, and after a quick test it seemed that it does not
* give much improvements.
*/
public class MainController extends ViewController {
private static final Logger log = LoggerFactory.getLogger(MainController.class);
private static MainController INSTANCE;
public class MainViewCB extends CachedCodeBehind<MainPM> {
private static final Logger log = LoggerFactory.getLogger(MainViewCB.class);
//TODO
private static MainViewCB instance;
private final User user;
private final WalletFacade walletFacade;
private final MessageFacade messageFacade;
private final TradeManager tradeManager;
private final Persistence persistence;
private final ViewBuilder viewBuilder;
private boolean showNetworkSyncPaneRequested;
private VBox baseOverlayContainer;
private final ToggleGroup navButtonsGroup = new ToggleGroup();
private NavigationItem previousNavigationItem;
private AnchorPane contentPane;
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 ordersButtonButtonHolder;
private boolean messageFacadeInited;
private boolean walletFacadeInited;
private NavigationItem previousNavigationItem;
private Pane ordersButtonButtonPane;
///////////////////////////////////////////////////////////////////////////////////////////
// Static
///////////////////////////////////////////////////////////////////////////////////////////
public static MainController GET_INSTANCE() {
return INSTANCE;
//TODO
public static MainViewCB getInstance() {
return instance;
}
@ -102,17 +93,11 @@ public class MainController extends ViewController {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private MainController(User user, WalletFacade walletFacade, MessageFacade messageFacade,
TradeManager tradeManager, Persistence persistence) {
this.user = user;
this.walletFacade = walletFacade;
this.messageFacade = messageFacade;
this.tradeManager = tradeManager;
this.persistence = persistence;
private MainViewCB(MainPM presentationModel) {
super(presentationModel);
viewBuilder = new ViewBuilder();
MainController.INSTANCE = this;
//TODO
MainViewCB.instance = this;
}
@ -120,14 +105,27 @@ public class MainController extends ViewController {
// Lifecycle
///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override
public void initialize(URL url, ResourceBundle rb) {
super.initialize(url, rb);
Profiler.printMsgWithTime("MainController.initialize");
Platform.runLater(() -> viewBuilder.buildSplashScreen((StackPane) root, this));
startup();
}
@Override
public void activate() {
super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void terminate() {
super.terminate();
@ -138,8 +136,7 @@ public class MainController extends ViewController {
// Navigation
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public Initializable loadViewAndGetChildController(NavigationItem navigationItem) {
public Initializable triggerMainMenuButton(NavigationItem navigationItem) {
switch (navigationItem) {
case HOME:
homeButton.fire();
@ -169,176 +166,256 @@ public class MainController extends ViewController {
return childController;
}
@Override
public Initializable loadView(NavigationItem navigationItem) {
super.loadView((navigationItem));
final BSFXMLLoader loader = new BSFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()));
try {
final Node view = loader.load();
contentPane.getChildren().setAll(view);
childController = loader.getController();
if (childController instanceof CodeBehind)
((CodeBehind) childController).setParentController(this);
presentationModel.setSelectedNavigationItem(navigationItem);
return childController;
} catch (IOException e) {
e.getStackTrace();
log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl());
}
return null;
}
public void setPreviousNavigationItem(NavigationItem previousNavigationItem) {
this.previousNavigationItem = previousNavigationItem;
}
public NavigationItem getPreviousNavigationItem() {
return previousNavigationItem;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Blur effect
// Blur
///////////////////////////////////////////////////////////////////////////////////////////
public void removeContentScreenBlur() {
Transitions.removeBlur(viewBuilder.baseContentContainer);
Transitions.removeBlur(baseContentContainer);
}
public void blurContentScreen() {
Transitions.blur(viewBuilder.baseContentContainer);
Transitions.blur(baseContentContainer);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Startup Handlers
// Private Methods: Startup
///////////////////////////////////////////////////////////////////////////////////////////
void onViewInitialized() {
Profiler.printMsgWithTime("MainController.onViewInitialized");
Platform.runLater(this::initFacades);
private void startup() {
buildBaseContainers();
}
private void onFacadesInitialised() {
Profiler.printMsgWithTime("MainController.onFacadesInitialised");
// never called on regtest
walletFacade.addDownloadListener(new WalletFacade.DownloadListener() {
@Override
public void progress(double percent) {
viewBuilder.loadingLabel.setText("Synchronise with network...");
if (viewBuilder.networkSyncPane == null)
viewBuilder.setShowNetworkSyncPane();
}
private void buildBaseContainers() {
Profiler.printMsgWithTime("MainController.ViewBuilder.buildBaseContainers");
@Override
public void downloadComplete() {
viewBuilder.loadingLabel.setText("Synchronise with network done.");
if (viewBuilder.networkSyncPane != null)
viewBuilder.networkSyncPane.downloadComplete();
}
baseContentContainer = getBaseContentContainer();
baseContentContainer.setOpacity(0);
baseOverlayContainer = getSplashScreen();
((StackPane) root).getChildren().addAll(baseContentContainer, baseOverlayContainer);
Platform.runLater(this::buildContentView);
}
private void buildContentView() {
Profiler.printMsgWithTime("MainController.ViewBuilder.buildContentView");
menuBar = getMenuBar();
contentScreen = getContentScreen();
if (showNetworkSyncPaneRequested)
addNetworkSyncPane();
baseContentContainer.setTop(menuBar);
baseContentContainer.setCenter(contentScreen);
Platform.runLater(this::onBaseContainersCreated);
}
// We need to wait until the backend is initialized as we need it for menu items like the balance field
private void onBaseContainersCreated() {
Profiler.printMsgWithTime("MainController.onBaseContainersCreated");
presentationModel.backendInited.addListener((ov, oldValue, newValue) -> {
if (newValue)
onBackendInited();
});
tradeManager.addTakeOfferRequestListener(this::onTakeOfferRequested);
Platform.runLater(this::addNavigation);
presentationModel.initBackend();
}
private void onNavigationAdded() {
Profiler.printMsgWithTime("MainController.onNavigationAdded");
Platform.runLater(this::loadContentView);
private void onBackendInited() {
Profiler.printMsgWithTime("MainController.onBackendInited");
addMainNavigation();
}
private void onContentViewLoaded() {
Profiler.printMsgWithTime("MainController.onContentViewLoaded");
private void onMainNavigationAdded() {
Profiler.printMsgWithTime("MainController.ondMainNavigationAdded");
triggerMainMenuButton(presentationModel.getSelectedNavigationItem());
Platform.runLater(this::onContentAdded);
}
private void onContentAdded() {
Profiler.printMsgWithTime("MainController.onContentAdded");
presentationModel.takeOfferRequested.addListener((ov, olaValue, newValue) -> {
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);
});
Tooltip.install(alertButton, new Tooltip("Your offer has been accepted"));
ordersButtonButtonPane.getChildren().add(alertButton);
AWTSystemTray.setAlert();
});
Platform.runLater(this::fadeOutSplash);
}
private void fadeOutSplash() {
Profiler.printMsgWithTime("MainController.fadeOutSplash");
Transitions.blur(viewBuilder.splashVBox, 700, false, true);
Transitions.fadeIn(viewBuilder.menuBar);
Transitions.fadeIn(viewBuilder.contentScreen);
Transitions.blur(baseOverlayContainer, 700, false, true);
Transitions.fadeIn(baseContentContainer);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Handlers
// Private
///////////////////////////////////////////////////////////////////////////////////////////
//TODO make ordersButton also reacting to jump to pending tab
private void onTakeOfferRequested(String offerId, PeerAddress sender) {
final Button alertButton = new Button("", ImageUtil.getIconImageView(ImageUtil.MSG_ALERT));
alertButton.setId("nav-alert-button");
alertButton.relocate(36, 19);
alertButton.setOnAction((e) -> {
ordersButton.fire();
OrdersController.GET_INSTANCE().setSelectedTabIndex(1);
});
Tooltip.install(alertButton, new Tooltip("Someone accepted your offer"));
ordersButtonButtonHolder.getChildren().add(alertButton);
AWTSystemTray.setAlert();
private BorderPane getBaseContentContainer() {
BorderPane borderPane = new BorderPane();
borderPane.setId("base-content-container");
return borderPane;
}
private VBox getSplashScreen() {
VBox vBox = new VBox();
vBox.setAlignment(Pos.CENTER);
vBox.setSpacing(10);
vBox.setId("splash");
///////////////////////////////////////////////////////////////////////////////////////////
// Private startup methods
///////////////////////////////////////////////////////////////////////////////////////////
ImageView logo = ImageUtil.getIconImageView(ImageUtil.SPLASH_LOGO);
logo.setFitWidth(300);
logo.setFitHeight(300);
private void initFacades() {
Profiler.printMsgWithTime("MainController.initFacades");
messageFacade.init(new BootstrapListener() {
@Override
public void onCompleted() {
messageFacadeInited = true;
if (walletFacadeInited) onFacadesInitialised();
}
Label subTitle = new Label("The decentralized Bitcoin exchange");
subTitle.setAlignment(Pos.CENTER);
subTitle.setId("logo-sub-title-label");
@Override
public void onFailed(Throwable throwable) {
log.error(throwable.toString());
}
});
loadingLabel = new Label();
loadingLabel.setAlignment(Pos.CENTER);
loadingLabel.setPadding(new Insets(80, 0, 0, 0));
loadingLabel.textProperty().bind(presentationModel.splashScreenInfoText);
walletFacade.initialize(() -> {
walletFacadeInited = true;
if (messageFacadeInited) onFacadesInitialised();
});
vBox.getChildren().addAll(logo, subTitle, loadingLabel);
return vBox;
}
private void addNavigation() {
Profiler.printMsgWithTime("MainController.addNavigation");
private MenuBar getMenuBar() {
MenuBar menuBar = new MenuBar();
menuBar.setUseSystemMenuBar(false);
homeButton = addNavButton(viewBuilder.leftNavPane, "Overview", NavigationItem.HOME);
buyButton = addNavButton(viewBuilder.leftNavPane, "Buy BTC", NavigationItem.BUY);
sellButton = addNavButton(viewBuilder.leftNavPane, "Sell BTC", NavigationItem.SELL);
Menu fileMenu = new Menu("_File");
fileMenu.setMnemonicParsing(true);
MenuItem backupMenuItem = new MenuItem("Backup wallet");
fileMenu.getItems().addAll(backupMenuItem);
ordersButtonButtonHolder = new Pane();
ordersButton = addNavButton(ordersButtonButtonHolder, "Orders", NavigationItem.ORDERS);
viewBuilder.leftNavPane.getChildren().add(ordersButtonButtonHolder);
Menu settingsMenu = new Menu("_Settings");
settingsMenu.setMnemonicParsing(true);
MenuItem changePwMenuItem = new MenuItem("Change password");
settingsMenu.getItems().addAll(changePwMenuItem);
fundsButton = addNavButton(viewBuilder.leftNavPane, "Funds", NavigationItem.FUNDS);
Menu helpMenu = new Menu("_Help");
helpMenu.setMnemonicParsing(true);
MenuItem faqMenuItem = new MenuItem("FAQ");
MenuItem forumMenuItem = new MenuItem("Forum");
helpMenu.getItems().addAll(faqMenuItem, forumMenuItem);
menuBar.getMenus().setAll(fileMenu, settingsMenu, helpMenu);
return menuBar;
}
private AnchorPane getContentScreen() {
AnchorPane anchorPane = new AnchorPane();
anchorPane.setId("content-pane");
leftNavPane = new HBox();
leftNavPane.setSpacing(10);
AnchorPane.setLeftAnchor(leftNavPane, 10d);
AnchorPane.setTopAnchor(leftNavPane, 0d);
rightNavPane = new HBox();
rightNavPane.setSpacing(10);
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);
anchorPane.getChildren().addAll(leftNavPane, rightNavPane, contentPane);
return anchorPane;
}
private void addNetworkSyncPane() {
networkSyncPane = new NetworkSyncPane();
networkSyncPane.setSpacing(10);
networkSyncPane.setPrefHeight(20);
AnchorPane.setLeftAnchor(networkSyncPane, 0d);
AnchorPane.setBottomAnchor(networkSyncPane, 5d);
presentationModel.networkSyncComplete.addListener((ov, old, newValue) -> {
if (newValue)
networkSyncPane.downloadComplete();
});
contentScreen.getChildren().addAll(networkSyncPane);
}
private void addMainNavigation() {
homeButton = addNavButton(leftNavPane, "Overview", NavigationItem.HOME);
buyButton = addNavButton(leftNavPane, "Buy BTC", NavigationItem.BUY);
sellButton = addNavButton(leftNavPane, "Sell BTC", NavigationItem.SELL);
ordersButtonButtonPane = new Pane();
ordersButton = addNavButton(ordersButtonButtonPane, "Orders", NavigationItem.ORDERS);
leftNavPane.getChildren().add(ordersButtonButtonPane);
fundsButton = addNavButton(leftNavPane, "Funds", NavigationItem.FUNDS);
final Pane msgButtonHolder = new Pane();
msgButton = addNavButton(msgButtonHolder, "Message", NavigationItem.MSG);
viewBuilder.leftNavPane.getChildren().add(msgButtonHolder);
leftNavPane.getChildren().add(msgButtonHolder);
addBalanceInfo(viewBuilder.rightNavPane);
addBalanceInfo(rightNavPane);
addAccountComboBox(viewBuilder.rightNavPane);
addBankAccountComboBox(rightNavPane);
settingsButton = addNavButton(viewBuilder.rightNavPane, "Settings", NavigationItem.SETTINGS);
accountButton = addNavButton(viewBuilder.rightNavPane, "Account", NavigationItem.ACCOUNT);
settingsButton = addNavButton(rightNavPane, "Settings", NavigationItem.SETTINGS);
accountButton = addNavButton(rightNavPane, "Account", NavigationItem.ACCOUNT);
Platform.runLater(this::onNavigationAdded);
}
private void loadContentView() {
Profiler.printMsgWithTime("MainController.loadContentView");
NavigationItem selectedNavigationItem = (NavigationItem) persistence.read(this, "selectedNavigationItem");
if (selectedNavigationItem == null)
selectedNavigationItem = NavigationItem.BUY;
loadViewAndGetChildController(selectedNavigationItem);
Platform.runLater(this::onContentViewLoaded);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
private void loadView(NavigationItem navigationItem) {
final BSFXMLLoader loader = new BSFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()));
try {
final Node view = loader.load();
viewBuilder.contentPane.getChildren().setAll(view);
childController = loader.getController();
//TODO Remove that when all UIs are converted to CodeBehind
if (childController instanceof ViewController)
((ViewController) childController).setParentController(this);
else if (childController instanceof CodeBehind)
((CodeBehind) childController).setParentController(this);
persistence.write(this, "selectedNavigationItem", navigationItem);
} catch (IOException e) {
log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl());
e.getStackTrace();
}
onMainNavigationAdded();
}
private ToggleButton addNavButton(Pane parent, String title, NavigationItem navigationItem) {
@ -380,13 +457,8 @@ public class MainController extends ViewController {
balanceTextField.setEditable(false);
balanceTextField.setPrefWidth(110);
balanceTextField.setId("nav-balance-label");
balanceTextField.setText(BSFormatter.formatCoinWithCode(walletFacade.getWalletBalance()));
walletFacade.addBalanceListener(new BalanceListener() {
@Override
public void onBalanceChanged(Coin balance) {
balanceTextField.setText(BSFormatter.formatCoinWithCode(walletFacade.getWalletBalance()));
}
});
balanceTextField.textProperty().bind(presentationModel.balance);
final Label titleLabel = new Label("Balance");
titleLabel.setMouseTransparent(true);
@ -402,37 +474,22 @@ public class MainController extends ViewController {
parent.getChildren().add(vBox);
}
private void addAccountComboBox(Pane parent) {
final ObservableList<BankAccount> accounts = user.getBankAccounts();
final ComboBox<BankAccount> comboBox =
new ComboBox<>(FXCollections.observableArrayList(accounts));
private void addBankAccountComboBox(Pane parent) {
final ComboBox<BankAccount> comboBox = new ComboBox<>(presentationModel.getBankAccounts());
comboBox.setLayoutY(12);
comboBox.setVisibleRowCount(5);
comboBox.setConverter(new StringConverter<BankAccount>() {
@Override
public String toString(BankAccount bankAccount) {
return bankAccount.getAccountTitle();
}
comboBox.setConverter(presentationModel.getBankAccountsConverter());
@Override
public BankAccount fromString(String s) {
return null;
}
});
comboBox.valueProperty().addListener((ov, oldValue, newValue) ->
presentationModel.setCurrentBankAccount(newValue));
comboBox.setItems(accounts);
comboBox.valueProperty().addListener((ov, oldValue, newValue) -> user.setCurrentBankAccount(newValue));
accounts.addListener((Observable observable) -> {
comboBox.setPromptText((accounts.size() == 0) ? "No accounts" : "");
comboBox.setDisable((accounts.isEmpty()));
});
comboBox.setPromptText((accounts.isEmpty()) ? "No accounts" : "");
comboBox.setDisable((accounts.isEmpty()));
user.currentBankAccountProperty().addListener((ov, oldValue, newValue) -> {
if (newValue != null)
comboBox.getSelectionModel().select(newValue);
});
comboBox.getSelectionModel().select(user.getCurrentBankAccount());
comboBox.disableProperty().bind(presentationModel.bankAccountsComboBoxDisable);
comboBox.promptTextProperty().bind(presentationModel.bankAccountsComboBoxPrompt);
presentationModel.currentBankAccountProperty().addListener((ov, oldValue, newValue) ->
comboBox.getSelectionModel().select(newValue));
comboBox.getSelectionModel().select(presentationModel.currentBankAccountProperty().get());
final Label titleLabel = new Label("Bank account");
titleLabel.setMouseTransparent(true);
@ -448,149 +505,5 @@ public class MainController extends ViewController {
parent.getChildren().add(vBox);
}
public void setPreviousNavigationItem(NavigationItem previousNavigationItem) {
this.previousNavigationItem = previousNavigationItem;
}
public NavigationItem getPreviousNavigationItem() {
return previousNavigationItem;
}
}
class ViewBuilder {
HBox leftNavPane, rightNavPane;
AnchorPane contentPane;
NetworkSyncPane networkSyncPane;
BorderPane baseContentContainer;
AnchorPane contentScreen;
VBox splashVBox;
MenuBar menuBar;
StackPane root;
Label loadingLabel;
boolean showNetworkSyncPane;
void buildSplashScreen(StackPane root, MainController controller) {
Profiler.printMsgWithTime("MainController.ViewBuilder.buildSplashScreen");
this.root = root;
baseContentContainer = new BorderPane();
baseContentContainer.setId("base-content-container");
splashVBox = getSplashScreen();
root.getChildren().addAll(baseContentContainer, splashVBox);
Platform.runLater(() -> buildContentView(controller));
}
void buildContentView(MainController controller) {
Profiler.printMsgWithTime("MainController.ViewBuilder.buildContentView");
menuBar = getMenuBar();
baseContentContainer.setTop(menuBar);
contentScreen = getContentScreen();
baseContentContainer.setCenter(contentScreen);
Platform.runLater(controller::onViewInitialized);
}
AnchorPane getContentScreen() {
AnchorPane anchorPane = new AnchorPane();
anchorPane.setId("content-pane");
leftNavPane = new HBox();
// leftNavPane.setAlignment(Pos.CENTER);
leftNavPane.setSpacing(10);
AnchorPane.setLeftAnchor(leftNavPane, 10d);
AnchorPane.setTopAnchor(leftNavPane, 0d);
rightNavPane = new HBox();
// rightNavPane.setAlignment(Pos.CENTER);
rightNavPane.setSpacing(10);
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);
anchorPane.getChildren().addAll(leftNavPane, rightNavPane, contentPane);
anchorPane.setOpacity(0);
if (showNetworkSyncPane)
addNetworkSyncPane();
return anchorPane;
}
void setShowNetworkSyncPane() {
showNetworkSyncPane = true;
if (contentScreen != null)
addNetworkSyncPane();
}
private void addNetworkSyncPane() {
networkSyncPane = new NetworkSyncPane();
networkSyncPane.setSpacing(10);
networkSyncPane.setPrefHeight(20);
AnchorPane.setLeftAnchor(networkSyncPane, 0d);
AnchorPane.setBottomAnchor(networkSyncPane, 5d);
contentScreen.getChildren().addAll(networkSyncPane);
}
VBox getSplashScreen() {
VBox splashVBox = new VBox();
splashVBox.setAlignment(Pos.CENTER);
splashVBox.setSpacing(10);
splashVBox.setId("splash");
ImageView logo = ImageUtil.getIconImageView(ImageUtil.SPLASH_LOGO);
logo.setFitWidth(300);
logo.setFitHeight(300);
Label subTitle = new Label("The decentralized Bitcoin exchange");
subTitle.setAlignment(Pos.CENTER);
subTitle.setId("logo-sub-title-label");
loadingLabel = new Label("Initializing...");
loadingLabel.setAlignment(Pos.CENTER);
loadingLabel.setPadding(new Insets(80, 0, 0, 0));
splashVBox.getChildren().addAll(logo, subTitle, loadingLabel);
return splashVBox;
}
MenuBar getMenuBar() {
MenuBar menuBar = new MenuBar();
// on mac we could place menu bar in the systems menu
// menuBar.setUseSystemMenuBar(true);
menuBar.setUseSystemMenuBar(false);
Menu fileMenu = new Menu("_File");
fileMenu.setMnemonicParsing(true);
MenuItem backupMenuItem = new MenuItem("Backup wallet");
fileMenu.getItems().addAll(backupMenuItem);
Menu settingsMenu = new Menu("_Settings");
settingsMenu.setMnemonicParsing(true);
MenuItem changePwMenuItem = new MenuItem("Change password");
settingsMenu.getItems().addAll(changePwMenuItem);
Menu helpMenu = new Menu("_Help");
helpMenu.setMnemonicParsing(true);
MenuItem faqMenuItem = new MenuItem("FAQ");
MenuItem forumMenuItem = new MenuItem("Forum");
helpMenu.getItems().addAll(faqMenuItem, forumMenuItem);
menuBar.getMenus().setAll(fileMenu, settingsMenu, helpMenu);
menuBar.setOpacity(0);
return menuBar;
}
}

View File

@ -19,7 +19,7 @@
<?import javafx.scene.layout.*?>
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.AccountSettingsCB"
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.AccountSettingsViewCB"
prefHeight="660.0" prefWidth="1000.0"
xmlns:fx="http://javafx.com/fxml">

View File

@ -22,7 +22,7 @@ import io.bitsquare.gui.CodeBehind;
import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.pm.account.AccountSettingsPM;
import io.bitsquare.gui.view.account.content.AdjustableAccountContent;
import io.bitsquare.gui.view.account.content.ContextAware;
import io.bitsquare.util.BSFXMLLoader;
import java.io.IOException;
@ -45,9 +45,9 @@ import de.jensd.fx.fontawesome.AwesomeIcon;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AccountSettingsCB extends CachedCodeBehind<AccountSettingsPM> {
public class AccountSettingsViewCB extends CachedCodeBehind<AccountSettingsPM> {
private static final Logger log = LoggerFactory.getLogger(AccountSettingsCB.class);
private static final Logger log = LoggerFactory.getLogger(AccountSettingsViewCB.class);
public VBox leftVBox;
public AnchorPane content;
@ -56,7 +56,7 @@ public class AccountSettingsCB extends CachedCodeBehind<AccountSettingsPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private AccountSettingsCB(AccountSettingsPM presentationModel) {
private AccountSettingsViewCB(AccountSettingsPM presentationModel) {
super(presentationModel);
}
@ -133,11 +133,11 @@ class MenuItem extends ToggleButton {
private CodeBehind<? extends PresentationModel> childController;
private final AccountSettingsCB parentCB;
private final AccountSettingsViewCB parentCB;
private final Parent content;
private final NavigationItem navigationItem;
MenuItem(AccountSettingsCB parentCB, Parent content, String title, NavigationItem navigationItem,
MenuItem(AccountSettingsViewCB parentCB, Parent content, String title, NavigationItem navigationItem,
ToggleGroup toggleGroup) {
this.parentCB = parentCB;
this.content = content;
@ -193,7 +193,7 @@ class MenuItem extends ToggleButton {
((AnchorPane) content).getChildren().setAll(view);
childController = loader.getController();
childController.setParentController(parentCB);
((AdjustableAccountContent) childController).isSettingsMode(true);
((ContextAware) childController).useSettingsContext(true);
} catch (IOException e) {
log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl());
e.getStackTrace();

View File

@ -19,7 +19,7 @@
<?import javafx.scene.layout.*?>
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.AccountSetupCB"
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.AccountSetupViewCB"
xmlns:fx="http://javafx.com/fxml">
<VBox fx:id="leftVBox" spacing="5" prefWidth="300" AnchorPane.bottomAnchor="20" AnchorPane.leftAnchor="20"

View File

@ -23,12 +23,12 @@ import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.pm.account.AccountSetupPM;
import io.bitsquare.gui.util.ImageUtil;
import io.bitsquare.gui.view.account.content.AdjustableAccountContent;
import io.bitsquare.gui.view.account.content.FiatAccountCB;
import io.bitsquare.gui.view.account.content.PasswordCB;
import io.bitsquare.gui.view.account.content.RegistrationCB;
import io.bitsquare.gui.view.account.content.RestrictionsCB;
import io.bitsquare.gui.view.account.content.SeedWordsCB;
import io.bitsquare.gui.view.account.content.ContextAware;
import io.bitsquare.gui.view.account.content.FiatAccountViewCB;
import io.bitsquare.gui.view.account.content.PasswordViewCB;
import io.bitsquare.gui.view.account.content.RegistrationViewCB;
import io.bitsquare.gui.view.account.content.RestrictionsViewCB;
import io.bitsquare.gui.view.account.content.SeedWordsViewCB;
import io.bitsquare.util.BSFXMLLoader;
import java.io.IOException;
@ -50,9 +50,9 @@ import javafx.scene.layout.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AccountSetupCB extends CachedCodeBehind<AccountSetupPM> {
public class AccountSetupViewCB extends CachedCodeBehind<AccountSetupPM> {
private static final Logger log = LoggerFactory.getLogger(AccountSetupCB.class);
private static final Logger log = LoggerFactory.getLogger(AccountSetupViewCB.class);
private WizardItem seedWords, password, fiatAccount, restrictions, registration;
private Callable<Void> requestCloseCallable;
@ -66,7 +66,7 @@ public class AccountSetupCB extends CachedCodeBehind<AccountSetupPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private AccountSetupCB(AccountSetupPM presentationModel) {
private AccountSetupViewCB(AccountSetupPM presentationModel) {
super(presentationModel);
}
@ -122,23 +122,23 @@ public class AccountSetupCB extends CachedCodeBehind<AccountSetupPM> {
///////////////////////////////////////////////////////////////////////////////////////////
public void onCompleted(CodeBehind<? extends PresentationModel> childView) {
if (childView instanceof SeedWordsCB) {
if (childView instanceof SeedWordsViewCB) {
seedWords.onCompleted();
childController = password.show();
}
else if (childView instanceof PasswordCB) {
else if (childView instanceof PasswordViewCB) {
password.onCompleted();
childController = restrictions.show();
}
else if (childView instanceof RestrictionsCB) {
else if (childView instanceof RestrictionsViewCB) {
restrictions.onCompleted();
childController = fiatAccount.show();
}
else if (childView instanceof FiatAccountCB) {
else if (childView instanceof FiatAccountViewCB) {
fiatAccount.onCompleted();
childController = registration.show();
}
else if (childView instanceof RegistrationCB) {
else if (childView instanceof RegistrationViewCB) {
registration.onCompleted();
childController = null;
@ -171,11 +171,12 @@ class WizardItem extends HBox {
private final ImageView imageView;
private final Label titleLabel;
private final Label subTitleLabel;
private final AccountSetupCB parentCB;
private final AccountSetupViewCB parentCB;
private final Parent content;
private final NavigationItem navigationItem;
WizardItem(AccountSetupCB parentCB, Parent content, String title, String subTitle, NavigationItem navigationItem) {
WizardItem(AccountSetupViewCB parentCB, Parent content, String title, String subTitle,
NavigationItem navigationItem) {
this.parentCB = parentCB;
this.content = content;
this.navigationItem = navigationItem;
@ -236,7 +237,7 @@ class WizardItem extends HBox {
((AnchorPane) content).getChildren().setAll(view);
childController = loader.getController();
childController.setParentController(parentCB);
((AdjustableAccountContent) childController).isSettingsMode(false);
((ContextAware) childController).useSettingsContext(false);
} catch (IOException e) {
log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl());
e.getStackTrace();

View File

@ -21,7 +21,7 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.ChangePasswordCB" hgap="5.0" vgap="5.0"
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.ChangePasswordViewCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml">

View File

@ -21,7 +21,7 @@ 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.account.AccountSetupCB;
import io.bitsquare.gui.view.account.AccountSetupViewCB;
import java.net.URL;
@ -36,9 +36,9 @@ import javafx.scene.layout.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ChangePasswordCB extends CachedCodeBehind<ChangePasswordPM> implements AdjustableAccountContent {
public class ChangePasswordViewCB extends CachedCodeBehind<ChangePasswordPM> implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(ChangePasswordCB.class);
private static final Logger log = LoggerFactory.getLogger(ChangePasswordViewCB.class);
@FXML private HBox buttonsHBox;
@FXML private Button saveButton, skipButton;
@ -50,7 +50,7 @@ public class ChangePasswordCB extends CachedCodeBehind<ChangePasswordPM> impleme
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private ChangePasswordCB(ChangePasswordPM presentationModel) {
private ChangePasswordViewCB(ChangePasswordPM presentationModel) {
super(presentationModel);
}
@ -93,8 +93,8 @@ public class ChangePasswordCB extends CachedCodeBehind<ChangePasswordPM> impleme
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public void isSettingsMode(boolean isSettingsMode) {
if (isSettingsMode)
public void useSettingsContext(boolean useSettingsContext) {
if (useSettingsContext)
buttonsHBox.getChildren().remove(skipButton);
}
@ -107,8 +107,8 @@ public class ChangePasswordCB extends CachedCodeBehind<ChangePasswordPM> impleme
private void onSaved() {
boolean result = presentationModel.requestSavePassword();
if (result) {
if (parentController instanceof AccountSetupCB)
((AccountSetupCB) parentController).onCompleted(this);
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(this);
}
else {
log.debug(presentationModel.getErrorMessage()); // TODO use validating TF
@ -122,8 +122,8 @@ public class ChangePasswordCB extends CachedCodeBehind<ChangePasswordPM> impleme
@FXML
private void onSkipped() {
if (parentController instanceof AccountSetupCB)
((AccountSetupCB) parentController).onCompleted(this);
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(this);
}
}

View File

@ -17,6 +17,6 @@
package io.bitsquare.gui.view.account.content;
public interface AdjustableAccountContent {
void isSettingsMode(boolean isSettingsMode);
public interface ContextAware {
void useSettingsContext(boolean useSettingsContext);
}

View File

@ -23,7 +23,7 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.FiatAccountCB" hgap="5.0" vgap="5.0"
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.FiatAccountViewCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml">

View File

@ -26,7 +26,7 @@ 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.account.AccountSetupCB;
import io.bitsquare.gui.view.account.AccountSetupViewCB;
import io.bitsquare.locale.Country;
import io.bitsquare.locale.Region;
@ -52,9 +52,9 @@ import org.slf4j.LoggerFactory;
import static javafx.beans.binding.Bindings.createBooleanBinding;
public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> implements AdjustableAccountContent {
public class FiatAccountViewCB extends CachedCodeBehind<FiatAccountPm> implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(FiatAccountCB.class);
private static final Logger log = LoggerFactory.getLogger(FiatAccountViewCB.class);
@FXML private HBox buttonsHBox;
@FXML private ComboBox<Region> regionComboBox;
@ -71,7 +71,7 @@ public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> implements Ad
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private FiatAccountCB(FiatAccountPm presentationModel) {
private FiatAccountViewCB(FiatAccountPm presentationModel) {
super(presentationModel);
}
@ -126,8 +126,8 @@ public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> implements Ad
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public void isSettingsMode(boolean isSettingsMode) {
if (isSettingsMode)
public void useSettingsContext(boolean useSettingsContext) {
if (useSettingsContext)
buttonsHBox.getChildren().remove(completedButton);
}
@ -177,7 +177,7 @@ public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> implements Ad
@FXML
private void onCompleted() {
if (parentController != null)
((AccountSetupCB) parentController).onCompleted(this);
((AccountSetupViewCB) parentController).onCompleted(this);
}
@FXML

View File

@ -21,7 +21,7 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.PasswordCB" hgap="5.0" vgap="5.0"
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.PasswordViewCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml">

View File

@ -21,7 +21,7 @@ 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.account.AccountSetupCB;
import io.bitsquare.gui.view.account.AccountSetupViewCB;
import java.net.URL;
@ -36,9 +36,9 @@ import javafx.scene.layout.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PasswordCB extends CachedCodeBehind<PasswordPM> implements AdjustableAccountContent {
public class PasswordViewCB extends CachedCodeBehind<PasswordPM> implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(PasswordCB.class);
private static final Logger log = LoggerFactory.getLogger(PasswordViewCB.class);
@FXML private HBox buttonsHBox;
@FXML private Button saveButton, skipButton;
@ -50,7 +50,7 @@ public class PasswordCB extends CachedCodeBehind<PasswordPM> implements Adjustab
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private PasswordCB(PasswordPM presentationModel) {
private PasswordViewCB(PasswordPM presentationModel) {
super(presentationModel);
}
@ -93,8 +93,8 @@ public class PasswordCB extends CachedCodeBehind<PasswordPM> implements Adjustab
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public void isSettingsMode(boolean isSettingsMode) {
if (isSettingsMode)
public void useSettingsContext(boolean useSettingsContext) {
if (useSettingsContext)
buttonsHBox.getChildren().remove(skipButton);
}
@ -107,8 +107,8 @@ public class PasswordCB extends CachedCodeBehind<PasswordPM> implements Adjustab
private void onSaved() {
boolean result = presentationModel.requestSavePassword();
if (result) {
if (parentController instanceof AccountSetupCB)
((AccountSetupCB) parentController).onCompleted(this);
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(this);
}
else {
// TODO use validating passwordTF
@ -118,8 +118,8 @@ public class PasswordCB extends CachedCodeBehind<PasswordPM> implements Adjustab
@FXML
private void onSkipped() {
if (parentController instanceof AccountSetupCB)
((AccountSetupCB) parentController).onCompleted(this);
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(this);
}
@FXML

View File

@ -23,7 +23,7 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.RegistrationCB" hgap="5.0" vgap="5.0"
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.RegistrationViewCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml">

View File

@ -18,14 +18,14 @@
package io.bitsquare.gui.view.account.content;
import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.MainController;
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.account.AccountSetupCB;
import io.bitsquare.gui.view.MainViewCB;
import io.bitsquare.gui.view.account.AccountSetupViewCB;
import io.bitsquare.locale.BSResources;
import java.net.URL;
@ -48,9 +48,9 @@ import org.controlsfx.dialog.Dialog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RegistrationCB extends CachedCodeBehind<RegistrationPM> implements AdjustableAccountContent {
public class RegistrationViewCB extends CachedCodeBehind<RegistrationPM> implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(RegistrationCB.class);
private static final Logger log = LoggerFactory.getLogger(RegistrationViewCB.class);
@FXML private TextField feeTextField;
@ -64,7 +64,7 @@ public class RegistrationCB extends CachedCodeBehind<RegistrationPM> implements
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private RegistrationCB(RegistrationPM presentationModel) {
private RegistrationViewCB(RegistrationPM presentationModel) {
super(presentationModel);
}
@ -95,7 +95,7 @@ public class RegistrationCB extends CachedCodeBehind<RegistrationPM> implements
presentationModel.showTransactionPublishedScreen.addListener((o, oldValue, newValue) -> {
if (newValue) {
MainController.GET_INSTANCE().blurContentScreen();
MainViewCB.getInstance().blurContentScreen();
List<Action> actions = new ArrayList<>();
actions.add(new AbstractAction(BSResources.get("shared.copyTxId")) {
@ -111,13 +111,13 @@ public class RegistrationCB extends CachedCodeBehind<RegistrationPM> implements
@Override
public void handle(ActionEvent actionEvent) {
try {
if (parentController instanceof AccountSetupCB)
((AccountSetupCB) parentController).onCompleted(RegistrationCB.this);
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(RegistrationViewCB.this);
} catch (Exception e) {
e.printStackTrace();
}
Dialog.Actions.CLOSE.handle(actionEvent);
MainController.GET_INSTANCE().removeContentScreenBlur();
MainViewCB.getInstance().removeContentScreenBlur();
}
});
@ -155,8 +155,8 @@ public class RegistrationCB extends CachedCodeBehind<RegistrationPM> implements
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public void isSettingsMode(boolean isSettingsMode) {
if (isSettingsMode) {
public void useSettingsContext(boolean useSettingsContext) {
if (useSettingsContext) {
// TODO
}
}

View File

@ -20,7 +20,7 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.RestrictionsCB" hgap="5.0" vgap="5.0"
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.RestrictionsViewCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml">

View File

@ -25,7 +25,7 @@ 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.account.AccountSetupCB;
import io.bitsquare.gui.view.account.AccountSetupViewCB;
import io.bitsquare.locale.Country;
import io.bitsquare.locale.Region;
import io.bitsquare.util.BSFXMLLoader;
@ -53,9 +53,9 @@ import javafx.util.StringConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> implements AdjustableAccountContent {
public class RestrictionsViewCB extends CachedCodeBehind<RestrictionsPM> implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(RestrictionsCB.class);
private static final Logger log = LoggerFactory.getLogger(RestrictionsViewCB.class);
@FXML private ListView languagesListView, countriesListView, arbitratorsListView;
@FXML private ComboBox<Locale> languageComboBox;
@ -69,7 +69,7 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> implements
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private RestrictionsCB(RestrictionsPM presentationModel) {
private RestrictionsViewCB(RestrictionsPM presentationModel) {
super(presentationModel);
}
@ -116,8 +116,8 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> implements
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public void isSettingsMode(boolean isSettingsMode) {
if (isSettingsMode)
public void useSettingsContext(boolean useSettingsContext) {
if (useSettingsContext)
((GridPane) root).getChildren().remove(completedButton);
}
@ -160,8 +160,8 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> implements
@FXML
private void onCompleted() {
if (parentController instanceof AccountSetupCB)
((AccountSetupCB) parentController).onCompleted(this);
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(this);
}
@FXML

View File

@ -22,7 +22,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.SeedWordsCB" hgap="5.0" vgap="5.0"
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.SeedWordsViewCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml">

View File

@ -21,7 +21,7 @@ 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.account.AccountSetupCB;
import io.bitsquare.gui.view.account.AccountSetupViewCB;
import java.net.URL;
@ -36,9 +36,9 @@ import javafx.scene.layout.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SeedWordsCB extends CachedCodeBehind<SeedWordsPM> implements AdjustableAccountContent {
public class SeedWordsViewCB extends CachedCodeBehind<SeedWordsPM> implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(SeedWordsCB.class);
private static final Logger log = LoggerFactory.getLogger(SeedWordsViewCB.class);
@FXML private Button completedButton;
@FXML private TextArea seedWordsTextArea;
@ -49,7 +49,7 @@ public class SeedWordsCB extends CachedCodeBehind<SeedWordsPM> implements Adjust
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private SeedWordsCB(SeedWordsPM presentationModel) {
private SeedWordsViewCB(SeedWordsPM presentationModel) {
super(presentationModel);
}
@ -89,8 +89,8 @@ public class SeedWordsCB extends CachedCodeBehind<SeedWordsPM> implements Adjust
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public void isSettingsMode(boolean isSettingsMode) {
if (isSettingsMode)
public void useSettingsContext(boolean useSettingsContext) {
if (useSettingsContext)
((GridPane) root).getChildren().remove(completedButton);
}
@ -101,8 +101,8 @@ public class SeedWordsCB extends CachedCodeBehind<SeedWordsPM> implements Adjust
@FXML
private void onCompleted() {
if (parentController instanceof AccountSetupCB)
((AccountSetupCB) parentController).onCompleted(this);
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(this);
}
@FXML

View File

@ -26,7 +26,7 @@
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.view.trade.CreateOfferCB"
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.view.trade.CreateOfferViewCB"
AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0"
AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
xmlns:fx="http://javafx.com/fxml">

View File

@ -18,7 +18,6 @@
package io.bitsquare.gui.view.trade;
import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.MainController;
import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.components.InfoDisplay;
import io.bitsquare.gui.components.InputTextField;
@ -29,6 +28,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.locale.BSResources;
import io.bitsquare.trade.orderbook.OrderBookFilter;
@ -70,8 +70,8 @@ import static javafx.beans.binding.Bindings.createStringBinding;
// TODO Implement other positioning method in InoutTextField to display it over the field instead of right side
// priceAmountHBox is too large after redesign as to be used as layoutReference.
public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
private static final Logger log = LoggerFactory.getLogger(CreateOfferCB.class);
public class CreateOfferViewCB extends CachedCodeBehind<CreateOfferPM> {
private static final Logger log = LoggerFactory.getLogger(CreateOfferViewCB.class);
private boolean detailsVisible;
private boolean advancedScreenInited;
@ -105,7 +105,7 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private CreateOfferCB(CreateOfferPM presentationModel) {
private CreateOfferViewCB(CreateOfferPM presentationModel) {
super(presentationModel);
}
@ -234,7 +234,7 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
///////////////////////////////////////////////////////////////////////////////////////////
private void openAccountSettings() {
MainController.GET_INSTANCE().loadViewAndGetChildController(NavigationItem.ACCOUNT);
MainViewCB.getInstance().triggerMainMenuButton(NavigationItem.ACCOUNT);
}
private void close() {
@ -306,7 +306,7 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
presentationModel.showTransactionPublishedScreen.addListener((o, oldValue, newValue) -> {
if (newValue) {
MainController.GET_INSTANCE().blurContentScreen();
MainViewCB.getInstance().blurContentScreen();
// Dialogs are a bit limited. There is no callback for the InformationDialog button click, so we added
// our own actions.
@ -329,7 +329,7 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
e.printStackTrace();
}
Dialog.Actions.CLOSE.handle(actionEvent);
MainController.GET_INSTANCE().removeContentScreenBlur();
MainViewCB.getInstance().removeContentScreenBlur();
}
});