diff --git a/src/main/java/io/bitsquare/gui/Controller.java b/src/main/java/io/bitsquare/gui/Controller.java
deleted file mode 100644
index 1d236c1324..0000000000
--- a/src/main/java/io/bitsquare/gui/Controller.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * This file is part of Bitsquare.
- *
- * Bitsquare is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or (at
- * your option) any later version.
- *
- * Bitsquare is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with Bitsquare. If not, see .
- */
-
-package io.bitsquare.gui;
-
-import java.net.URL;
-
-import java.util.ResourceBundle;
-
-import javafx.fxml.Initializable;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-public abstract class Controller implements Initializable {
-
- public static final String TITLE_KEY = "view.title";
-
- protected M model;
-
- protected Controller(M model) {
- this.model = checkNotNull(model);
- }
-
- @Override
- public void initialize(URL url, ResourceBundle rb) {
- model.initialize();
- doInitialize();
- }
-
- public final void terminate() {
- //model.terminate();
- //doTerminate();
- }
-
- protected abstract void doInitialize();
-
- protected void doTerminate() { };
-}
diff --git a/src/main/java/io/bitsquare/gui/FxmlController.java b/src/main/java/io/bitsquare/gui/FxmlController.java
deleted file mode 100644
index a5b0e8edb9..0000000000
--- a/src/main/java/io/bitsquare/gui/FxmlController.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * This file is part of Bitsquare.
- *
- * Bitsquare is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or (at
- * your option) any later version.
- *
- * Bitsquare is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with Bitsquare. If not, see .
- */
-
-package io.bitsquare.gui;
-
-import java.net.URL;
-
-import java.util.ResourceBundle;
-
-import javafx.fxml.FXML;
-import javafx.scene.*;
-
-public abstract class FxmlController extends Controller {
-
- protected @FXML R root;
-
- protected FxmlController(M model) {
- super(model);
- }
-
- @Override
- public void initialize(URL url, ResourceBundle rb) {
- root.sceneProperty().addListener((ov, oldValue, newValue) -> {
- // root node has been removed the scene
- if (oldValue != null && newValue == null)
- terminate();
- });
- super.initialize(url, rb);
- }
-}
diff --git a/src/main/java/io/bitsquare/gui/XModel.java b/src/main/java/io/bitsquare/gui/XModel.java
deleted file mode 100644
index 237dc6c78d..0000000000
--- a/src/main/java/io/bitsquare/gui/XModel.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * This file is part of Bitsquare.
- *
- * Bitsquare is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or (at
- * your option) any later version.
- *
- * Bitsquare is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with Bitsquare. If not, see .
- */
-
-package io.bitsquare.gui;
-
-public interface XModel {
- void initialize();
-}
diff --git a/src/main/java/io/bitsquare/gui/main/MainView.fxml b/src/main/java/io/bitsquare/gui/main/MainView.fxml
index 3fb9970585..e907bbf155 100644
--- a/src/main/java/io/bitsquare/gui/main/MainView.fxml
+++ b/src/main/java/io/bitsquare/gui/main/MainView.fxml
@@ -17,7 +17,7 @@
-->
-
\ No newline at end of file
diff --git a/src/main/java/io/bitsquare/gui/main/MainViewCB.java b/src/main/java/io/bitsquare/gui/main/MainView.java
similarity index 97%
rename from src/main/java/io/bitsquare/gui/main/MainViewCB.java
rename to src/main/java/io/bitsquare/gui/main/MainView.java
index f0152de2e1..6ff19b9856 100644
--- a/src/main/java/io/bitsquare/gui/main/MainViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/MainView.java
@@ -19,7 +19,6 @@ package io.bitsquare.gui.main;
import io.bitsquare.BitsquareException;
import io.bitsquare.bank.BankAccount;
-import io.bitsquare.gui.FxmlController;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.OverlayManager;
import io.bitsquare.gui.View;
@@ -45,7 +44,7 @@ import javafx.scene.text.*;
import static io.bitsquare.gui.Navigation.Item.*;
import static javafx.scene.layout.AnchorPane.*;
-public class MainViewCB extends FxmlController {
+public class MainView extends View {
private final ToggleGroup navButtons = new ToggleGroup();
@@ -56,8 +55,8 @@ public class MainViewCB extends FxmlController {
private final String title;
@Inject
- public MainViewCB(MainModel model, ViewLoader viewLoader, Navigation navigation, OverlayManager overlayManager,
- Transitions transitions, @Named(TITLE_KEY) String title) {
+ public MainView(MainViewModel model, ViewLoader viewLoader, Navigation navigation, OverlayManager overlayManager,
+ Transitions transitions, @Named(TITLE_KEY) String title) {
super(model);
this.viewLoader = viewLoader;
this.navigation = navigation;
@@ -74,7 +73,7 @@ public class MainViewCB extends FxmlController {
}
@Override
- public void doInitialize() {
+ public void initialize() {
ToggleButton homeButton = new NavButton(HOME) {{
setDisable(true); // during irc demo
}};
diff --git a/src/main/java/io/bitsquare/gui/main/MainModel.java b/src/main/java/io/bitsquare/gui/main/MainViewModel.java
similarity index 96%
rename from src/main/java/io/bitsquare/gui/main/MainModel.java
rename to src/main/java/io/bitsquare/gui/main/MainViewModel.java
index 4aae90b1d0..667bd42043 100644
--- a/src/main/java/io/bitsquare/gui/main/MainModel.java
+++ b/src/main/java/io/bitsquare/gui/main/MainViewModel.java
@@ -20,6 +20,7 @@ package io.bitsquare.gui.main;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.btc.BitcoinNetwork;
import io.bitsquare.btc.WalletService;
+import io.bitsquare.gui.ViewModel;
import io.bitsquare.gui.XModel;
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.msg.MessageService;
@@ -51,8 +52,8 @@ import org.slf4j.LoggerFactory;
import rx.Observable;
-class MainModel implements XModel {
- private static final Logger log = LoggerFactory.getLogger(MainModel.class);
+class MainViewModel implements ViewModel {
+ private static final Logger log = LoggerFactory.getLogger(MainViewModel.class);
final DoubleProperty networkSyncProgress = new SimpleDoubleProperty(-1);
final IntegerProperty numPendingTrades = new SimpleIntegerProperty(0);
@@ -83,8 +84,9 @@ class MainModel implements XModel {
@Inject
- public MainModel(User user, WalletService walletService, MessageService messageService, TradeManager tradeManager,
- BitcoinNetwork bitcoinNetwork, BSFormatter formatter, Persistence persistence) {
+ public MainViewModel(User user, WalletService walletService, MessageService messageService,
+ TradeManager tradeManager, BitcoinNetwork bitcoinNetwork, BSFormatter formatter,
+ Persistence persistence) {
this.user = user;
this.walletService = walletService;
this.messageService = messageService;
@@ -93,10 +95,7 @@ class MainModel implements XModel {
this.bitcoinNetwork = bitcoinNetwork;
user.getCurrentBankAccount().addListener((observable, oldValue, newValue) -> persistence.write(user));
- }
- @Override
- public void initialize() {
bootstrapState.addListener((ov, oldValue, newValue) -> {
if (newValue == BootstrapState.DISCOVERY_DIRECT_SUCCEEDED ||
newValue == BootstrapState.DISCOVERY_AUTO_PORT_FORWARDING_SUCCEEDED ||
@@ -151,6 +150,7 @@ class MainModel implements XModel {
bankAccountsComboBoxPrompt.set(user.getBankAccounts().isEmpty() ? "No accounts" : "");
}
+
public Observable> initBackend() {
walletService.getDownloadProgress().subscribe(