diff --git a/.gitignore b/.gitignore
index d08ba465ed..af7b7b6e08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,3 +18,4 @@ build
.classpath
.project
.settings
+*.java.hsp
diff --git a/.travis.yml b/.travis.yml
index 1f8fdacac0..fde7fbb678 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,10 @@
language: java
jdk: oraclejdk8
+before_install:
+ - "export DISPLAY=:99.0"
+ - "sh -e /etc/init.d/xvfb start"
+
notifications:
irc:
channels: chat.freenode.net#bitsquare
diff --git a/build.gradle b/build.gradle
index 6117282881..6d009ee23e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -17,7 +17,7 @@ sourceCompatibility = 1.8
sourceSets.main.resources.srcDirs += 'src/main/java'
-mainClassName = "io.bitsquare.Bitsquare"
+mainClassName = "io.bitsquare.app.gui.Main"
run {
if ( project.hasProperty('args') ) {
diff --git a/package/windows.bat b/package/windows.bat
index 58cf0bb2a9..85f740f672 100644
--- a/package/windows.bat
+++ b/package/windows.bat
@@ -1 +1 @@
-C:\Progra~1\Java\jdk1.8.0_20\bin\javapackager.exe -deploy -BappVersion=0.1.0 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir build -appclass io.bitsquare.Bitsquare -srcfiles .\build\libs\bitsquare-0.1.0-SNAPSHOT-all.jar -outfile Bitsquare -Bruntime="c:\Program Files\Java\jdk1.8.0_20\jre"
+C:\Progra~1\Java\jdk1.8.0_20\bin\javapackager.exe -deploy -BappVersion=0.1.0 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir build -appclass io.bitsquare.app.gui.Main -srcfiles .\build\libs\bitsquare-0.1.0-SNAPSHOT-all.jar -outfile Bitsquare -Bruntime="c:\Program Files\Java\jdk1.8.0_20\jre"
diff --git a/src/main/java/io/bitsquare/AbstractBitsquareModule.java b/src/main/java/io/bitsquare/AbstractBitsquareModule.java
new file mode 100644
index 0000000000..72c51ef129
--- /dev/null
+++ b/src/main/java/io/bitsquare/AbstractBitsquareModule.java
@@ -0,0 +1,65 @@
+/*
+ * 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;
+
+import com.google.common.collect.Sets;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Injector;
+
+import java.util.Properties;
+import java.util.Set;
+
+public abstract class AbstractBitsquareModule extends AbstractModule {
+
+ protected final Properties properties;
+
+ private final Set modules = Sets.newHashSet();
+
+ public AbstractBitsquareModule(Properties properties) {
+ this.properties = properties;
+ }
+
+ protected void install(AbstractBitsquareModule module) {
+ super.install(module);
+ modules.add(module);
+ }
+
+ /**
+ * Close any instances this module is responsible for and recursively close any
+ * sub-modules installed via {@link #install(AbstractBitsquareModule)}. This method
+ * must be called manually, e.g. at the end of a main() method or in the stop() method
+ * of a JavaFX Application; alternatively it may be registered as a JVM shutdown hook.
+ *
+ * @param injector the Injector originally initialized with this module
+ * @see #doClose(com.google.inject.Injector)
+ */
+ public final void close(Injector injector) {
+ modules.forEach(module -> module.close(injector));
+ doClose(injector);
+ }
+
+ /**
+ * Actually perform closing of any instances this module is responsible for. Called by
+ * {@link #close(Injector)}.
+ *
+ * @param injector the Injector originally initialized with this module
+ */
+ protected void doClose(Injector injector) {
+ }
+}
diff --git a/src/main/java/io/bitsquare/Bitsquare.java b/src/main/java/io/bitsquare/Bitsquare.java
deleted file mode 100644
index 39d4b23307..0000000000
--- a/src/main/java/io/bitsquare/Bitsquare.java
+++ /dev/null
@@ -1,152 +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;
-
-import io.bitsquare.msg.SeedNodeAddress;
-import io.bitsquare.msg.actor.DHTManager;
-import io.bitsquare.msg.actor.command.InitializePeer;
-import io.bitsquare.msg.actor.event.PeerInitialized;
-import io.bitsquare.util.BitsquareArgumentParser;
-
-import java.net.UnknownHostException;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.TimeoutException;
-
-import javafx.application.Application;
-
-import net.tomp2p.connection.Ports;
-import net.tomp2p.peers.Number160;
-import net.tomp2p.peers.PeerAddress;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import akka.actor.ActorRef;
-import akka.actor.ActorSystem;
-import akka.actor.Inbox;
-import net.sourceforge.argparse4j.inf.ArgumentParserException;
-import net.sourceforge.argparse4j.inf.Namespace;
-import scala.concurrent.duration.Duration;
-import scala.concurrent.duration.FiniteDuration;
-
-public class Bitsquare {
- private static final Logger log = LoggerFactory.getLogger(Bitsquare.class);
-
- private static String appName = "Bitsquare";
- private static int clientPort;
- private static String interfaceHint;
-
- public static String getAppName() {
- return appName;
- }
-
- public static int getClientPort() {
- return clientPort;
- }
-
- public static void main(String[] args) {
-
- BitsquareArgumentParser parser = new BitsquareArgumentParser();
- Namespace namespace = null;
- try {
- namespace = parser.parseArgs(args);
- } catch (ArgumentParserException e) {
- parser.handleError(e);
- System.exit(1);
- }
- if (namespace != null) {
-
- if (namespace.getString(BitsquareArgumentParser.NAME_FLAG) != null) {
- appName = appName + "-" + namespace.getString(BitsquareArgumentParser.NAME_FLAG);
- }
-
- if (namespace.getString(BitsquareArgumentParser.INFHINT_FLAG) != null) {
- interfaceHint = namespace.getString(BitsquareArgumentParser.INFHINT_FLAG);
- }
-
- int port = -1;
- if (namespace.getString(BitsquareArgumentParser.PORT_FLAG) != null) {
- port = Integer.valueOf(namespace.getString(BitsquareArgumentParser.PORT_FLAG));
- }
-
- if (namespace.getBoolean(BitsquareArgumentParser.SEED_FLAG) == true) {
- String seedID = SeedNodeAddress.StaticSeedNodeAddresses.DIGITAL_OCEAN1.getId();
- if (namespace.getString(BitsquareArgumentParser.PEER_ID_FLAG) != null) {
- seedID = namespace.getString(BitsquareArgumentParser.PEER_ID_FLAG);
- }
-
- ActorSystem actorSystem = ActorSystem.create(getAppName());
-
- final Set peerAddresses = new HashSet();
- final String sid = seedID;
- SeedNodeAddress.StaticSeedNodeAddresses.getAllSeedNodeAddresses().forEach(a -> {
- if (!a.getId().equals(sid)) {
- try {
- peerAddresses.add(new PeerAddress(Number160.createHash(a.getId()), a.getIp(),
- a.getPort(), a.getPort()));
- } catch (UnknownHostException uhe) {
- log.error("Unknown Host [" + a.getIp() + "]: " + uhe.getMessage());
- }
- }
- });
-
- int serverPort = (port == -1) ? BitsquareArgumentParser.PORT_DEFAULT : port;
-
- ActorRef seedNode = actorSystem.actorOf(DHTManager.getProps(), DHTManager.SEED_NAME);
- Inbox inbox = Inbox.create(actorSystem);
- inbox.send(seedNode, new InitializePeer(Number160.createHash(sid), serverPort, interfaceHint,
- peerAddresses));
-
- Thread seedNodeThread = new Thread(() -> {
- Boolean quit = false;
- while (!quit) {
- try {
- Object m = inbox.receive(FiniteDuration.create(5L, "seconds"));
- if (m instanceof PeerInitialized) {
- log.debug("Seed Peer Initialized on port " + ((PeerInitialized) m).getPort
- ());
- }
- } catch (Exception e) {
- if (!(e instanceof TimeoutException)) {
- quit = true;
- log.error(e.getMessage());
- }
- }
- }
- actorSystem.shutdown();
- try {
- actorSystem.awaitTermination(Duration.create(5L, "seconds"));
- } catch (Exception ex) {
- if (ex instanceof TimeoutException)
- log.error("ActorSystem did not shutdown properly.");
- else
- log.error(ex.getMessage());
- }
- });
- seedNodeThread.start();
- }
- else {
- // We use a random port for the client if no port is passed to the application
- clientPort = (port == -1) ? new Ports().tcpPort() : port;
- Application.launch(BitsquareUI.class, args);
- }
- }
- }
-}
diff --git a/src/main/java/io/bitsquare/BitsquareUI.java b/src/main/java/io/bitsquare/BitsquareUI.java
deleted file mode 100644
index 7322057bb3..0000000000
--- a/src/main/java/io/bitsquare/BitsquareUI.java
+++ /dev/null
@@ -1,159 +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;
-
-import io.bitsquare.btc.WalletFacade;
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.gui.AWTSystemTray;
-import io.bitsquare.gui.Navigation;
-import io.bitsquare.gui.components.Popups;
-import io.bitsquare.gui.util.ImageUtil;
-import io.bitsquare.gui.util.Profiler;
-import io.bitsquare.msg.MessageFacade;
-import io.bitsquare.persistence.Persistence;
-import io.bitsquare.settings.Settings;
-import io.bitsquare.user.User;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.common.base.Throwables;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.image.*;
-import javafx.scene.input.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import akka.actor.ActorSystem;
-import lighthouse.files.AppDirectory;
-
-public class BitsquareUI extends Application {
- private static final Logger log = LoggerFactory.getLogger(BitsquareUI.class);
-
- private static Stage primaryStage;
- private WalletFacade walletFacade;
- private MessageFacade messageFacade;
-
- public void BitsquareUI() {
- Profiler.init();
- }
-
- public static Stage getPrimaryStage() {
- return primaryStage;
- }
-
- @Override
- public void start(Stage primaryStage) {
- Profiler.printMsgWithTime("Bitsquare.start called");
- BitsquareUI.primaryStage = primaryStage;
-
- Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> Popups.handleUncaughtExceptions
- (Throwables.getRootCause(throwable)));
-
- try {
- AppDirectory.initAppDir(Bitsquare.getAppName());
- } catch (IOException e) {
- log.error(e.getMessage());
- }
-
- final Injector injector = Guice.createInjector(new BitsquareModule());
-
- // currently there is not SystemTray support for java fx (planned for version 3) so we use the old AWT
- AWTSystemTray.createSystemTray(primaryStage, injector.getInstance(ActorSystem.class), this);
-
- walletFacade = injector.getInstance(WalletFacade.class);
- messageFacade = injector.getInstance(MessageFacade.class);
- Profiler.printMsgWithTime("Bitsquare: messageFacade, walletFacade created");
-
- // apply stored data
- final User user = injector.getInstance(User.class);
- final Settings settings = injector.getInstance(Settings.class);
- final Persistence persistence = injector.getInstance(Persistence.class);
- persistence.init();
-
- User persistedUser = (User) persistence.read(user);
- user.applyPersistedUser(persistedUser);
-
- settings.applyPersistedSettings((Settings) persistence.read(settings.getClass().getName()));
-
- primaryStage.setTitle("Bitsquare (" + Bitsquare.getAppName() + ")");
-
- // sometimes there is a rendering bug, see https://github.com/bitsquare/bitsquare/issues/160
- if (ImageUtil.isRetina())
- primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/images/window_icon@2x.png")));
- else
- primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/images/window_icon.png")));
-
- ViewLoader.setInjector(injector);
-
- final ViewLoader loader =
- new ViewLoader(getClass().getResource(Navigation.Item.MAIN.getFxmlUrl()), false);
- try {
- final Parent view = loader.load();
-
- final Scene scene = new Scene(view, 1000, 600);
- scene.getStylesheets().setAll(getClass().getResource("/io/bitsquare/gui/bitsquare.css").toExternalForm(),
- getClass().getResource("/io/bitsquare/gui/images.css").toExternalForm());
-
- setupCloseHandlers(primaryStage, scene);
-
- primaryStage.setScene(scene);
-
- // TODO resizing not fully supported yet
-
- primaryStage.setMinWidth(75);
- primaryStage.setMinHeight(50);
-
- /* primaryStage.setMinWidth(1000);
- primaryStage.setMinHeight(750);*/
-
- Profiler.initScene(primaryStage.getScene());
-
- primaryStage.show();
- } catch (IOException e) {
- e.printStackTrace();
- log.error(e.getMessage());
- }
- }
-
- private void setupCloseHandlers(Stage primaryStage, Scene scene) {
- primaryStage.setOnCloseRequest(e -> AWTSystemTray.setStageHidden());
-
- KeyCodeCombination keyCodeCombination = new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN);
- scene.setOnKeyReleased(keyEvent -> {
- if (keyCodeCombination.match(keyEvent))
- AWTSystemTray.setStageHidden();
- });
- }
-
- @Override
- public void stop() throws Exception {
- walletFacade.shutDown();
- messageFacade.shutDown();
-
- super.stop();
- System.exit(0);
- }
-}
diff --git a/src/main/java/io/bitsquare/SeedNode.java b/src/main/java/io/bitsquare/SeedNode.java
deleted file mode 100644
index 54005460a8..0000000000
--- a/src/main/java/io/bitsquare/SeedNode.java
+++ /dev/null
@@ -1,97 +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;
-
-import io.bitsquare.msg.SeedNodeAddress;
-
-import java.io.IOException;
-
-import net.tomp2p.dht.PeerBuilderDHT;
-import net.tomp2p.dht.PeerDHT;
-import net.tomp2p.nat.PeerBuilderNAT;
-import net.tomp2p.p2p.Peer;
-import net.tomp2p.p2p.PeerBuilder;
-import net.tomp2p.peers.Number160;
-import net.tomp2p.peers.PeerAddress;
-import net.tomp2p.peers.PeerMapChangeListener;
-import net.tomp2p.peers.PeerStatistic;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SeedNode extends Thread {
- private static final Logger log = LoggerFactory.getLogger(SeedNode.class);
-
- public static void main(String[] args) {
- Peer peer = null;
- SeedNodeAddress.StaticSeedNodeAddresses seedNodeAddress = SeedNodeAddress.StaticSeedNodeAddresses
- .DIGITAL_OCEAN1;
- try {
- peer = new PeerBuilder(Number160.createHash(seedNodeAddress.getId())).ports(seedNodeAddress.getPort())
- .start();
- PeerDHT peerDHT = new PeerBuilderDHT(peer).start();
- new PeerBuilderNAT(peer).start();
-
- /* peerDHT.peer().objectDataReply((sender, request) -> {
- log.trace("received request: ", request.toString());
- return "pong";
- });*/
-
- log.debug("peer listening at port: {}", seedNodeAddress.getPort());
-
- peer.peerBean().peerMap().addPeerMapChangeListener(new PeerMapChangeListener() {
- @Override
- public void peerInserted(PeerAddress peerAddress, boolean verified) {
- log.debug("Peer inserted: peerAddress=" + peerAddress + ", verified=" + verified);
- }
-
- @Override
- public void peerRemoved(PeerAddress peerAddress, PeerStatistic peerStatistics) {
- log.debug("Peer removed: peerAddress=" + peerAddress + ", peerStatistics=" + peerStatistics);
- }
-
- @Override
- public void peerUpdated(PeerAddress peerAddress, PeerStatistic peerStatistics) {
- // log.debug("Peer updated: peerAddress=" + peerAddress + ",
- // peerStatistics=" + peerStatistics);
- }
- });
-
- final Peer _peer = peer;
- Thread seedNodeThread = new Thread(() -> {
- while (true) {
- try {
- for (PeerAddress pa : _peer.peerBean().peerMap().all()) {
- System.out.println("Peer online:" + pa);
- }
- Thread.sleep(5000L);
- } catch (InterruptedException e) {
- }
- }
- });
- seedNodeThread.start();
-
- } catch (IOException e) {
- e.printStackTrace();
- if (peer != null)
- peer.shutdown().awaitUninterruptibly();
- }
- }
-
-
-}
diff --git a/src/main/java/io/bitsquare/util/BitsquareArgumentParser.java b/src/main/java/io/bitsquare/app/ArgumentParser.java
similarity index 70%
rename from src/main/java/io/bitsquare/util/BitsquareArgumentParser.java
rename to src/main/java/io/bitsquare/app/ArgumentParser.java
index f4d3850442..7afccb8900 100644
--- a/src/main/java/io/bitsquare/util/BitsquareArgumentParser.java
+++ b/src/main/java/io/bitsquare/app/ArgumentParser.java
@@ -15,45 +15,38 @@
* along with Bitsquare. If not, see .
*/
-package io.bitsquare.util;
+package io.bitsquare.app;
-import io.bitsquare.msg.SeedNodeAddress;
+import io.bitsquare.network.BootstrapNode;
import net.sourceforge.argparse4j.ArgumentParsers;
-import net.sourceforge.argparse4j.impl.Arguments;
-import net.sourceforge.argparse4j.inf.ArgumentParser;
import net.sourceforge.argparse4j.inf.ArgumentParserException;
import net.sourceforge.argparse4j.inf.Namespace;
/*
optional arguments:
-h, --help show this help message and exit
- -s, --seed Start as DHT seed peer, no UI. (default: false)
-d PEERID, --peerid PEERID Seed peer ID. (default: digitalocean1.bitsquare.io)
-p PORT, --port PORT IP port to listen on. (default: 5000)
-i INTERFACE, --interface INTERFACE Network interface to listen on.
-n NAME, --name NAME Append name to application name.
*/
-public class BitsquareArgumentParser {
+public class ArgumentParser {
- public static String SEED_FLAG = "seed";
public static String PEER_ID_FLAG = "peerid";
public static String PORT_FLAG = "port";
public static Integer PORT_DEFAULT = 5000;
public static String INFHINT_FLAG = "interface";
public static String NAME_FLAG = "name";
- private final ArgumentParser parser;
+ private final net.sourceforge.argparse4j.inf.ArgumentParser parser;
- public BitsquareArgumentParser() {
+ public ArgumentParser() {
parser = ArgumentParsers.newArgumentParser("Bitsquare")
.defaultHelp(true)
.description("Bitsquare - The decentralized bitcoin exchange.");
- parser.addArgument("-s", "--" + SEED_FLAG)
- .action(Arguments.storeTrue())
- .help("Start as DHT seed peer, no UI.");
parser.addArgument("-d", "--" + PEER_ID_FLAG)
- .setDefault(SeedNodeAddress.StaticSeedNodeAddresses.DIGITAL_OCEAN1.getId())
+ .setDefault(BootstrapNode.DIGITAL_OCEAN1.getId())
.help("Seed peer ID.");
parser.addArgument("-p", "--" + PORT_FLAG)
.help("IP port to listen on.");
@@ -63,11 +56,13 @@ public class BitsquareArgumentParser {
.help("Append name to application name.");
}
- public Namespace parseArgs(String... args) throws ArgumentParserException {
- return parser.parseArgs(args);
- }
-
- public void handleError(ArgumentParserException e) {
- parser.handleError(e);
+ public Namespace parseArgs(String... args) {
+ try {
+ return parser.parseArgs(args);
+ } catch (ArgumentParserException e) {
+ parser.handleError(e);
+ System.exit(1);
+ return null;
+ }
}
}
diff --git a/src/main/java/io/bitsquare/di/BitsquareModule.java b/src/main/java/io/bitsquare/app/BitsquareModule.java
similarity index 58%
rename from src/main/java/io/bitsquare/di/BitsquareModule.java
rename to src/main/java/io/bitsquare/app/BitsquareModule.java
index 7a0a926eef..9395174c84 100644
--- a/src/main/java/io/bitsquare/di/BitsquareModule.java
+++ b/src/main/java/io/bitsquare/app/BitsquareModule.java
@@ -15,9 +15,9 @@
* along with Bitsquare. If not, see .
*/
-package io.bitsquare.di;
+package io.bitsquare.app;
-import io.bitsquare.Bitsquare;
+import io.bitsquare.AbstractBitsquareModule;
import io.bitsquare.btc.BitcoinModule;
import io.bitsquare.crypto.CryptoModule;
import io.bitsquare.gui.GuiModule;
@@ -29,18 +29,35 @@ import io.bitsquare.trade.TradeModule;
import io.bitsquare.user.User;
import io.bitsquare.util.ConfigLoader;
+import com.google.inject.Injector;
+import com.google.inject.name.Names;
+
import java.util.Properties;
+import javafx.stage.Stage;
+
+import net.tomp2p.connection.Ports;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import akka.actor.ActorSystem;
+import scala.concurrent.duration.Duration;
public class BitsquareModule extends AbstractBitsquareModule {
- public BitsquareModule() {
- this(ConfigLoader.loadConfig());
+ private static final Logger log = LoggerFactory.getLogger(BitsquareModule.class);
+ private final Stage primaryStage;
+ private final String appName;
+
+ public BitsquareModule(Stage primaryStage, String appName) {
+ this(primaryStage, appName, ConfigLoader.loadConfig());
}
- public BitsquareModule(Properties properties) {
+ public BitsquareModule(Stage primaryStage, String appName, Properties properties) {
super(properties);
+ this.primaryStage = primaryStage;
+ this.appName = appName;
}
@Override
@@ -55,7 +72,11 @@ public class BitsquareModule extends AbstractBitsquareModule {
install(tradeModule());
install(guiModule());
- bind(ActorSystem.class).toInstance(ActorSystem.create(Bitsquare.getAppName()));
+ bindConstant().annotatedWith(Names.named("appName")).to(appName);
+ bind(ActorSystem.class).toInstance(ActorSystem.create(appName));
+
+ int randomPort = new Ports().tcpPort();
+ bindConstant().annotatedWith(Names.named("clientPort")).to(randomPort);
}
protected MessageModule messageModule() {
@@ -75,7 +96,18 @@ public class BitsquareModule extends AbstractBitsquareModule {
}
protected GuiModule guiModule() {
- return new GuiModule(properties);
+ return new GuiModule(properties, primaryStage);
+ }
+
+ @Override
+ protected void doClose(Injector injector) {
+ ActorSystem actorSystem = injector.getInstance(ActorSystem.class);
+ actorSystem.shutdown();
+ try {
+ actorSystem.awaitTermination(Duration.create(5L, "seconds"));
+ } catch (Exception ex) {
+ log.error("Actor system failed to shut down properly", ex);
+ }
}
}
diff --git a/src/main/java/io/bitsquare/app/cli/SeedNode.java b/src/main/java/io/bitsquare/app/cli/SeedNode.java
new file mode 100644
index 0000000000..79ca520351
--- /dev/null
+++ b/src/main/java/io/bitsquare/app/cli/SeedNode.java
@@ -0,0 +1,124 @@
+/*
+ * 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.app.cli;
+
+import io.bitsquare.app.ArgumentParser;
+import io.bitsquare.msg.actor.DHTManager;
+import io.bitsquare.msg.actor.command.InitializePeer;
+import io.bitsquare.msg.actor.event.PeerInitialized;
+import io.bitsquare.network.BootstrapNode;
+import io.bitsquare.network.Node;
+
+import java.net.UnknownHostException;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.TimeoutException;
+
+import net.tomp2p.peers.Number160;
+import net.tomp2p.peers.PeerAddress;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import akka.actor.Inbox;
+import net.sourceforge.argparse4j.inf.Namespace;
+import scala.concurrent.duration.Duration;
+import scala.concurrent.duration.FiniteDuration;
+
+public class SeedNode {
+ private static final Logger log = LoggerFactory.getLogger(SeedNode.class);
+
+ private static String appName = "Bitsquare";
+ private static String interfaceHint;
+
+ public static void main(String[] args) {
+ ArgumentParser parser = new ArgumentParser();
+ Namespace namespace = parser.parseArgs(args);
+
+ if (namespace.getString(ArgumentParser.NAME_FLAG) != null) {
+ appName = appName + "-" + namespace.getString(ArgumentParser.NAME_FLAG);
+ }
+
+ if (namespace.getString(ArgumentParser.INFHINT_FLAG) != null) {
+ interfaceHint = namespace.getString(ArgumentParser.INFHINT_FLAG);
+ }
+
+ int port = -1;
+ if (namespace.getString(ArgumentParser.PORT_FLAG) != null) {
+ port = Integer.valueOf(namespace.getString(ArgumentParser.PORT_FLAG));
+ }
+
+ String seedID = BootstrapNode.DIGITAL_OCEAN1.getId();
+ if (namespace.getString(ArgumentParser.PEER_ID_FLAG) != null) {
+ seedID = namespace.getString(ArgumentParser.PEER_ID_FLAG);
+ }
+
+ ActorSystem actorSystem = ActorSystem.create(appName);
+
+ final Set peerAddresses = new HashSet();
+ final String sid = seedID;
+ for (Node node : BootstrapNode.values()) {
+ if (!node.getId().equals(sid)) {
+ try {
+ peerAddresses.add(new PeerAddress(Number160.createHash(node.getId()), node.getIp(),
+ node.getPort(), node.getPort()));
+ } catch (UnknownHostException uhe) {
+ log.error("Unknown Host [" + node.getIp() + "]: " + uhe.getMessage());
+ }
+ }
+ }
+
+ int serverPort = (port == -1) ? ArgumentParser.PORT_DEFAULT : port;
+
+ ActorRef seedNode = actorSystem.actorOf(DHTManager.getProps(), DHTManager.SEED_NAME);
+ Inbox inbox = Inbox.create(actorSystem);
+ inbox.send(seedNode, new InitializePeer(Number160.createHash(sid), serverPort, interfaceHint,
+ peerAddresses));
+
+ Thread seedNodeThread = new Thread(() -> {
+ Boolean quit = false;
+ while (!quit) {
+ try {
+ Object m = inbox.receive(FiniteDuration.create(5L, "seconds"));
+ if (m instanceof PeerInitialized) {
+ log.debug("Seed Peer Initialized on port " + ((PeerInitialized) m).getPort
+ ());
+ }
+ } catch (Exception e) {
+ if (!(e instanceof TimeoutException)) {
+ quit = true;
+ log.error(e.getMessage());
+ }
+ }
+ }
+ actorSystem.shutdown();
+ try {
+ actorSystem.awaitTermination(Duration.create(5L, "seconds"));
+ } catch (Exception ex) {
+ if (ex instanceof TimeoutException)
+ log.error("ActorSystem did not shutdown properly.");
+ else
+ log.error(ex.getMessage());
+ }
+ });
+ seedNodeThread.start();
+ }
+}
diff --git a/src/main/java/io/bitsquare/app/gui/Main.java b/src/main/java/io/bitsquare/app/gui/Main.java
new file mode 100644
index 0000000000..a17d523571
--- /dev/null
+++ b/src/main/java/io/bitsquare/app/gui/Main.java
@@ -0,0 +1,144 @@
+/*
+ * 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.app.gui;
+
+import io.bitsquare.app.ArgumentParser;
+import io.bitsquare.app.BitsquareModule;
+import io.bitsquare.gui.Navigation;
+import io.bitsquare.gui.SystemTray;
+import io.bitsquare.gui.ViewLoader;
+import io.bitsquare.gui.components.Popups;
+import io.bitsquare.gui.util.ImageUtil;
+import io.bitsquare.persistence.Persistence;
+import io.bitsquare.settings.Settings;
+import io.bitsquare.user.User;
+
+import com.google.common.base.Throwables;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+import java.io.IOException;
+
+import javafx.application.Application;
+import javafx.scene.*;
+import javafx.scene.image.*;
+import javafx.scene.input.*;
+import javafx.stage.Stage;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lighthouse.files.AppDirectory;
+import net.sourceforge.argparse4j.inf.Namespace;
+
+public class Main extends Application {
+ private static final Logger log = LoggerFactory.getLogger(Main.class);
+ private static String appName = "Bitsquare";
+
+ private BitsquareModule bitsquareModule;
+ private Injector injector;
+
+ public static void main(String[] args) {
+ ArgumentParser parser = new ArgumentParser();
+ Namespace namespace = parser.parseArgs(args);
+
+ if (namespace.getString(ArgumentParser.NAME_FLAG) != null) {
+ appName = appName + "-" + namespace.getString(ArgumentParser.NAME_FLAG);
+ }
+
+ Application.launch(Main.class, args);
+ }
+
+ @Override
+ public void start(Stage primaryStage) {
+ bitsquareModule = new BitsquareModule(primaryStage, appName);
+ injector = Guice.createInjector(bitsquareModule);
+
+
+ // route uncaught exceptions to a user-facing dialog
+
+ Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) ->
+ Popups.handleUncaughtExceptions(Throwables.getRootCause(throwable)));
+
+
+ // configure the Bitsquare application data directory
+
+ try {
+ AppDirectory.initAppDir(appName);
+ } catch (IOException e) {
+ log.error(e.getMessage());
+ }
+
+
+ // load and apply any stored settings
+
+ User user = injector.getInstance(User.class);
+ Settings settings = injector.getInstance(Settings.class);
+ Persistence persistence = injector.getInstance(Persistence.class);
+ persistence.init();
+
+ User persistedUser = (User) persistence.read(user);
+ user.applyPersistedUser(persistedUser);
+
+ settings.applyPersistedSettings((Settings) persistence.read(settings.getClass().getName()));
+
+
+ // load the main view and create the main scene
+
+ ViewLoader.setInjector(injector);
+ ViewLoader loader = new ViewLoader(Navigation.Item.MAIN, false);
+ Parent view = loader.load();
+
+ Scene scene = new Scene(view, 1000, 600);
+ scene.getStylesheets().setAll(
+ "/io/bitsquare/gui/bitsquare.css",
+ "/io/bitsquare/gui/images.css");
+
+
+ // configure the system tray
+
+ SystemTray systemTray = new SystemTray(primaryStage, this::stop);
+ primaryStage.setOnCloseRequest(e -> systemTray.hideStage());
+ scene.setOnKeyReleased(keyEvent -> {
+ if (new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN).match(keyEvent))
+ systemTray.hideStage();
+ });
+
+
+ // configure the primary stage
+
+ primaryStage.setTitle("Bitsquare (" + appName + ")");
+ primaryStage.setScene(scene);
+ primaryStage.setMinWidth(75);
+ primaryStage.setMinHeight(50);
+ primaryStage.getIcons().add(new Image(getClass().getResourceAsStream(
+ ImageUtil.isRetina() ? "/images/window_icon@2x.png" : "/images/window_icon.png")));
+
+
+ // make the UI visible
+
+ primaryStage.show();
+ }
+
+ @Override
+ public void stop() {
+ bitsquareModule.close(injector);
+ System.exit(0);
+ }
+}
diff --git a/src/main/java/io/bitsquare/btc/BitcoinModule.java b/src/main/java/io/bitsquare/btc/BitcoinModule.java
index 9997669378..1b3d7b37b6 100644
--- a/src/main/java/io/bitsquare/btc/BitcoinModule.java
+++ b/src/main/java/io/bitsquare/btc/BitcoinModule.java
@@ -17,18 +17,19 @@
package io.bitsquare.btc;
+import io.bitsquare.AbstractBitsquareModule;
+
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.params.RegTestParams;
import org.bitcoinj.params.TestNet3Params;
-import com.google.inject.AbstractModule;
+import com.google.inject.Injector;
import java.util.Properties;
-public class BitcoinModule extends AbstractModule {
+public class BitcoinModule extends AbstractBitsquareModule {
- private final Properties properties;
private final BitcoinNetwork defaultNetwork;
public BitcoinModule(Properties properties) {
@@ -36,7 +37,7 @@ public class BitcoinModule extends AbstractModule {
}
public BitcoinModule(Properties properties, BitcoinNetwork defaultNetwork) {
- this.properties = properties;
+ super(properties);
this.defaultNetwork = defaultNetwork;
}
@@ -48,6 +49,11 @@ public class BitcoinModule extends AbstractModule {
bind(NetworkParameters.class).toInstance(network());
}
+ @Override
+ public void doClose(Injector injector) {
+ injector.getInstance(WalletFacade.class).shutDown();
+ }
+
private NetworkParameters network() {
String networkName = properties.getProperty("networkType", defaultNetwork.name());
@@ -62,6 +68,5 @@ public class BitcoinModule extends AbstractModule {
throw new IllegalArgumentException("Unknown bitcoin network name: " + networkName);
}
}
-
}
diff --git a/src/main/java/io/bitsquare/btc/WalletFacade.java b/src/main/java/io/bitsquare/btc/WalletFacade.java
index b7af16e3c1..7ee01fb165 100644
--- a/src/main/java/io/bitsquare/btc/WalletFacade.java
+++ b/src/main/java/io/bitsquare/btc/WalletFacade.java
@@ -17,7 +17,6 @@
package io.bitsquare.btc;
-import io.bitsquare.Bitsquare;
import io.bitsquare.btc.listeners.AddressConfidenceListener;
import io.bitsquare.btc.listeners.BalanceListener;
import io.bitsquare.btc.listeners.TxConfidenceListener;
@@ -73,6 +72,7 @@ import java.util.stream.Collectors;
import javax.annotation.concurrent.GuardedBy;
import javax.inject.Inject;
+import javax.inject.Named;
import javafx.application.Platform;
import javafx.util.Pair;
@@ -92,14 +92,13 @@ import static org.bitcoinj.script.ScriptOpCodes.OP_RETURN;
public class WalletFacade {
private static final Logger log = LoggerFactory.getLogger(WalletFacade.class);
- public static final String WALLET_PREFIX = Bitsquare.getAppName();
-
private final ReentrantLock lock = Threading.lock("lock");
private final NetworkParameters params;
private WalletAppKit walletAppKit;
private final FeePolicy feePolicy;
private final CryptoFacade cryptoFacade;
private final Persistence persistence;
+ private final String appName;
// private final List downloadListeners = new CopyOnWriteArrayList<>();
private final List addressConfidenceListeners = new CopyOnWriteArrayList<>();
private final List txConfidenceListeners = new CopyOnWriteArrayList<>();
@@ -118,11 +117,12 @@ public class WalletFacade {
@Inject
public WalletFacade(NetworkParameters params, FeePolicy feePolicy, CryptoFacade cryptoFacade,
- Persistence persistence) {
+ Persistence persistence, @Named("appName") String appName) {
this.params = params;
this.feePolicy = feePolicy;
this.cryptoFacade = cryptoFacade;
this.persistence = persistence;
+ this.appName = appName;
}
@@ -138,7 +138,7 @@ public class WalletFacade {
Threading.USER_THREAD = Platform::runLater;
// If seed is non-null it means we are restoring from backup.
- walletAppKit = new WalletAppKit(params, AppDirectory.dir().toFile(), WALLET_PREFIX) {
+ walletAppKit = new WalletAppKit(params, AppDirectory.dir().toFile(), appName) {
@Override
protected void onSetupCompleted() {
// Don't make the user wait for confirmations for now, as the intention is they're sending it
diff --git a/src/main/java/io/bitsquare/crypto/CryptoModule.java b/src/main/java/io/bitsquare/crypto/CryptoModule.java
index 84452ba2a4..4f114b65d1 100644
--- a/src/main/java/io/bitsquare/crypto/CryptoModule.java
+++ b/src/main/java/io/bitsquare/crypto/CryptoModule.java
@@ -17,7 +17,7 @@
package io.bitsquare.crypto;
-import io.bitsquare.di.AbstractBitsquareModule;
+import io.bitsquare.AbstractBitsquareModule;
import java.util.Properties;
diff --git a/src/main/java/io/bitsquare/gui/AWTSystemTray.java b/src/main/java/io/bitsquare/gui/AWTSystemTray.java
deleted file mode 100644
index 8a222787a4..0000000000
--- a/src/main/java/io/bitsquare/gui/AWTSystemTray.java
+++ /dev/null
@@ -1,133 +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 io.bitsquare.Bitsquare;
-import io.bitsquare.BitsquareUI;
-import io.bitsquare.gui.util.ImageUtil;
-
-import java.awt.*;
-
-import java.util.concurrent.TimeoutException;
-
-import javax.swing.*;
-
-import javafx.application.Platform;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import akka.actor.ActorSystem;
-import scala.concurrent.duration.Duration;
-
-/**
- * There is no JavaFX support yet, so we need to use AWT.
- * TODO research more
- */
-public class AWTSystemTray {
- private static final Logger log = LoggerFactory.getLogger(AWTSystemTray.class);
- private static boolean isStageVisible = true;
- private static MenuItem showGuiItem;
- private static Stage stage;
- private static ActorSystem actorSystem;
- private static BitsquareUI application;
- private static TrayIcon trayIcon;
-
- public static void createSystemTray(Stage stage, ActorSystem actorSystem, BitsquareUI application) {
- AWTSystemTray.stage = stage;
- AWTSystemTray.actorSystem = actorSystem;
- AWTSystemTray.application = application;
-
- if (SystemTray.isSupported()) {
- // prevent exiting the app when the last window get closed
- Platform.setImplicitExit(false);
-
- SystemTray systemTray = SystemTray.getSystemTray();
- if (ImageUtil.isRetina())
- trayIcon = new TrayIcon(getImage(ImageUtil.SYS_TRAY_HI_RES));
- else
- trayIcon = new TrayIcon(getImage(ImageUtil.SYS_TRAY));
-
- trayIcon.setToolTip("Bitsquare P2P Fiat-Bitcoin exchange");
-
- PopupMenu popupMenu = new PopupMenu();
- MenuItem aboutItem = new MenuItem("Info about " + Bitsquare.getAppName());
- popupMenu.add(aboutItem);
- popupMenu.addSeparator();
- showGuiItem = new MenuItem("Close exchange window");
- popupMenu.add(showGuiItem);
- popupMenu.addSeparator();
- MenuItem exitItem = new MenuItem("Exit");
- popupMenu.add(exitItem);
-
- trayIcon.setPopupMenu(popupMenu);
-
- showGuiItem.addActionListener(e -> {
- if (isStageVisible) {
- showGuiItem.setLabel("Open exchange window");
- Platform.runLater(stage::hide);
- isStageVisible = false;
- }
- else {
- showGuiItem.setLabel("Close exchange window");
- Platform.runLater(stage::show);
- isStageVisible = true;
- }
- });
- exitItem.addActionListener(e -> {
- systemTray.remove(trayIcon);
- actorSystem.shutdown();
- try {
- actorSystem.awaitTermination(Duration.create(5L, "seconds"));
- } catch (Exception ex) {
- if (ex instanceof TimeoutException)
- log.error("ActorSystem did not shutdown properly.");
- else
- log.error(ex.getMessage());
- }
- try {
- application.stop();
- } catch (Exception e1) {
- e1.printStackTrace();
- }
- });
-
-
- try {
- systemTray.add(trayIcon);
- } catch (AWTException e) {
- log.error("TrayIcon could not be added.");
- }
- }
- else {
- log.error("SystemTray is not supported");
- }
- }
-
- public static void setStageHidden() {
- stage.hide();
- isStageVisible = false;
- showGuiItem.setLabel("Open exchange window");
- }
-
- private static Image getImage(String path) {
- return new ImageIcon(AWTSystemTray.class.getResource(path), "system tray icon").getImage();
- }
-}
diff --git a/src/test/java/io/bitsquare/gui/main/settings/uimock/SeedWordsControllerUIMock.java b/src/main/java/io/bitsquare/gui/FatalException.java
similarity index 59%
rename from src/test/java/io/bitsquare/gui/main/settings/uimock/SeedWordsControllerUIMock.java
rename to src/main/java/io/bitsquare/gui/FatalException.java
index 89e9356833..1ceb228864 100644
--- a/src/test/java/io/bitsquare/gui/main/settings/uimock/SeedWordsControllerUIMock.java
+++ b/src/main/java/io/bitsquare/gui/FatalException.java
@@ -15,25 +15,16 @@
* along with Bitsquare. If not, see .
*/
-package io.bitsquare.gui.main.settings.uimock;
+package io.bitsquare.gui;
-import java.net.URL;
+@SuppressWarnings("serializable")
+public class FatalException extends RuntimeException {
-import java.util.ResourceBundle;
-
-import javafx.fxml.Initializable;
-
-public class SeedWordsControllerUIMock implements Initializable {
-
-
- ///////////////////////////////////////////////////////////////////////////////////////////
- // Lifecycle
- ///////////////////////////////////////////////////////////////////////////////////////////
-
- @Override
- public void initialize(URL url, ResourceBundle rb) {
+ public FatalException(String format, Object... args) {
+ super(String.format(format, args));
}
-
+ public FatalException(Throwable cause, String format, Object... args) {
+ super(String.format(format, args), cause);
+ }
}
-
diff --git a/src/main/java/io/bitsquare/gui/GuiModule.java b/src/main/java/io/bitsquare/gui/GuiModule.java
index f71b626a84..dd39924be1 100644
--- a/src/main/java/io/bitsquare/gui/GuiModule.java
+++ b/src/main/java/io/bitsquare/gui/GuiModule.java
@@ -17,7 +17,9 @@
package io.bitsquare.gui;
-import io.bitsquare.di.AbstractBitsquareModule;
+import io.bitsquare.AbstractBitsquareModule;
+import io.bitsquare.gui.components.Popups;
+import io.bitsquare.gui.main.help.Help;
import io.bitsquare.gui.main.trade.offerbook.OfferBook;
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.gui.util.validation.BankAccountNumberValidator;
@@ -28,10 +30,15 @@ import io.bitsquare.gui.util.validation.PasswordValidator;
import java.util.Properties;
+import javafx.stage.Stage;
+
public class GuiModule extends AbstractBitsquareModule {
- public GuiModule(Properties properties) {
+ private final Stage primaryStage;
+
+ public GuiModule(Properties properties, Stage primaryStage) {
super(properties);
+ this.primaryStage = primaryStage;
}
@Override
@@ -46,5 +53,9 @@ public class GuiModule extends AbstractBitsquareModule {
bind(FiatValidator.class).asEagerSingleton();
bind(InputValidator.class).asEagerSingleton();
bind(PasswordValidator.class).asEagerSingleton();
+
+ bind(Stage.class).toInstance(primaryStage);
+ Popups.primaryStage = primaryStage;
+ Help.primaryStage = primaryStage;
}
}
diff --git a/src/main/java/io/bitsquare/gui/Navigation.java b/src/main/java/io/bitsquare/gui/Navigation.java
index 350d00637a..13668f3504 100644
--- a/src/main/java/io/bitsquare/gui/Navigation.java
+++ b/src/main/java/io/bitsquare/gui/Navigation.java
@@ -138,12 +138,16 @@ public class Navigation {
void onNavigationRequested(Item... items);
}
+ public interface FxmlResource {
+ String getFxmlUrl();
+ }
+
///////////////////////////////////////////////////////////////////////////////////////////
// Enum
///////////////////////////////////////////////////////////////////////////////////////////
- public static enum Item {
+ public static enum Item implements FxmlResource {
///////////////////////////////////////////////////////////////////////////////////////////
// Application
@@ -221,6 +225,7 @@ public class Navigation {
this.fxmlUrl = fxmlUrl;
}
+ @Override
public String getFxmlUrl() {
return fxmlUrl;
}
diff --git a/src/main/java/io/bitsquare/gui/SystemTray.java b/src/main/java/io/bitsquare/gui/SystemTray.java
new file mode 100644
index 0000000000..fc523eda6d
--- /dev/null
+++ b/src/main/java/io/bitsquare/gui/SystemTray.java
@@ -0,0 +1,110 @@
+/*
+ * 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 io.bitsquare.gui.util.ImageUtil;
+
+import java.awt.*;
+
+import javax.swing.*;
+
+import javafx.application.Platform;
+import javafx.stage.Stage;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * There is no JavaFX support yet, so we need to use AWT.
+ */
+public class SystemTray {
+ private static final Logger log = LoggerFactory.getLogger(SystemTray.class);
+
+ private static final String ICON_HI_RES = "/images/system_tray_icon@2x.png";
+ private static final String ICON_LO_RES = "/images/system_tray_icon.png";
+
+ public static final String SHOW_WINDOW_LABEL = "Show exchange window";
+ public static final String HIDE_WINDOW_LABEL = "Hide exchange window";
+
+ private final Stage stage;
+ private final Runnable onExit;
+ private final TrayIcon trayIcon = createTrayIcon();
+ private final MenuItem toggleShowHideItem = new MenuItem(HIDE_WINDOW_LABEL);
+
+ public SystemTray(Stage stage, Runnable onExit) {
+ this.stage = stage;
+ this.onExit = onExit;
+ init();
+ }
+
+ private void init() {
+ if (!java.awt.SystemTray.isSupported()) {
+ log.error("System tray is not supported.");
+ return;
+ }
+
+ // prevent exiting the app when the last window gets closed
+ Platform.setImplicitExit(false);
+
+ MenuItem aboutItem = new MenuItem("Info about Bitsquare");
+ MenuItem exitItem = new MenuItem("Exit");
+
+ PopupMenu popupMenu = new PopupMenu();
+ popupMenu.add(aboutItem);
+ popupMenu.addSeparator();
+ popupMenu.add(toggleShowHideItem);
+ popupMenu.addSeparator();
+ popupMenu.add(exitItem);
+
+ trayIcon.setPopupMenu(popupMenu);
+ trayIcon.setToolTip("Bitsquare: The decentralized bitcoin exchange");
+
+ java.awt.SystemTray self = java.awt.SystemTray.getSystemTray();
+ try {
+ self.add(trayIcon);
+ } catch (AWTException ex) {
+ log.error("Icon could not be added to system tray.", ex);
+ }
+
+ toggleShowHideItem.addActionListener(e -> {
+ if (stage.isShowing()) {
+ toggleShowHideItem.setLabel(SHOW_WINDOW_LABEL);
+ Platform.runLater(stage::hide);
+ }
+ else {
+ toggleShowHideItem.setLabel(HIDE_WINDOW_LABEL);
+ Platform.runLater(stage::show);
+ }
+ });
+
+ exitItem.addActionListener(e -> {
+ self.remove(trayIcon);
+ onExit.run();
+ });
+ }
+
+ public void hideStage() {
+ stage.hide();
+ toggleShowHideItem.setLabel(SHOW_WINDOW_LABEL);
+ }
+
+ private TrayIcon createTrayIcon() {
+ String path = ImageUtil.isRetina() ? ICON_HI_RES : ICON_LO_RES;
+ return new TrayIcon(new ImageIcon(getClass().getResource(path)).getImage());
+ }
+}
diff --git a/src/main/java/io/bitsquare/util/ViewLoader.java b/src/main/java/io/bitsquare/gui/ViewLoader.java
similarity index 84%
rename from src/main/java/io/bitsquare/util/ViewLoader.java
rename to src/main/java/io/bitsquare/gui/ViewLoader.java
index eabc58124f..1de55a7a2e 100644
--- a/src/main/java/io/bitsquare/util/ViewLoader.java
+++ b/src/main/java/io/bitsquare/gui/ViewLoader.java
@@ -15,12 +15,14 @@
* along with Bitsquare. If not, see .
*/
-package io.bitsquare.util;
+package io.bitsquare.gui;
import io.bitsquare.locale.BSResources;
import com.google.inject.Injector;
+import java.io.IOException;
+
import java.net.URL;
import java.util.HashMap;
@@ -51,14 +53,11 @@ public class ViewLoader {
// TODO maybe add more sophisticated caching strategy with removal of rarely accessed items
private static final Map cachedGUIItems = new HashMap<>();
- public ViewLoader(URL url) {
- this(url, true);
- }
-
- // TODO check relationship with CachedViewCB -> derive caching strategy, but there are some special cases where
- // we need an override, as caching is done manually in the client class
- public ViewLoader(URL url, boolean useCaching) {
- this.url = url;
+ public ViewLoader(Navigation.FxmlResource navItem, boolean useCaching) {
+ this.url = ViewLoader.class.getResource(navItem.getFxmlUrl());
+ if (this.url == null) {
+ throw new FatalException("'%s' could not be loaded as a resource", navItem.getFxmlUrl());
+ }
isCached = useCaching && cachedGUIItems.containsKey(url);
if (!isCached) {
@@ -69,19 +68,26 @@ public class ViewLoader {
}
}
+ public ViewLoader(Navigation.FxmlResource navItem) {
+ this(navItem, true);
+ }
+
@SuppressWarnings("unchecked")
- public T load() throws java.io.IOException {
+ public T load() {
if (isCached) {
item = cachedGUIItems.get(url);
log.debug("loaded from cache " + url);
return (T) cachedGUIItems.get(url).view;
}
- else {
- log.debug("load from disc " + url);
+
+ log.debug("load from disc " + url);
+ try {
T result = loader.load();
item = new Item(result, loader.getController());
cachedGUIItems.put(url, item);
return result;
+ } catch (IOException e) {
+ throw new FatalException(e, "Failed to load view at %s", url);
}
}
diff --git a/src/main/java/io/bitsquare/gui/components/AddressTextField.java b/src/main/java/io/bitsquare/gui/components/AddressTextField.java
index d7ffa9bff6..2b7d42e226 100644
--- a/src/main/java/io/bitsquare/gui/components/AddressTextField.java
+++ b/src/main/java/io/bitsquare/gui/components/AddressTextField.java
@@ -59,6 +59,7 @@ public class AddressTextField extends AnchorPane {
private final StringProperty address = new SimpleStringProperty();
private final StringProperty paymentLabel = new SimpleStringProperty();
private final ObjectProperty amountAsCoin = new SimpleObjectProperty<>();
+
private OverlayManager overlayManager;
diff --git a/src/main/java/io/bitsquare/gui/components/Popups.java b/src/main/java/io/bitsquare/gui/components/Popups.java
index 35e60da8a9..0ad9b5806f 100644
--- a/src/main/java/io/bitsquare/gui/components/Popups.java
+++ b/src/main/java/io/bitsquare/gui/components/Popups.java
@@ -17,7 +17,6 @@
package io.bitsquare.gui.components;
-import io.bitsquare.BitsquareUI;
import io.bitsquare.gui.OverlayManager;
import io.bitsquare.locale.BSResources;
@@ -30,6 +29,7 @@ import java.util.List;
import javafx.application.Platform;
import javafx.event.ActionEvent;
+import javafx.stage.Stage;
import org.controlsfx.control.action.AbstractAction;
import org.controlsfx.control.action.Action;
@@ -42,6 +42,8 @@ import org.slf4j.LoggerFactory;
public class Popups {
private static final Logger log = LoggerFactory.getLogger(Popups.class);
+ public static Stage primaryStage;
+
// TODO just temporary, class will be removed completely
public static void setOverlayManager(OverlayManager overlayManager) {
Popups.overlayManager = overlayManager;
@@ -70,7 +72,7 @@ public class Popups {
public static void openInfoPopup(String masthead, String message, List actions) {
Dialogs.create()
- .owner(BitsquareUI.getPrimaryStage())
+ .owner(primaryStage)
.message(message)
.masthead(masthead)
.actions(actions)
@@ -107,7 +109,7 @@ public class Popups {
public static Action openConfirmPopup(String title, String masthead, String message, List actions) {
return Dialogs.create()
- .owner(BitsquareUI.getPrimaryStage())
+ .owner(primaryStage)
.title(title)
.message(message)
.masthead(masthead)
@@ -140,7 +142,7 @@ public class Popups {
private static void openWarningPopup(String title, String masthead, String message, List actions) {
Dialogs.create()
- .owner(BitsquareUI.getPrimaryStage())
+ .owner(primaryStage)
.title(title)
.message(message)
.masthead(masthead)
@@ -173,7 +175,7 @@ public class Popups {
private static Action openErrorPopup(String title, String masthead, String message, List actions) {
return Dialogs.create()
- .owner(BitsquareUI.getPrimaryStage())
+ .owner(primaryStage)
.title(title)
.message(message)
.masthead(masthead)
@@ -202,7 +204,7 @@ public class Popups {
}
});
return Dialogs.create()
- .owner(BitsquareUI.getPrimaryStage())
+ .owner(primaryStage)
.title(title)
.message(message)
.masthead(masthead)
diff --git a/src/main/java/io/bitsquare/gui/main/MainModel.java b/src/main/java/io/bitsquare/gui/main/MainModel.java
index 659ad09e9a..de6a07ce78 100644
--- a/src/main/java/io/bitsquare/gui/main/MainModel.java
+++ b/src/main/java/io/bitsquare/gui/main/MainModel.java
@@ -17,7 +17,6 @@
package io.bitsquare.gui.main;
-import io.bitsquare.Bitsquare;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.gui.UIModel;
@@ -35,6 +34,8 @@ import com.google.inject.Inject;
import java.util.Date;
+import javax.inject.Named;
+
import javafx.application.Platform;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.DoubleProperty;
@@ -57,6 +58,7 @@ class MainModel extends UIModel {
private final MessageFacade messageFacade;
private final TradeManager tradeManager;
private final Persistence persistence;
+ private final int clientPort;
private boolean messageFacadeInited;
private boolean walletFacadeInited;
@@ -72,12 +74,14 @@ class MainModel extends UIModel {
@Inject
private MainModel(User user, WalletFacade walletFacade, MessageFacade messageFacade,
- TradeManager tradeManager, Persistence persistence) {
+ TradeManager tradeManager, Persistence persistence,
+ @Named("clientPort") int clientPort) {
this.user = user;
this.walletFacade = walletFacade;
this.messageFacade = messageFacade;
this.tradeManager = tradeManager;
this.persistence = persistence;
+ this.clientPort = clientPort;
}
@@ -107,7 +111,7 @@ class MainModel extends UIModel {
// For testing with the serverside seednode we need the BootstrappedPeerFactory which gets started form
// messageFacade.init
- messageFacade.init(Bitsquare.getClientPort(), new BootstrapListener() {
+ messageFacade.init(clientPort, new BootstrapListener() {
@Override
public void onCompleted() {
messageFacadeInited = true;
diff --git a/src/main/java/io/bitsquare/gui/main/MainViewCB.java b/src/main/java/io/bitsquare/gui/main/MainViewCB.java
index 5d8ecc48be..c83dd71f05 100644
--- a/src/main/java/io/bitsquare/gui/main/MainViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/MainViewCB.java
@@ -17,26 +17,24 @@
package io.bitsquare.gui.main;
-import io.bitsquare.Bitsquare;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.OverlayManager;
import io.bitsquare.gui.ViewCB;
+import io.bitsquare.gui.ViewLoader;
import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.components.SystemNotification;
import io.bitsquare.gui.util.Profiler;
import io.bitsquare.gui.util.Transitions;
import io.bitsquare.settings.Settings;
import io.bitsquare.trade.TradeManager;
-import io.bitsquare.util.ViewLoader;
-
-import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javax.inject.Inject;
+import javax.inject.Named;
import javafx.animation.Interpolator;
import javafx.application.Platform;
@@ -58,9 +56,9 @@ public class MainViewCB extends ViewCB {
private final Navigation navigation;
private final OverlayManager overlayManager;
- private Settings settings;
-
private final ToggleGroup navButtonsGroup = new ToggleGroup();
+ private final Settings settings;
+ private final String appName;
private BorderPane baseApplicationContainer;
private VBox splashScreen;
@@ -78,12 +76,13 @@ public class MainViewCB extends ViewCB {
@Inject
private MainViewCB(MainPM presentationModel, Navigation navigation, OverlayManager overlayManager,
- TradeManager tradeManager, Settings settings) {
+ TradeManager tradeManager, Settings settings, @Named("appName") String appName) {
super(presentationModel);
this.navigation = navigation;
this.overlayManager = overlayManager;
this.settings = settings;
+ this.appName = appName;
tradeManager.featureNotImplementedWarningProperty().addListener((ov, oldValue, newValue) -> {
if (oldValue == null && newValue != null) {
@@ -146,21 +145,15 @@ public class MainViewCB extends ViewCB {
@Override
protected Initializable loadView(Navigation.Item navigationItem) {
super.loadView((navigationItem));
- final ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()));
- try {
- final Node view = loader.load();
- contentContainer.getChildren().setAll(view);
- childController = loader.getController();
+ final ViewLoader loader = new ViewLoader(navigationItem);
+ final Node view = loader.load();
+ contentContainer.getChildren().setAll(view);
+ childController = loader.getController();
- if (childController instanceof ViewCB)
- ((ViewCB) childController).setParent(this);
+ if (childController instanceof ViewCB)
+ ((ViewCB) childController).setParent(this);
- return childController;
- } catch (IOException e) {
- e.printStackTrace();
- log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl());
- }
- return null;
+ return childController;
}
@@ -213,8 +206,8 @@ public class MainViewCB extends ViewCB {
numPendingTradesLabel.setText(String.valueOf(numPendingTrades));
}
- log.trace("openInfoNotification " + Bitsquare.getAppName());
- SystemNotification.openInfoNotification(Bitsquare.getAppName(), "You got a new trade message.");
+ log.trace("openInfoNotification " + appName);
+ SystemNotification.openInfoNotification(appName, "You got a new trade message.");
}
else {
if (portfolioButtonButtonPane.getChildren().size() > 1)
diff --git a/src/main/java/io/bitsquare/gui/main/account/AccountViewCB.java b/src/main/java/io/bitsquare/gui/main/account/AccountViewCB.java
index 27497c60f6..9f05d3d08d 100644
--- a/src/main/java/io/bitsquare/gui/main/account/AccountViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/account/AccountViewCB.java
@@ -20,9 +20,7 @@ package io.bitsquare.gui.main.account;
import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.ViewCB;
-import io.bitsquare.util.ViewLoader;
-
-import java.io.IOException;
+import io.bitsquare.gui.ViewLoader;
import java.net.URL;
@@ -136,38 +134,33 @@ public class AccountViewCB extends CachedViewCB {
protected Initializable loadView(Navigation.Item navigationItem) {
super.loadView(navigationItem);
- final ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()));
- try {
- Node view = loader.load();
- Tab tab = null;
- switch (navigationItem) {
- case ACCOUNT_SETTINGS:
- tab = accountSettingsTab;
- tab.setText("Account settings");
- arbitratorSettingsTab.setDisable(false);
- break;
- case ACCOUNT_SETUP:
- tab = accountSettingsTab;
- tab.setText("Account setup");
- arbitratorSettingsTab.setDisable(true);
- break;
- case ARBITRATOR_SETTINGS:
- tab = arbitratorSettingsTab;
- break;
- }
-
- // for IRC demo we deactivate the arbitratorSettingsTab
- arbitratorSettingsTab.setDisable(true);
-
- tab.setContent(view);
- ((TabPane) root).getSelectionModel().select(tab);
- Initializable childController = loader.getController();
- ((ViewCB) childController).setParent(this);
-
- } catch (IOException e) {
- log.error("Loading view failed. FxmlUrl = " + Navigation.Item.ACCOUNT_SETUP.getFxmlUrl());
- e.printStackTrace();
+ final ViewLoader loader = new ViewLoader(navigationItem);
+ Node view = loader.load();
+ Tab tab = null;
+ switch (navigationItem) {
+ case ACCOUNT_SETTINGS:
+ tab = accountSettingsTab;
+ tab.setText("Account settings");
+ arbitratorSettingsTab.setDisable(false);
+ break;
+ case ACCOUNT_SETUP:
+ tab = accountSettingsTab;
+ tab.setText("Account setup");
+ arbitratorSettingsTab.setDisable(true);
+ break;
+ case ARBITRATOR_SETTINGS:
+ tab = arbitratorSettingsTab;
+ break;
}
+
+ // for IRC demo we deactivate the arbitratorSettingsTab
+ arbitratorSettingsTab.setDisable(true);
+
+ tab.setContent(view);
+ ((TabPane) root).getSelectionModel().select(tab);
+ Initializable childController = loader.getController();
+ ((ViewCB) childController).setParent(this);
+
return childController;
}
diff --git a/src/main/java/io/bitsquare/gui/main/account/arbitrator/ArbitratorSettingsViewCB.java b/src/main/java/io/bitsquare/gui/main/account/arbitrator/ArbitratorSettingsViewCB.java
index 0ea5bac3a1..d93b9588aa 100644
--- a/src/main/java/io/bitsquare/gui/main/account/arbitrator/ArbitratorSettingsViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/account/arbitrator/ArbitratorSettingsViewCB.java
@@ -17,13 +17,10 @@
package io.bitsquare.gui.main.account.arbitrator;
-import io.bitsquare.BitsquareUI;
import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.Navigation;
+import io.bitsquare.gui.ViewLoader;
import io.bitsquare.gui.main.account.arbitrator.registration.ArbitratorRegistrationViewCB;
-import io.bitsquare.util.ViewLoader;
-
-import java.io.IOException;
import java.net.URL;
@@ -45,7 +42,8 @@ public class ArbitratorSettingsViewCB extends CachedViewCB {
private static final Logger log = LoggerFactory.getLogger(ArbitratorSettingsViewCB.class);
- private Navigation navigation;
+ private final Navigation navigation;
+ private final Stage primaryStage;
private ArbitratorRegistrationViewCB arbitratorRegistrationViewCB;
@@ -55,9 +53,10 @@ public class ArbitratorSettingsViewCB extends CachedViewCB {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
- private ArbitratorSettingsViewCB(Navigation navigation) {
+ private ArbitratorSettingsViewCB(Navigation navigation, Stage primaryStage) {
super();
this.navigation = navigation;
+ this.primaryStage = primaryStage;
}
@@ -97,31 +96,26 @@ public class ArbitratorSettingsViewCB extends CachedViewCB {
@Override
protected Initializable loadView(Navigation.Item navigationItem) {
// don't use caching here, cause exc. -> need to investigate and is rarely called so no caching is better
- final ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
- try {
- final Parent view = loader.load();
- arbitratorRegistrationViewCB = loader.getController();
+ final ViewLoader loader = new ViewLoader(navigationItem, false);
- final Stage rootStage = BitsquareUI.getPrimaryStage();
- final Stage stage = new Stage();
- stage.setTitle("Arbitrator");
- stage.setMinWidth(800);
- stage.setMinHeight(400);
- stage.setWidth(800);
- stage.setHeight(600);
- stage.setX(rootStage.getX() + 50);
- stage.setY(rootStage.getY() + 50);
- stage.initModality(Modality.WINDOW_MODAL);
- stage.initOwner(rootStage);
- Scene scene = new Scene(view, 800, 600);
- stage.setScene(scene);
- stage.show();
+ final Parent view = loader.load();
+ arbitratorRegistrationViewCB = loader.getController();
- return arbitratorRegistrationViewCB;
- } catch (IOException e) {
- e.printStackTrace();
- }
- return null;
+ final Stage stage = new Stage();
+ stage.setTitle("Arbitrator");
+ stage.setMinWidth(800);
+ stage.setMinHeight(400);
+ stage.setWidth(800);
+ stage.setHeight(600);
+ stage.setX(primaryStage.getX() + 50);
+ stage.setY(primaryStage.getY() + 50);
+ stage.initModality(Modality.WINDOW_MODAL);
+ stage.initOwner(primaryStage);
+ Scene scene = new Scene(view, 800, 600);
+ stage.setScene(scene);
+ stage.show();
+
+ return arbitratorRegistrationViewCB;
}
diff --git a/src/main/java/io/bitsquare/gui/main/account/arbitrator/browser/ArbitratorBrowserViewCB.java b/src/main/java/io/bitsquare/gui/main/account/arbitrator/browser/ArbitratorBrowserViewCB.java
index 966e00ba42..1c19de23bd 100644
--- a/src/main/java/io/bitsquare/gui/main/account/arbitrator/browser/ArbitratorBrowserViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/account/arbitrator/browser/ArbitratorBrowserViewCB.java
@@ -21,15 +21,13 @@ import io.bitsquare.arbitrator.Arbitrator;
import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.ViewCB;
+import io.bitsquare.gui.ViewLoader;
import io.bitsquare.gui.main.account.arbitrator.profile.ArbitratorProfileViewCB;
import io.bitsquare.locale.LanguageUtil;
import io.bitsquare.msg.MessageFacade;
import io.bitsquare.msg.listeners.ArbitratorListener;
import io.bitsquare.persistence.Persistence;
import io.bitsquare.settings.Settings;
-import io.bitsquare.util.ViewLoader;
-
-import java.io.IOException;
import java.net.URL;
@@ -140,17 +138,12 @@ public class ArbitratorBrowserViewCB extends CachedViewCB implements ArbitratorL
protected Initializable loadView(Navigation.Item navigationItem) {
super.loadView(navigationItem);
- final ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()));
- try {
- Node view = loader.load();
- ((Pane) root).getChildren().set(0, view);
- Initializable childController = arbitratorProfileViewCB = loader.getController();
- ((ViewCB) childController).setParent(this);
+ final ViewLoader loader = new ViewLoader(navigationItem);
+ Node view = loader.load();
+ ((Pane) root).getChildren().set(0, view);
+ Initializable childController = arbitratorProfileViewCB = loader.getController();
+ ((ViewCB) childController).setParent(this);
- } catch (IOException e) {
- log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl());
- e.printStackTrace();
- }
return childController;
}
diff --git a/src/main/java/io/bitsquare/gui/main/account/content/restrictions/RestrictionsViewCB.java b/src/main/java/io/bitsquare/gui/main/account/content/restrictions/RestrictionsViewCB.java
index 440ef9222d..749e921585 100644
--- a/src/main/java/io/bitsquare/gui/main/account/content/restrictions/RestrictionsViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/account/content/restrictions/RestrictionsViewCB.java
@@ -17,10 +17,10 @@
package io.bitsquare.gui.main.account.content.restrictions;
-import io.bitsquare.BitsquareUI;
import io.bitsquare.arbitrator.Arbitrator;
import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.Navigation;
+import io.bitsquare.gui.ViewLoader;
import io.bitsquare.gui.main.account.MultiStepNavigation;
import io.bitsquare.gui.main.account.content.ContextAware;
import io.bitsquare.gui.main.help.Help;
@@ -28,9 +28,6 @@ import io.bitsquare.gui.main.help.HelpId;
import io.bitsquare.gui.util.ImageUtil;
import io.bitsquare.locale.Country;
import io.bitsquare.locale.Region;
-import io.bitsquare.util.ViewLoader;
-
-import java.io.IOException;
import java.net.URL;
@@ -56,6 +53,7 @@ import org.slf4j.LoggerFactory;
public class RestrictionsViewCB extends CachedViewCB implements ContextAware {
private static final Logger log = LoggerFactory.getLogger(RestrictionsViewCB.class);
+ private final Stage primaryStage;
@FXML ListView languagesListView;
@FXML ListView countriesListView;
@@ -71,8 +69,9 @@ public class RestrictionsViewCB extends CachedViewCB implements
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
- private RestrictionsViewCB(RestrictionsPM presentationModel) {
+ private RestrictionsViewCB(RestrictionsPM presentationModel, Stage primaryStage) {
super(presentationModel);
+ this.primaryStage = primaryStage;
}
@@ -189,37 +188,31 @@ public class RestrictionsViewCB extends CachedViewCB implements
@Override
protected Initializable loadView(Navigation.Item navigationItem) {
// TODO caching causes exception
- final ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
- try {
- final Node view = loader.load();
- //TODO Resolve type problem...
- Initializable childController = loader.getController();
- //childController.setParentController(this);
+ final ViewLoader loader = new ViewLoader(navigationItem, false);
+ final Node view = loader.load();
+ //TODO Resolve type problem...
+ Initializable childController = loader.getController();
+ //childController.setParentController(this);
- final Stage rootStage = BitsquareUI.getPrimaryStage();
- final Stage stage = new Stage();
- stage.setTitle("Arbitrator selection");
- stage.setMinWidth(800);
- stage.setMinHeight(500);
- stage.setWidth(800);
- stage.setHeight(600);
- stage.setX(rootStage.getX() + 50);
- stage.setY(rootStage.getY() + 50);
- stage.initModality(Modality.WINDOW_MODAL);
- stage.initOwner(rootStage);
- Scene scene = new Scene((Parent) view, 800, 600);
- stage.setScene(scene);
- stage.setOnHidden(windowEvent -> {
- if (navigationItem == Navigation.Item.ARBITRATOR_BROWSER)
- updateArbitratorList();
- });
- stage.show();
+ final Stage stage = new Stage();
+ stage.setTitle("Arbitrator selection");
+ stage.setMinWidth(800);
+ stage.setMinHeight(500);
+ stage.setWidth(800);
+ stage.setHeight(600);
+ stage.setX(primaryStage.getX() + 50);
+ stage.setY(primaryStage.getY() + 50);
+ stage.initModality(Modality.WINDOW_MODAL);
+ stage.initOwner(primaryStage);
+ Scene scene = new Scene((Parent) view, 800, 600);
+ stage.setScene(scene);
+ stage.setOnHidden(windowEvent -> {
+ if (navigationItem == Navigation.Item.ARBITRATOR_BROWSER)
+ updateArbitratorList();
+ });
+ stage.show();
- return childController;
- } catch (IOException e) {
- e.printStackTrace();
- }
- return null;
+ return childController;
}
diff --git a/src/main/java/io/bitsquare/gui/main/account/settings/AccountSettingsViewCB.java b/src/main/java/io/bitsquare/gui/main/account/settings/AccountSettingsViewCB.java
index 99bf9ee750..5058c9f345 100644
--- a/src/main/java/io/bitsquare/gui/main/account/settings/AccountSettingsViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/account/settings/AccountSettingsViewCB.java
@@ -21,11 +21,9 @@ import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.ViewCB;
+import io.bitsquare.gui.ViewLoader;
import io.bitsquare.gui.main.account.content.ContextAware;
import io.bitsquare.gui.util.Colors;
-import io.bitsquare.util.ViewLoader;
-
-import java.io.IOException;
import java.net.URL;
@@ -148,19 +146,13 @@ public class AccountSettingsViewCB extends CachedViewCB {
@Override
protected Initializable loadView(Navigation.Item navigationItem) {
- final ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()));
- try {
- final Pane view = loader.load();
- content.getChildren().setAll(view);
- childController = loader.getController();
- ((ViewCB extends PresentationModel>) childController).setParent(this);
- ((ContextAware) childController).useSettingsContext(true);
- return childController;
- } catch (IOException e) {
- log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl());
- e.printStackTrace();
- }
- return null;
+ final ViewLoader loader = new ViewLoader(navigationItem);
+ final Pane view = loader.load();
+ content.getChildren().setAll(view);
+ childController = loader.getController();
+ ((ViewCB extends PresentationModel>) childController).setParent(this);
+ ((ContextAware) childController).useSettingsContext(true);
+ return childController;
}
diff --git a/src/main/java/io/bitsquare/gui/main/account/setup/AccountSetupViewCB.java b/src/main/java/io/bitsquare/gui/main/account/setup/AccountSetupViewCB.java
index e4372a3287..246f109fe4 100644
--- a/src/main/java/io/bitsquare/gui/main/account/setup/AccountSetupViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/account/setup/AccountSetupViewCB.java
@@ -20,6 +20,7 @@ package io.bitsquare.gui.main.account.setup;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.ViewCB;
+import io.bitsquare.gui.ViewLoader;
import io.bitsquare.gui.main.account.MultiStepNavigation;
import io.bitsquare.gui.main.account.content.ContextAware;
import io.bitsquare.gui.main.account.content.irc.IrcAccountViewCB;
@@ -27,9 +28,6 @@ import io.bitsquare.gui.main.account.content.password.PasswordViewCB;
import io.bitsquare.gui.main.account.content.registration.RegistrationViewCB;
import io.bitsquare.gui.main.account.content.restrictions.RestrictionsViewCB;
import io.bitsquare.gui.main.account.content.seedwords.SeedWordsViewCB;
-import io.bitsquare.util.ViewLoader;
-
-import java.io.IOException;
import java.net.URL;
@@ -188,19 +186,13 @@ public class AccountSetupViewCB extends ViewCB implements MultiStepNavigation {
@Override
protected Initializable loadView(Navigation.Item navigationItem) {
- final ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()));
- try {
- final Pane view = loader.load();
- content.getChildren().setAll(view);
- childController = loader.getController();
- ((ViewCB extends PresentationModel>) childController).setParent(this);
- ((ContextAware) childController).useSettingsContext(false);
- return childController;
- } catch (IOException e) {
- log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl());
- e.printStackTrace();
- }
- return null;
+ final ViewLoader loader = new ViewLoader(navigationItem);
+ final Pane view = loader.load();
+ content.getChildren().setAll(view);
+ childController = loader.getController();
+ ((ViewCB extends PresentationModel>) childController).setParent(this);
+ ((ContextAware) childController).useSettingsContext(false);
+ return childController;
}
}
diff --git a/src/main/java/io/bitsquare/gui/main/funds/FundsViewCB.java b/src/main/java/io/bitsquare/gui/main/funds/FundsViewCB.java
index b5c635f63c..7f7780d29d 100644
--- a/src/main/java/io/bitsquare/gui/main/funds/FundsViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/funds/FundsViewCB.java
@@ -20,9 +20,7 @@ package io.bitsquare.gui.main.funds;
import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.ViewCB;
-import io.bitsquare.util.ViewLoader;
-
-import java.io.IOException;
+import io.bitsquare.gui.ViewLoader;
import java.net.URL;
@@ -120,27 +118,22 @@ public class FundsViewCB extends CachedViewCB {
protected Initializable loadView(Navigation.Item navigationItem) {
super.loadView(navigationItem);
- final ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()));
- try {
- Node view = loader.load();
- Tab tab = null;
- switch (navigationItem) {
- case WITHDRAWAL:
- tab = withdrawalTab;
- break;
- case TRANSACTIONS:
- tab = transactionsTab;
- break;
- }
- tab.setContent(view);
- ((TabPane) root).getSelectionModel().select(tab);
- Initializable childController = loader.getController();
- ((ViewCB) childController).setParent(this);
-
- } catch (IOException e) {
- log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl());
- e.printStackTrace();
+ final ViewLoader loader = new ViewLoader(navigationItem);
+ Node view = loader.load();
+ Tab tab = null;
+ switch (navigationItem) {
+ case WITHDRAWAL:
+ tab = withdrawalTab;
+ break;
+ case TRANSACTIONS:
+ tab = transactionsTab;
+ break;
}
+ tab.setContent(view);
+ ((TabPane) root).getSelectionModel().select(tab);
+ Initializable childController = loader.getController();
+ ((ViewCB) childController).setParent(this);
+
return childController;
}
diff --git a/src/main/java/io/bitsquare/gui/main/help/Help.java b/src/main/java/io/bitsquare/gui/main/help/Help.java
index d6ff3dc518..aac2d7d1ca 100644
--- a/src/main/java/io/bitsquare/gui/main/help/Help.java
+++ b/src/main/java/io/bitsquare/gui/main/help/Help.java
@@ -17,8 +17,6 @@
package io.bitsquare.gui.main.help;
-import io.bitsquare.BitsquareUI;
-
import java.net.MalformedURLException;
import java.net.URL;
@@ -35,6 +33,7 @@ public class Help {
private static final Logger log = LoggerFactory.getLogger(Help.class);
private static Stage helpWindow;
+ public static Stage primaryStage;
///////////////////////////////////////////////////////////////////////////////////////////
@@ -49,7 +48,7 @@ public class Help {
if (helpWindow == null) {
helpWindow = new Stage();
helpWindow.initModality(Modality.NONE);
- helpWindow.initOwner(BitsquareUI.getPrimaryStage());
+ helpWindow.initOwner(primaryStage);
webView = new WebView();
helpWindow.setScene(new Scene(webView, 800, 600));
}
diff --git a/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioViewCB.java b/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioViewCB.java
index e7a1971ef5..d1211da49d 100644
--- a/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioViewCB.java
@@ -20,10 +20,8 @@ package io.bitsquare.gui.main.portfolio;
import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.ViewCB;
+import io.bitsquare.gui.ViewLoader;
import io.bitsquare.trade.TradeManager;
-import io.bitsquare.util.ViewLoader;
-
-import java.io.IOException;
import java.net.URL;
@@ -126,30 +124,25 @@ public class PortfolioViewCB extends CachedViewCB {
protected Initializable loadView(Navigation.Item navigationItem) {
super.loadView(navigationItem);
- final ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()));
- try {
- Parent view = loader.load();
- Tab tab = null;
- switch (navigationItem) {
- case OFFERS:
- tab = offersTab;
- break;
- case PENDING_TRADES:
- tab = pendingTradesTab;
- break;
- case CLOSED_TRADES:
- tab = closedTradesTab;
- break;
- }
- tab.setContent(view);
- ((TabPane) root).getSelectionModel().select(tab);
- Initializable childController = loader.getController();
- ((ViewCB) childController).setParent(this);
-
- } catch (IOException e) {
- log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl());
- e.printStackTrace();
+ final ViewLoader loader = new ViewLoader(navigationItem);
+ Parent view = loader.load();
+ Tab tab = null;
+ switch (navigationItem) {
+ case OFFERS:
+ tab = offersTab;
+ break;
+ case PENDING_TRADES:
+ tab = pendingTradesTab;
+ break;
+ case CLOSED_TRADES:
+ tab = closedTradesTab;
+ break;
}
+ tab.setContent(view);
+ ((TabPane) root).getSelectionModel().select(tab);
+ Initializable childController = loader.getController();
+ ((ViewCB) childController).setParent(this);
+
return childController;
}
}
diff --git a/src/main/java/io/bitsquare/gui/main/portfolio/closed/ClosedTradesModel.java b/src/main/java/io/bitsquare/gui/main/portfolio/closed/ClosedTradesModel.java
index 4db4756aa7..453884402b 100644
--- a/src/main/java/io/bitsquare/gui/main/portfolio/closed/ClosedTradesModel.java
+++ b/src/main/java/io/bitsquare/gui/main/portfolio/closed/ClosedTradesModel.java
@@ -18,8 +18,8 @@
package io.bitsquare.gui.main.portfolio.closed;
import io.bitsquare.gui.UIModel;
-import io.bitsquare.trade.Direction;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Direction;
+import io.bitsquare.offer.Offer;
import io.bitsquare.trade.Trade;
import io.bitsquare.trade.TradeManager;
import io.bitsquare.user.User;
diff --git a/src/main/java/io/bitsquare/gui/main/portfolio/offer/OfferListItem.java b/src/main/java/io/bitsquare/gui/main/portfolio/offer/OfferListItem.java
index 70ed12c71f..51cec54090 100644
--- a/src/main/java/io/bitsquare/gui/main/portfolio/offer/OfferListItem.java
+++ b/src/main/java/io/bitsquare/gui/main/portfolio/offer/OfferListItem.java
@@ -17,7 +17,7 @@
package io.bitsquare.gui.main.portfolio.offer;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Offer;
/**
* We could remove that wrapper if it is not needed for additional UI only fields.
diff --git a/src/main/java/io/bitsquare/gui/main/portfolio/offer/OffersModel.java b/src/main/java/io/bitsquare/gui/main/portfolio/offer/OffersModel.java
index cdc27a3451..2e067cec85 100644
--- a/src/main/java/io/bitsquare/gui/main/portfolio/offer/OffersModel.java
+++ b/src/main/java/io/bitsquare/gui/main/portfolio/offer/OffersModel.java
@@ -18,8 +18,8 @@
package io.bitsquare.gui.main.portfolio.offer;
import io.bitsquare.gui.UIModel;
-import io.bitsquare.trade.Direction;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Direction;
+import io.bitsquare.offer.Offer;
import io.bitsquare.trade.TradeManager;
import io.bitsquare.user.User;
diff --git a/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesModel.java b/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesModel.java
index 31eac954fe..d78a34e3e7 100644
--- a/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesModel.java
+++ b/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesModel.java
@@ -22,8 +22,8 @@ import io.bitsquare.btc.FeePolicy;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.btc.listeners.TxConfidenceListener;
import io.bitsquare.gui.UIModel;
-import io.bitsquare.trade.Direction;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Direction;
+import io.bitsquare.offer.Offer;
import io.bitsquare.trade.Trade;
import io.bitsquare.trade.TradeManager;
import io.bitsquare.user.User;
diff --git a/src/main/java/io/bitsquare/gui/main/trade/TradeNavigator.java b/src/main/java/io/bitsquare/gui/main/trade/TradeNavigator.java
index e65a0cd346..253590b00a 100644
--- a/src/main/java/io/bitsquare/gui/main/trade/TradeNavigator.java
+++ b/src/main/java/io/bitsquare/gui/main/trade/TradeNavigator.java
@@ -17,7 +17,7 @@
package io.bitsquare.gui.main.trade;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Offer;
import org.bitcoinj.core.Coin;
import org.bitcoinj.utils.Fiat;
diff --git a/src/main/java/io/bitsquare/gui/main/trade/TradeViewCB.java b/src/main/java/io/bitsquare/gui/main/trade/TradeViewCB.java
index f420d56c5f..910ce9a3a8 100644
--- a/src/main/java/io/bitsquare/gui/main/trade/TradeViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/trade/TradeViewCB.java
@@ -19,19 +19,17 @@ package io.bitsquare.gui.main.trade;
import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.Navigation;
+import io.bitsquare.gui.ViewLoader;
import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.main.trade.createoffer.CreateOfferViewCB;
import io.bitsquare.gui.main.trade.offerbook.OfferBookViewCB;
import io.bitsquare.gui.main.trade.takeoffer.TakeOfferViewCB;
-import io.bitsquare.trade.Direction;
-import io.bitsquare.trade.Offer;
-import io.bitsquare.util.ViewLoader;
+import io.bitsquare.offer.Direction;
+import io.bitsquare.offer.Offer;
import org.bitcoinj.core.Coin;
import org.bitcoinj.utils.Fiat;
-import java.io.IOException;
-
import java.net.URL;
import java.util.List;
@@ -168,63 +166,50 @@ public class TradeViewCB extends CachedViewCB implements TradeNavigator {
TabPane tabPane = (TabPane) root;
if (navigationItem == Navigation.Item.OFFER_BOOK && offerBookViewCB == null) {
// Offerbook must not be cached by ViewLoader as we use 2 instances for sell and buy screens.
- ViewLoader offerBookLoader =
- new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
- try {
- final Parent view = offerBookLoader.load();
- final Tab tab = new Tab(direction == Direction.BUY ? "Buy Bitcoin" : "Sell Bitcoin");
- tab.setClosable(false);
- tab.setContent(view);
- tabPane.getTabs().add(tab);
- offerBookViewCB = offerBookLoader.getController();
- offerBookViewCB.setParent(this);
+ ViewLoader offerBookLoader = new ViewLoader(navigationItem, false);
+ final Parent view = offerBookLoader.load();
+ final Tab tab = new Tab(direction == Direction.BUY ? "Buy Bitcoin" : "Sell Bitcoin");
+ tab.setClosable(false);
+ tab.setContent(view);
+ tabPane.getTabs().add(tab);
+ offerBookViewCB = offerBookLoader.getController();
+ offerBookViewCB.setParent(this);
- offerBookViewCB.setDirection(direction);
- // offerBookViewCB.setNavigationListener(n -> loadView(n));
+ offerBookViewCB.setDirection(direction);
+ // offerBookViewCB.setNavigationListener(n -> loadView(n));
- return offerBookViewCB;
- } catch (IOException e) {
- log.error(e.getMessage());
- }
+ return offerBookViewCB;
}
else if (navigationItem == Navigation.Item.CREATE_OFFER && createOfferViewCB == null) {
// CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times
// in different graphs
- ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
- try {
- createOfferView = loader.load();
- createOfferViewCB = loader.getController();
- createOfferViewCB.setParent(this);
- createOfferViewCB.initWithData(direction, amount, price);
- createOfferViewCB.setCloseListener(this::onCreateOfferViewRemoved);
- final Tab tab = new Tab("Create offer");
- tab.setContent(createOfferView);
- tabPane.getTabs().add(tab);
- tabPane.getSelectionModel().select(tab);
- return createOfferViewCB;
- } catch (IOException e) {
- log.error(e.getMessage());
- }
+ final ViewLoader loader = new ViewLoader(navigationItem, false);
+ createOfferView = loader.load();
+ createOfferViewCB = loader.getController();
+ createOfferViewCB.setParent(this);
+ createOfferViewCB.initWithData(direction, amount, price);
+ createOfferViewCB.setCloseListener(this::onCreateOfferViewRemoved);
+ final Tab tab = new Tab("Create offer");
+ tab.setContent(createOfferView);
+ tabPane.getTabs().add(tab);
+ tabPane.getSelectionModel().select(tab);
+ return createOfferViewCB;
}
else if (navigationItem == Navigation.Item.TAKE_OFFER && takeOfferViewCB == null &&
offer != null) {
// CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times
// in different graphs
- ViewLoader loader = new ViewLoader(getClass().getResource(Navigation.Item.TAKE_OFFER.getFxmlUrl()), false);
- try {
- takeOfferView = loader.load();
- takeOfferViewCB = loader.getController();
- takeOfferViewCB.setParent(this);
- takeOfferViewCB.initWithData(direction, amount, offer);
- takeOfferViewCB.setCloseListener(this::onCreateOfferViewRemoved);
- final Tab tab = new Tab("Take offer");
- tab.setContent(takeOfferView);
- tabPane.getTabs().add(tab);
- tabPane.getSelectionModel().select(tab);
- return takeOfferViewCB;
- } catch (IOException e) {
- log.error(e.getMessage());
- }
+ ViewLoader loader = new ViewLoader(Navigation.Item.TAKE_OFFER, false);
+ takeOfferView = loader.load();
+ takeOfferViewCB = loader.getController();
+ takeOfferViewCB.setParent(this);
+ takeOfferViewCB.initWithData(direction, amount, offer);
+ takeOfferViewCB.setCloseListener(this::onCreateOfferViewRemoved);
+ final Tab tab = new Tab("Take offer");
+ tab.setContent(takeOfferView);
+ tabPane.getTabs().add(tab);
+ tabPane.getSelectionModel().select(tab);
+ return takeOfferViewCB;
}
return null;
}
diff --git a/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferModel.java b/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferModel.java
index bd4fc104f4..b7bc9eb5d1 100644
--- a/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferModel.java
+++ b/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferModel.java
@@ -26,9 +26,9 @@ import io.bitsquare.btc.listeners.BalanceListener;
import io.bitsquare.gui.UIModel;
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.locale.Country;
+import io.bitsquare.offer.Direction;
import io.bitsquare.persistence.Persistence;
import io.bitsquare.settings.Settings;
-import io.bitsquare.trade.Direction;
import io.bitsquare.trade.TradeManager;
import io.bitsquare.user.User;
diff --git a/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferPM.java b/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferPM.java
index 45fc40ef04..c8dfecadab 100644
--- a/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferPM.java
+++ b/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferPM.java
@@ -24,7 +24,7 @@ import io.bitsquare.gui.util.validation.BtcValidator;
import io.bitsquare.gui.util.validation.FiatValidator;
import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.locale.BSResources;
-import io.bitsquare.trade.Direction;
+import io.bitsquare.offer.Direction;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.Coin;
diff --git a/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferViewCB.java b/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferViewCB.java
index a63dada893..39c968a6bb 100644
--- a/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferViewCB.java
@@ -31,7 +31,7 @@ import io.bitsquare.gui.main.help.Help;
import io.bitsquare.gui.main.help.HelpId;
import io.bitsquare.gui.util.ImageUtil;
import io.bitsquare.locale.BSResources;
-import io.bitsquare.trade.Direction;
+import io.bitsquare.offer.Direction;
import org.bitcoinj.core.Coin;
import org.bitcoinj.utils.Fiat;
diff --git a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBook.java b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBook.java
index 55470fc053..e962e6b451 100644
--- a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBook.java
+++ b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBook.java
@@ -22,7 +22,7 @@ import io.bitsquare.locale.Country;
import io.bitsquare.locale.CurrencyUtil;
import io.bitsquare.msg.MessageFacade;
import io.bitsquare.msg.listeners.OfferBookListener;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Offer;
import io.bitsquare.user.User;
import io.bitsquare.util.Utilities;
diff --git a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookListItem.java b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookListItem.java
index 47ea51087f..40b9119509 100644
--- a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookListItem.java
+++ b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookListItem.java
@@ -18,7 +18,7 @@
package io.bitsquare.gui.main.trade.offerbook;
import io.bitsquare.locale.Country;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Offer;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
diff --git a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookModel.java b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookModel.java
index 355e9041b0..f625a8a7c7 100644
--- a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookModel.java
+++ b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookModel.java
@@ -22,9 +22,9 @@ import io.bitsquare.gui.UIModel;
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.locale.Country;
import io.bitsquare.locale.CurrencyUtil;
+import io.bitsquare.offer.Direction;
+import io.bitsquare.offer.Offer;
import io.bitsquare.settings.Settings;
-import io.bitsquare.trade.Direction;
-import io.bitsquare.trade.Offer;
import io.bitsquare.trade.TradeManager;
import io.bitsquare.user.User;
diff --git a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookPM.java b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookPM.java
index 8845e5940d..d15de26015 100644
--- a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookPM.java
+++ b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookPM.java
@@ -23,8 +23,8 @@ import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.gui.util.validation.OptionalBtcValidator;
import io.bitsquare.gui.util.validation.OptionalFiatValidator;
import io.bitsquare.locale.BSResources;
-import io.bitsquare.trade.Direction;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Direction;
+import io.bitsquare.offer.Offer;
import org.bitcoinj.core.Coin;
import org.bitcoinj.utils.Fiat;
diff --git a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookViewCB.java b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookViewCB.java
index 7a8d188c2d..a761de2ada 100644
--- a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookViewCB.java
@@ -28,8 +28,8 @@ import io.bitsquare.gui.util.validation.OptionalBtcValidator;
import io.bitsquare.gui.util.validation.OptionalFiatValidator;
import io.bitsquare.locale.BSResources;
import io.bitsquare.locale.Country;
-import io.bitsquare.trade.Direction;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Direction;
+import io.bitsquare.offer.Offer;
import java.net.URL;
diff --git a/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferModel.java b/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferModel.java
index a67f7eccf9..fc9196f9fa 100644
--- a/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferModel.java
+++ b/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferModel.java
@@ -22,9 +22,9 @@ import io.bitsquare.btc.FeePolicy;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.btc.listeners.BalanceListener;
import io.bitsquare.gui.UIModel;
+import io.bitsquare.offer.Offer;
import io.bitsquare.persistence.Persistence;
import io.bitsquare.settings.Settings;
-import io.bitsquare.trade.Offer;
import io.bitsquare.trade.Trade;
import io.bitsquare.trade.TradeManager;
diff --git a/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferPM.java b/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferPM.java
index 48afc5b312..931587ab89 100644
--- a/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferPM.java
+++ b/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferPM.java
@@ -23,8 +23,8 @@ import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.gui.util.validation.BtcValidator;
import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.locale.BSResources;
-import io.bitsquare.trade.Direction;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Direction;
+import io.bitsquare.offer.Offer;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.Coin;
diff --git a/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferViewCB.java b/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferViewCB.java
index de51061850..cbeeec5d58 100644
--- a/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferViewCB.java
+++ b/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferViewCB.java
@@ -32,8 +32,8 @@ import io.bitsquare.gui.main.help.Help;
import io.bitsquare.gui.main.help.HelpId;
import io.bitsquare.gui.util.ImageUtil;
import io.bitsquare.locale.BSResources;
-import io.bitsquare.trade.Direction;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Direction;
+import io.bitsquare.offer.Offer;
import org.bitcoinj.core.Coin;
diff --git a/src/main/java/io/bitsquare/gui/util/BSFormatter.java b/src/main/java/io/bitsquare/gui/util/BSFormatter.java
index 5d04eb8d4f..b39c366086 100644
--- a/src/main/java/io/bitsquare/gui/util/BSFormatter.java
+++ b/src/main/java/io/bitsquare/gui/util/BSFormatter.java
@@ -20,8 +20,8 @@ package io.bitsquare.gui.util;
import io.bitsquare.arbitrator.Arbitrator;
import io.bitsquare.locale.BSResources;
import io.bitsquare.locale.Country;
-import io.bitsquare.trade.Direction;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Direction;
+import io.bitsquare.offer.Offer;
import io.bitsquare.user.User;
import org.bitcoinj.core.Coin;
diff --git a/src/main/java/io/bitsquare/gui/util/ImageUtil.java b/src/main/java/io/bitsquare/gui/util/ImageUtil.java
index ddbc0b5111..390331ce39 100644
--- a/src/main/java/io/bitsquare/gui/util/ImageUtil.java
+++ b/src/main/java/io/bitsquare/gui/util/ImageUtil.java
@@ -30,11 +30,6 @@ import org.slf4j.LoggerFactory;
public class ImageUtil {
private static final Logger log = LoggerFactory.getLogger(ImageUtil.class);
- // System tray use AWT and there is no CSS support for loading retina supported images
- public static final String SYS_TRAY = "/images/system_tray_icon.png";
- public static final String SYS_TRAY_HI_RES = "/images/system_tray_icon@2x.png";
-
-
public static final String REMOVE_ICON = "image-remove";
public static final String EXPAND = "image-expand";
public static final String COLLAPSE = "image-collapse";
diff --git a/src/main/java/io/bitsquare/gui/util/Profiler.java b/src/main/java/io/bitsquare/gui/util/Profiler.java
index 3ee6ddd5a2..561b3139a4 100644
--- a/src/main/java/io/bitsquare/gui/util/Profiler.java
+++ b/src/main/java/io/bitsquare/gui/util/Profiler.java
@@ -22,7 +22,6 @@ import com.google.common.base.Stopwatch;
import java.util.concurrent.TimeUnit;
import javafx.animation.AnimationTimer;
-import javafx.scene.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,14 +55,4 @@ public class Profiler {
};
fpsTimer.start();
}
-
- public static void initScene(Scene scene) {
- /* PerformanceTracker tracker = PerformanceTracker.getSceneTracker(scene);
- Timeline timeline = new Timeline(
- new KeyFrame(Duration.seconds(1), t -> {
- log.trace("FPS (tracker.getAverageFPS) = " + tracker.getAverageFPS());
- }));
- timeline.setCycleCount(Timeline.INDEFINITE);
- timeline.play();*/
- }
}
diff --git a/src/main/java/io/bitsquare/msg/BootstrappedPeerFactory.java b/src/main/java/io/bitsquare/msg/BootstrappedPeerFactory.java
index 9e15f4c5e1..0a3481fba0 100644
--- a/src/main/java/io/bitsquare/msg/BootstrappedPeerFactory.java
+++ b/src/main/java/io/bitsquare/msg/BootstrappedPeerFactory.java
@@ -17,6 +17,7 @@
package io.bitsquare.msg;
+import io.bitsquare.network.Node;
import io.bitsquare.persistence.Persistence;
import com.google.common.util.concurrent.ListenableFuture;
@@ -62,8 +63,6 @@ import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static io.bitsquare.msg.SeedNodeAddress.StaticSeedNodeAddresses;
-
/**
* Creates a DHT peer and bootstrap to the network via a seed node
*/
@@ -73,7 +72,7 @@ public class BootstrappedPeerFactory {
private KeyPair keyPair;
private Storage storage;
- private final SeedNodeAddress seedNodeAddress;
+ private final Node bootstrapNode;
private final Persistence persistence;
private final SettableFuture settableFuture = SettableFuture.create();
@@ -85,10 +84,9 @@ public class BootstrappedPeerFactory {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
- public BootstrappedPeerFactory(Persistence persistence,
- @Named("defaultSeedNode") StaticSeedNodeAddresses defaultStaticSeedNodeAddresses) {
+ public BootstrappedPeerFactory(Persistence persistence, @Named("bootstrapNode") Node bootstrapNode) {
this.persistence = persistence;
- this.seedNodeAddress = new SeedNodeAddress(defaultStaticSeedNodeAddresses);
+ this.bootstrapNode = bootstrapNode;
}
@@ -303,10 +301,10 @@ public class BootstrappedPeerFactory {
private PeerAddress getBootstrapAddress() {
try {
- return new PeerAddress(Number160.createHash(seedNodeAddress.getId()),
- InetAddress.getByName(seedNodeAddress.getIp()),
- seedNodeAddress.getPort(),
- seedNodeAddress.getPort());
+ return new PeerAddress(Number160.createHash(bootstrapNode.getId()),
+ InetAddress.getByName(bootstrapNode.getIp()),
+ bootstrapNode.getPort(),
+ bootstrapNode.getPort());
} catch (UnknownHostException e) {
log.error("getBootstrapAddress failed: " + e.getMessage());
return null;
diff --git a/src/main/java/io/bitsquare/msg/DHTSeedService.java b/src/main/java/io/bitsquare/msg/DHTSeedService.java
index ab4912cf36..a2dc92aa38 100644
--- a/src/main/java/io/bitsquare/msg/DHTSeedService.java
+++ b/src/main/java/io/bitsquare/msg/DHTSeedService.java
@@ -22,17 +22,12 @@ import io.bitsquare.msg.actor.command.InitializePeer;
import com.google.inject.Inject;
-import java.util.List;
-
import net.tomp2p.peers.Number160;
import akka.actor.ActorSystem;
public class DHTSeedService extends ActorService {
- private static final List staticSedNodeAddresses = SeedNodeAddress
- .StaticSeedNodeAddresses.getAllSeedNodeAddresses();
-
@Inject
public DHTSeedService(ActorSystem system) {
super(system, "/user/" + DHTManager.SEED_NAME);
diff --git a/src/main/java/io/bitsquare/msg/DefaultMessageModule.java b/src/main/java/io/bitsquare/msg/DefaultMessageModule.java
index 758e6a4677..bacba0cd7d 100644
--- a/src/main/java/io/bitsquare/msg/DefaultMessageModule.java
+++ b/src/main/java/io/bitsquare/msg/DefaultMessageModule.java
@@ -17,8 +17,11 @@
package io.bitsquare.msg;
-import io.bitsquare.di.AbstractBitsquareModule;
+import io.bitsquare.AbstractBitsquareModule;
+import io.bitsquare.network.BootstrapNode;
+import io.bitsquare.network.Node;
+import com.google.inject.Injector;
import com.google.inject.name.Names;
import java.util.Properties;
@@ -39,8 +42,13 @@ public class DefaultMessageModule extends AbstractBitsquareModule implements Mes
// we will probably later use disk storage instead of memory storage for TomP2P
bind(Boolean.class).annotatedWith(Names.named("useDiskStorage")).toInstance(false);
- bind(SeedNodeAddress.StaticSeedNodeAddresses.class)
- .annotatedWith(Names.named("defaultSeedNode"))
- .toInstance(SeedNodeAddress.StaticSeedNodeAddresses.DIGITAL_OCEAN1);
+ bind(Node.class)
+ .annotatedWith(Names.named("bootstrapNode"))
+ .toInstance(BootstrapNode.DIGITAL_OCEAN1);
+ }
+
+ @Override
+ public void doClose(Injector injector) {
+ injector.getInstance(MessageFacade.class).shutDown();
}
}
diff --git a/src/main/java/io/bitsquare/msg/Message.java b/src/main/java/io/bitsquare/msg/Message.java
new file mode 100644
index 0000000000..c3dff80f2e
--- /dev/null
+++ b/src/main/java/io/bitsquare/msg/Message.java
@@ -0,0 +1,21 @@
+/*
+ * 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.msg;
+
+public interface Message {
+}
diff --git a/src/main/java/io/bitsquare/msg/MessageFacade.java b/src/main/java/io/bitsquare/msg/MessageFacade.java
index 80a9cc7b25..f6d6de4c7a 100644
--- a/src/main/java/io/bitsquare/msg/MessageFacade.java
+++ b/src/main/java/io/bitsquare/msg/MessageFacade.java
@@ -22,12 +22,11 @@ import io.bitsquare.msg.listeners.AddOfferListener;
import io.bitsquare.msg.listeners.ArbitratorListener;
import io.bitsquare.msg.listeners.BootstrapListener;
import io.bitsquare.msg.listeners.GetPeerAddressListener;
-import io.bitsquare.msg.listeners.IncomingTradeMessageListener;
+import io.bitsquare.msg.listeners.IncomingMessageListener;
import io.bitsquare.msg.listeners.OfferBookListener;
-import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
+import io.bitsquare.msg.listeners.OutgoingMessageListener;
import io.bitsquare.network.Peer;
-import io.bitsquare.trade.Offer;
-import io.bitsquare.trade.protocol.trade.TradeMessage;
+import io.bitsquare.offer.Offer;
import java.security.PublicKey;
@@ -37,15 +36,15 @@ import javafx.beans.property.LongProperty;
public interface MessageFacade extends MessageBroker {
- void sendTradeMessage(Peer peer, TradeMessage tradeMessage, OutgoingTradeMessageListener listener);
+ void sendMessage(Peer peer, Message message, OutgoingMessageListener listener);
void shutDown();
void addArbitrator(Arbitrator arbitrator);
- void addIncomingTradeMessageListener(IncomingTradeMessageListener listener);
+ void addIncomingMessageListener(IncomingMessageListener listener);
- void removeIncomingTradeMessageListener(IncomingTradeMessageListener listener);
+ void removeIncomingMessageListener(IncomingMessageListener listener);
void addOffer(Offer offer, AddOfferListener addOfferListener);
diff --git a/src/main/java/io/bitsquare/msg/NoopMessageFacade.java b/src/main/java/io/bitsquare/msg/NoopMessageFacade.java
deleted file mode 100644
index 79c932f29f..0000000000
--- a/src/main/java/io/bitsquare/msg/NoopMessageFacade.java
+++ /dev/null
@@ -1,168 +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.msg;
-
-import io.bitsquare.arbitrator.Arbitrator;
-import io.bitsquare.msg.listeners.AddOfferListener;
-import io.bitsquare.msg.listeners.ArbitratorListener;
-import io.bitsquare.msg.listeners.BootstrapListener;
-import io.bitsquare.msg.listeners.GetPeerAddressListener;
-import io.bitsquare.msg.listeners.IncomingTradeMessageListener;
-import io.bitsquare.msg.listeners.OfferBookListener;
-import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
-import io.bitsquare.network.Peer;
-import io.bitsquare.trade.Offer;
-import io.bitsquare.trade.protocol.trade.TradeMessage;
-import io.bitsquare.user.User;
-
-import com.google.common.util.concurrent.FutureCallback;
-
-import java.security.PublicKey;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-import javax.inject.Inject;
-
-import javafx.application.Platform;
-import javafx.beans.property.LongProperty;
-import javafx.beans.property.SimpleLongProperty;
-
-import net.tomp2p.dht.PeerDHT;
-
-public class NoopMessageFacade implements MessageFacade {
-
- private final List incomingTradeMessageListeners = new ArrayList<>();
- private final List offerBookListeners = new ArrayList<>();
- private final LongProperty invalidationTimestamp = new SimpleLongProperty(0);
- private final P2PNode p2pNode;
- private final User user;
-
- @Inject
- public NoopMessageFacade(User user, P2PNode p2pNode) {
- this.user = user;
- this.p2pNode = p2pNode;
- }
-
- @Override
- public void sendTradeMessage(Peer peer, TradeMessage tradeMessage, OutgoingTradeMessageListener listener) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void shutDown() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void addArbitrator(Arbitrator arbitrator) {
- //throw new UnsupportedOperationException();
- }
-
- @Override
- public void addIncomingTradeMessageListener(IncomingTradeMessageListener listener) {
- incomingTradeMessageListeners.add(listener);
- }
-
- @Override
- public void removeIncomingTradeMessageListener(IncomingTradeMessageListener listener) {
- incomingTradeMessageListeners.remove(listener);
- }
-
- @Override
- public void addOffer(Offer offer, AddOfferListener addOfferListener) {
- //throw new UnsupportedOperationException();
- }
-
- @Override
- public void addArbitratorListener(ArbitratorListener listener) {
- throw new UnsupportedOperationException();
-
- }
-
- @Override
- public void getArbitrators(Locale defaultLanguageLocale) {
- throw new UnsupportedOperationException();
-
- }
-
- @Override
- public LongProperty invalidationTimestampProperty() {
- return invalidationTimestamp;
- }
-
- @Override
- public void addOfferBookListener(OfferBookListener offerBookListener) {
- offerBookListeners.add(offerBookListener);
- }
-
- @Override
- public void removeOfferBookListener(OfferBookListener offerBookListener) {
- offerBookListeners.remove(offerBookListener);
- }
-
- @Override
- public void requestInvalidationTimeStampFromDHT(String fiatCode) {
- //throw new UnsupportedOperationException();
-
- }
-
- @Override
- public void getOffers(String fiatCode) {
- //throw new UnsupportedOperationException();
-
- }
-
- @Override
- public void removeOffer(Offer offer) {
- //throw new UnsupportedOperationException();
-
- }
-
- @Override
- public void init(int clientPort, BootstrapListener bootstrapListener) {
- //System.out.println("DummyMessageFacade.init");
- //throw new UnsupportedOperationException();
-
- p2pNode.setMessageBroker(this);
- p2pNode.setKeyPair(user.getMessageKeyPair());
-
- p2pNode.start(clientPort, new FutureCallback() {
- @Override
- public void onSuccess(PeerDHT result) {
- Platform.runLater(bootstrapListener::onCompleted);
- }
-
- @Override
- public void onFailure(Throwable t) {
- Platform.runLater(() -> bootstrapListener.onFailed(t));
- }
- });
- }
-
- @Override
- public void getPeerAddress(PublicKey messagePublicKey, GetPeerAddressListener getPeerAddressListener) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void handleMessage(Object message, Peer sender) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/src/main/java/io/bitsquare/msg/SeedNodeAddress.java b/src/main/java/io/bitsquare/msg/SeedNodeAddress.java
deleted file mode 100644
index eb971973b5..0000000000
--- a/src/main/java/io/bitsquare/msg/SeedNodeAddress.java
+++ /dev/null
@@ -1,91 +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.msg;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-// TODO Might be better with a config file
-public class SeedNodeAddress {
- private final String id;
- private final String ip;
- private final int port;
-
- public SeedNodeAddress(StaticSeedNodeAddresses staticSeedNodeAddresses) {
- this(staticSeedNodeAddresses.getId(), staticSeedNodeAddresses.getIp(), staticSeedNodeAddresses.getPort());
- }
-
- public SeedNodeAddress(String id, String ip, int port) {
- this.id = id;
- this.ip = ip;
- this.port = port;
- }
-
- public String getId() {
- return id;
- }
-
- public String getIp() {
- return ip;
- }
-
- public int getPort() {
- return port;
- }
-
-
- ///////////////////////////////////////////////////////////////////////////////////////////
- // Enum
- ///////////////////////////////////////////////////////////////////////////////////////////
-
- public enum StaticSeedNodeAddresses {
- // Manfreds server: "188.226.179.109"
- // Steves server: "128.199.251.106"
- DIGITAL_OCEAN1("digitalocean1.bitsquare.io", "188.226.179.109", 5000),
- LOCALHOST("localhost", "127.0.0.1", 5000);
- // DIGITAL_OCEAN2("digitalocean2.bitsquare.io", "128.199.251.106", 5000);
- //LOCALHOST("localhost", "127.0.0.1", 5000);
-
- private final String id;
- private final String ip;
- private final int port;
-
- StaticSeedNodeAddresses(String id, String ip, int port) {
- this.id = id;
- this.ip = ip;
- this.port = port;
- }
-
- public static List getAllSeedNodeAddresses() {
- return new ArrayList<>(Arrays.asList(StaticSeedNodeAddresses.values()));
- }
-
- public String getId() {
- return id;
- }
-
- public String getIp() {
- return ip;
- }
-
- public int getPort() {
- return port;
- }
- }
-}
diff --git a/src/main/java/io/bitsquare/msg/TomP2PMessageFacade.java b/src/main/java/io/bitsquare/msg/TomP2PMessageFacade.java
index 7ef5af737b..b974144bf6 100644
--- a/src/main/java/io/bitsquare/msg/TomP2PMessageFacade.java
+++ b/src/main/java/io/bitsquare/msg/TomP2PMessageFacade.java
@@ -22,13 +22,12 @@ import io.bitsquare.msg.listeners.AddOfferListener;
import io.bitsquare.msg.listeners.ArbitratorListener;
import io.bitsquare.msg.listeners.BootstrapListener;
import io.bitsquare.msg.listeners.GetPeerAddressListener;
-import io.bitsquare.msg.listeners.IncomingTradeMessageListener;
+import io.bitsquare.msg.listeners.IncomingMessageListener;
import io.bitsquare.msg.listeners.OfferBookListener;
-import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
+import io.bitsquare.msg.listeners.OutgoingMessageListener;
import io.bitsquare.network.Peer;
import io.bitsquare.network.tomp2p.TomP2PPeer;
-import io.bitsquare.trade.Offer;
-import io.bitsquare.trade.protocol.trade.TradeMessage;
+import io.bitsquare.offer.Offer;
import io.bitsquare.user.User;
import com.google.common.util.concurrent.FutureCallback;
@@ -85,7 +84,7 @@ class TomP2PMessageFacade implements MessageFacade {
private final List offerBookListeners = new ArrayList<>();
private final List arbitratorListeners = new ArrayList<>();
- private final List incomingTradeMessageListeners = new ArrayList<>();
+ private final List incomingMessageListeners = new ArrayList<>();
private final LongProperty invalidationTimestamp = new SimpleLongProperty(0);
@@ -317,12 +316,12 @@ class TomP2PMessageFacade implements MessageFacade {
// Trade process
///////////////////////////////////////////////////////////////////////////////////////////
- public void sendTradeMessage(Peer peer, TradeMessage tradeMessage,
- OutgoingTradeMessageListener listener) {
+ public void sendMessage(Peer peer, Message message,
+ OutgoingMessageListener listener) {
if (!(peer instanceof TomP2PPeer)) {
throw new IllegalArgumentException("peer must be of type TomP2PPeer") ;
}
- FutureDirect futureDirect = p2pNode.sendData(((TomP2PPeer)peer).getPeerAddress(), tradeMessage);
+ FutureDirect futureDirect = p2pNode.sendData(((TomP2PPeer)peer).getPeerAddress(), message);
futureDirect.addListener(new BaseFutureListener() {
@Override
public void operationComplete(BaseFuture future) throws Exception {
@@ -469,12 +468,12 @@ class TomP2PMessageFacade implements MessageFacade {
arbitratorListeners.remove(listener);
}
- public void addIncomingTradeMessageListener(IncomingTradeMessageListener listener) {
- incomingTradeMessageListeners.add(listener);
+ public void addIncomingMessageListener(IncomingMessageListener listener) {
+ incomingMessageListeners.add(listener);
}
- public void removeIncomingTradeMessageListener(IncomingTradeMessageListener listener) {
- incomingTradeMessageListeners.remove(listener);
+ public void removeIncomingMessageListener(IncomingMessageListener listener) {
+ incomingMessageListeners.remove(listener);
}
@@ -565,9 +564,9 @@ class TomP2PMessageFacade implements MessageFacade {
@Override
public void handleMessage(Object message, Peer sender) {
- if (message instanceof TradeMessage) {
- Platform.runLater(() -> incomingTradeMessageListeners.stream().forEach(e ->
- e.onMessage((TradeMessage) message, sender)));
+ if (message instanceof Message) {
+ Platform.runLater(() -> incomingMessageListeners.stream().forEach(e ->
+ e.onMessage((Message) message, sender)));
}
}
}
diff --git a/src/main/java/io/bitsquare/msg/listeners/IncomingTradeMessageListener.java b/src/main/java/io/bitsquare/msg/listeners/IncomingMessageListener.java
similarity index 82%
rename from src/main/java/io/bitsquare/msg/listeners/IncomingTradeMessageListener.java
rename to src/main/java/io/bitsquare/msg/listeners/IncomingMessageListener.java
index 0b2adba3ae..25bc85f927 100644
--- a/src/main/java/io/bitsquare/msg/listeners/IncomingTradeMessageListener.java
+++ b/src/main/java/io/bitsquare/msg/listeners/IncomingMessageListener.java
@@ -17,9 +17,9 @@
package io.bitsquare.msg.listeners;
+import io.bitsquare.msg.Message;
import io.bitsquare.network.Peer;
-import io.bitsquare.trade.protocol.trade.TradeMessage;
-public interface IncomingTradeMessageListener {
- void onMessage(TradeMessage tradeMessage, Peer sender);
+public interface IncomingMessageListener {
+ void onMessage(Message message, Peer sender);
}
diff --git a/src/main/java/io/bitsquare/msg/listeners/OfferBookListener.java b/src/main/java/io/bitsquare/msg/listeners/OfferBookListener.java
index 1b6054fda1..8a6edae6dc 100644
--- a/src/main/java/io/bitsquare/msg/listeners/OfferBookListener.java
+++ b/src/main/java/io/bitsquare/msg/listeners/OfferBookListener.java
@@ -17,7 +17,7 @@
package io.bitsquare.msg.listeners;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Offer;
import java.util.List;
diff --git a/src/main/java/io/bitsquare/msg/listeners/OutgoingTradeMessageListener.java b/src/main/java/io/bitsquare/msg/listeners/OutgoingMessageListener.java
similarity index 94%
rename from src/main/java/io/bitsquare/msg/listeners/OutgoingTradeMessageListener.java
rename to src/main/java/io/bitsquare/msg/listeners/OutgoingMessageListener.java
index 5fbcd3a40a..63d1896141 100644
--- a/src/main/java/io/bitsquare/msg/listeners/OutgoingTradeMessageListener.java
+++ b/src/main/java/io/bitsquare/msg/listeners/OutgoingMessageListener.java
@@ -17,7 +17,7 @@
package io.bitsquare.msg.listeners;
-public interface OutgoingTradeMessageListener {
+public interface OutgoingMessageListener {
void onFailed();
void onResult();
diff --git a/src/test/java/io/bitsquare/gui/main/account/registration/uimock/FundRegistrationWalletControllerUIMock.java b/src/main/java/io/bitsquare/network/BootstrapNode.java
similarity index 57%
rename from src/test/java/io/bitsquare/gui/main/account/registration/uimock/FundRegistrationWalletControllerUIMock.java
rename to src/main/java/io/bitsquare/network/BootstrapNode.java
index ae97379c20..0d8d7daa90 100644
--- a/src/test/java/io/bitsquare/gui/main/account/registration/uimock/FundRegistrationWalletControllerUIMock.java
+++ b/src/main/java/io/bitsquare/network/BootstrapNode.java
@@ -15,25 +15,33 @@
* along with Bitsquare. If not, see .
*/
-package io.bitsquare.gui.main.account.registration.uimock;
+package io.bitsquare.network;
-import java.net.URL;
+public enum BootstrapNode implements Node {
+ DIGITAL_OCEAN1("digitalocean1.bitsquare.io", "188.226.179.109", 5000);
-import java.util.ResourceBundle;
+ private final String id;
+ private final String ip;
+ private final int port;
-import javafx.fxml.Initializable;
-
-public class FundRegistrationWalletControllerUIMock implements Initializable {
-
-
- ///////////////////////////////////////////////////////////////////////////////////////////
- // Lifecycle
- ///////////////////////////////////////////////////////////////////////////////////////////
-
- @Override
- public void initialize(URL url, ResourceBundle rb) {
+ BootstrapNode(String id, String ip, int port) {
+ this.id = id;
+ this.ip = ip;
+ this.port = port;
}
+ @Override
+ public String getId() {
+ return id;
+ }
+ @Override
+ public String getIp() {
+ return ip;
+ }
+
+ @Override
+ public int getPort() {
+ return port;
+ }
}
-
diff --git a/src/main/java/io/bitsquare/di/AbstractBitsquareModule.java b/src/main/java/io/bitsquare/network/Node.java
similarity index 69%
rename from src/main/java/io/bitsquare/di/AbstractBitsquareModule.java
rename to src/main/java/io/bitsquare/network/Node.java
index 74d8f34219..e0f10b3b07 100644
--- a/src/main/java/io/bitsquare/di/AbstractBitsquareModule.java
+++ b/src/main/java/io/bitsquare/network/Node.java
@@ -15,17 +15,15 @@
* along with Bitsquare. If not, see .
*/
-package io.bitsquare.di;
+package io.bitsquare.network;
-import com.google.inject.AbstractModule;
+public interface Node {
-import java.util.Properties;
+ String getId();
-public abstract class AbstractBitsquareModule extends AbstractModule {
+ String getIp();
- protected final Properties properties;
+ int getPort();
- public AbstractBitsquareModule(Properties properties) {
- this.properties = properties;
- }
}
+
diff --git a/src/main/java/io/bitsquare/trade/Direction.java b/src/main/java/io/bitsquare/offer/Direction.java
similarity index 96%
rename from src/main/java/io/bitsquare/trade/Direction.java
rename to src/main/java/io/bitsquare/offer/Direction.java
index 82ddb645d5..d7fe57800d 100644
--- a/src/main/java/io/bitsquare/trade/Direction.java
+++ b/src/main/java/io/bitsquare/offer/Direction.java
@@ -15,7 +15,7 @@
* along with Bitsquare. If not, see .
*/
-package io.bitsquare.trade;
+package io.bitsquare.offer;
public enum Direction {
BUY, SELL
diff --git a/src/main/java/io/bitsquare/trade/Offer.java b/src/main/java/io/bitsquare/offer/Offer.java
similarity index 99%
rename from src/main/java/io/bitsquare/trade/Offer.java
rename to src/main/java/io/bitsquare/offer/Offer.java
index d0f3ad33cb..8cfa2940e4 100644
--- a/src/main/java/io/bitsquare/trade/Offer.java
+++ b/src/main/java/io/bitsquare/offer/Offer.java
@@ -15,7 +15,7 @@
* along with Bitsquare. If not, see .
*/
-package io.bitsquare.trade;
+package io.bitsquare.offer;
import io.bitsquare.arbitrator.Arbitrator;
import io.bitsquare.bank.BankAccountType;
diff --git a/src/main/java/io/bitsquare/persistence/Persistence.java b/src/main/java/io/bitsquare/persistence/Persistence.java
index c1dbf20817..c51e75b393 100644
--- a/src/main/java/io/bitsquare/persistence/Persistence.java
+++ b/src/main/java/io/bitsquare/persistence/Persistence.java
@@ -17,7 +17,6 @@
package io.bitsquare.persistence;
-import io.bitsquare.Bitsquare;
import io.bitsquare.util.FileUtil;
import org.bitcoinj.utils.Threading;
@@ -39,6 +38,7 @@ import java.util.concurrent.locks.ReentrantLock;
import javax.annotation.concurrent.GuardedBy;
import javax.inject.Inject;
+import javax.inject.Named;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,19 +52,20 @@ public class Persistence {
private static final Logger log = LoggerFactory.getLogger(Persistence.class);
private static final ReentrantLock lock = Threading.lock("Storage");
- private final String prefix = Bitsquare.getAppName() + "_pref";
- private final File storageFile = FileUtil.getFile(prefix, "ser");
-
@GuardedBy("lock")
private Map rootMap = new HashMap<>();
+ private final String prefix;
+ private final File storageFile;
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
- public Persistence() {
+ public Persistence(@Named("appName") String appName) {
+ this.prefix = appName + "_pref";
+ this.storageFile = FileUtil.getFile(prefix, "ser");
}
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/io/bitsquare/trade/Contract.java b/src/main/java/io/bitsquare/trade/Contract.java
index 4b389c2211..e42891ce17 100644
--- a/src/main/java/io/bitsquare/trade/Contract.java
+++ b/src/main/java/io/bitsquare/trade/Contract.java
@@ -18,6 +18,7 @@
package io.bitsquare.trade;
import io.bitsquare.bank.BankAccount;
+import io.bitsquare.offer.Offer;
import io.bitsquare.util.DSAKeyUtil;
import org.bitcoinj.core.Coin;
diff --git a/src/main/java/io/bitsquare/trade/Trade.java b/src/main/java/io/bitsquare/trade/Trade.java
index 0b5c3e9e84..719512357d 100644
--- a/src/main/java/io/bitsquare/trade/Trade.java
+++ b/src/main/java/io/bitsquare/trade/Trade.java
@@ -17,6 +17,8 @@
package io.bitsquare.trade;
+import io.bitsquare.offer.Offer;
+
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.Transaction;
import org.bitcoinj.utils.Fiat;
diff --git a/src/main/java/io/bitsquare/trade/TradeManager.java b/src/main/java/io/bitsquare/trade/TradeManager.java
index 637b80bb54..7956036edb 100644
--- a/src/main/java/io/bitsquare/trade/TradeManager.java
+++ b/src/main/java/io/bitsquare/trade/TradeManager.java
@@ -20,8 +20,11 @@ package io.bitsquare.trade;
import io.bitsquare.btc.BlockChainFacade;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.crypto.CryptoFacade;
+import io.bitsquare.msg.Message;
import io.bitsquare.msg.MessageFacade;
import io.bitsquare.network.Peer;
+import io.bitsquare.offer.Direction;
+import io.bitsquare.offer.Offer;
import io.bitsquare.persistence.Persistence;
import io.bitsquare.settings.Settings;
import io.bitsquare.trade.handlers.ErrorMessageHandler;
@@ -120,7 +123,7 @@ public class TradeManager {
closedTrades.putAll((Map) closedTradesObject);
}
- messageFacade.addIncomingTradeMessageListener(this::onIncomingTradeMessage);
+ messageFacade.addIncomingMessageListener(this::onIncomingTradeMessage);
}
@@ -129,7 +132,7 @@ public class TradeManager {
///////////////////////////////////////////////////////////////////////////////////////////
public void cleanup() {
- messageFacade.removeIncomingTradeMessageListener(this::onIncomingTradeMessage);
+ messageFacade.removeIncomingMessageListener(this::onIncomingTradeMessage);
}
@@ -411,8 +414,11 @@ public class TradeManager {
///////////////////////////////////////////////////////////////////////////////////////////
// Routes the incoming messages to the responsible protocol
- private void onIncomingTradeMessage(TradeMessage tradeMessage, Peer sender) {
- // log.trace("processTradingMessage TradeId " + tradeMessage.getTradeId());
+ private void onIncomingTradeMessage(Message message, Peer sender) {
+ if (!(message instanceof TradeMessage))
+ throw new IllegalArgumentException("message must be of type TradeMessage");
+ TradeMessage tradeMessage = (TradeMessage) message;
+
log.trace("onIncomingTradeMessage instance " + tradeMessage.getClass().getSimpleName());
log.trace("onIncomingTradeMessage sender " + sender);
diff --git a/src/main/java/io/bitsquare/trade/TradeModule.java b/src/main/java/io/bitsquare/trade/TradeModule.java
index 6290a39fba..3ccd4fc18c 100644
--- a/src/main/java/io/bitsquare/trade/TradeModule.java
+++ b/src/main/java/io/bitsquare/trade/TradeModule.java
@@ -17,7 +17,7 @@
package io.bitsquare.trade;
-import io.bitsquare.di.AbstractBitsquareModule;
+import io.bitsquare.AbstractBitsquareModule;
import java.util.Properties;
diff --git a/src/main/java/io/bitsquare/trade/protocol/createoffer/CreateOfferCoordinator.java b/src/main/java/io/bitsquare/trade/protocol/createoffer/CreateOfferCoordinator.java
index f47f2be6b5..4e17d6d897 100644
--- a/src/main/java/io/bitsquare/trade/protocol/createoffer/CreateOfferCoordinator.java
+++ b/src/main/java/io/bitsquare/trade/protocol/createoffer/CreateOfferCoordinator.java
@@ -19,8 +19,8 @@ package io.bitsquare.trade.protocol.createoffer;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.msg.MessageFacade;
+import io.bitsquare.offer.Offer;
import io.bitsquare.persistence.Persistence;
-import io.bitsquare.trade.Offer;
import io.bitsquare.trade.handlers.FaultHandler;
import io.bitsquare.trade.handlers.TransactionResultHandler;
import io.bitsquare.trade.protocol.createoffer.tasks.BroadCastOfferFeeTx;
diff --git a/src/main/java/io/bitsquare/trade/protocol/createoffer/tasks/PublishOfferToDHT.java b/src/main/java/io/bitsquare/trade/protocol/createoffer/tasks/PublishOfferToDHT.java
index 75d4a0af5a..d5611bd519 100644
--- a/src/main/java/io/bitsquare/trade/protocol/createoffer/tasks/PublishOfferToDHT.java
+++ b/src/main/java/io/bitsquare/trade/protocol/createoffer/tasks/PublishOfferToDHT.java
@@ -19,7 +19,7 @@ package io.bitsquare.trade.protocol.createoffer.tasks;
import io.bitsquare.msg.MessageFacade;
import io.bitsquare.msg.listeners.AddOfferListener;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Offer;
import io.bitsquare.trade.handlers.FaultHandler;
import io.bitsquare.trade.handlers.ResultHandler;
diff --git a/src/main/java/io/bitsquare/trade/protocol/createoffer/tasks/VerifyOffer.java b/src/main/java/io/bitsquare/trade/protocol/createoffer/tasks/VerifyOffer.java
index 45323e40b3..d3857a74bb 100644
--- a/src/main/java/io/bitsquare/trade/protocol/createoffer/tasks/VerifyOffer.java
+++ b/src/main/java/io/bitsquare/trade/protocol/createoffer/tasks/VerifyOffer.java
@@ -18,7 +18,7 @@
package io.bitsquare.trade.protocol.createoffer.tasks;
import io.bitsquare.btc.Restrictions;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Offer;
import io.bitsquare.trade.handlers.FaultHandler;
import io.bitsquare.trade.handlers.ResultHandler;
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/TradeMessage.java b/src/main/java/io/bitsquare/trade/protocol/trade/TradeMessage.java
index 141b95bb9f..ca8a239b4e 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/TradeMessage.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/TradeMessage.java
@@ -17,6 +17,8 @@
package io.bitsquare.trade.protocol.trade;
-public interface TradeMessage {
+import io.bitsquare.msg.Message;
+
+public interface TradeMessage extends Message {
public String getTradeId();
}
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/BuyerAcceptsOfferProtocol.java b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/BuyerAcceptsOfferProtocol.java
index 7e5b5c606b..a23a004cae 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/BuyerAcceptsOfferProtocol.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/BuyerAcceptsOfferProtocol.java
@@ -24,8 +24,8 @@ import io.bitsquare.btc.WalletFacade;
import io.bitsquare.crypto.CryptoFacade;
import io.bitsquare.msg.MessageFacade;
import io.bitsquare.network.Peer;
+import io.bitsquare.offer.Offer;
import io.bitsquare.trade.Contract;
-import io.bitsquare.trade.Offer;
import io.bitsquare.trade.Trade;
import io.bitsquare.trade.protocol.trade.offerer.tasks.CreateDepositTx;
import io.bitsquare.trade.protocol.trade.offerer.tasks.HandleTakeOfferRequest;
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/BuyerAcceptsOfferProtocolListener.java b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/BuyerAcceptsOfferProtocolListener.java
index 610600de2d..d9ab268099 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/BuyerAcceptsOfferProtocolListener.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/BuyerAcceptsOfferProtocolListener.java
@@ -17,7 +17,7 @@
package io.bitsquare.trade.protocol.trade.offerer;
-import io.bitsquare.trade.Offer;
+import io.bitsquare.offer.Offer;
import org.bitcoinj.core.Transaction;
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/HandleTakeOfferRequest.java b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/HandleTakeOfferRequest.java
index e4bfe736dd..02147d4e82 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/HandleTakeOfferRequest.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/HandleTakeOfferRequest.java
@@ -18,7 +18,7 @@
package io.bitsquare.trade.protocol.trade.offerer.tasks;
import io.bitsquare.msg.MessageFacade;
-import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
+import io.bitsquare.msg.listeners.OutgoingMessageListener;
import io.bitsquare.network.Peer;
import io.bitsquare.trade.Trade;
import io.bitsquare.trade.handlers.ExceptionHandler;
@@ -39,7 +39,7 @@ public class HandleTakeOfferRequest {
}
RespondToTakeOfferRequestMessage tradeMessage =
new RespondToTakeOfferRequestMessage(tradeId, takeOfferRequestAccepted);
- messageFacade.sendTradeMessage(peer, tradeMessage, new OutgoingTradeMessageListener() {
+ messageFacade.sendMessage(peer, tradeMessage, new OutgoingMessageListener() {
@Override
public void onResult() {
log.trace("RespondToTakeOfferRequestMessage successfully arrived at peer");
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/RequestTakerDepositPayment.java b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/RequestTakerDepositPayment.java
index b28dba756b..ac34b12810 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/RequestTakerDepositPayment.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/RequestTakerDepositPayment.java
@@ -19,7 +19,7 @@ package io.bitsquare.trade.protocol.trade.offerer.tasks;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.msg.MessageFacade;
-import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
+import io.bitsquare.msg.listeners.OutgoingMessageListener;
import io.bitsquare.network.Peer;
import io.bitsquare.trade.handlers.ExceptionHandler;
import io.bitsquare.trade.handlers.ResultHandler;
@@ -44,7 +44,7 @@ public class RequestTakerDepositPayment {
log.trace("Run task");
RequestTakerDepositPaymentMessage tradeMessage = new RequestTakerDepositPaymentMessage(
tradeId, bankAccount, accountId, offererPubKey, preparedOffererDepositTxAsHex, offererTxOutIndex);
- messageFacade.sendTradeMessage(peer, tradeMessage, new OutgoingTradeMessageListener() {
+ messageFacade.sendMessage(peer, tradeMessage, new OutgoingMessageListener() {
@Override
public void onResult() {
log.trace("RequestTakerDepositPaymentMessage successfully arrived at peer");
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/SendDepositTxIdToTaker.java b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/SendDepositTxIdToTaker.java
index e1b44701fb..74287b44b9 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/SendDepositTxIdToTaker.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/SendDepositTxIdToTaker.java
@@ -18,7 +18,7 @@
package io.bitsquare.trade.protocol.trade.offerer.tasks;
import io.bitsquare.msg.MessageFacade;
-import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
+import io.bitsquare.msg.listeners.OutgoingMessageListener;
import io.bitsquare.network.Peer;
import io.bitsquare.trade.handlers.ExceptionHandler;
import io.bitsquare.trade.handlers.ResultHandler;
@@ -39,7 +39,7 @@ public class SendDepositTxIdToTaker {
DepositTxPublishedMessage tradeMessage =
new DepositTxPublishedMessage(tradeId, Utils.HEX.encode(depositTransaction.bitcoinSerialize()));
- messageFacade.sendTradeMessage(peer, tradeMessage, new OutgoingTradeMessageListener() {
+ messageFacade.sendMessage(peer, tradeMessage, new OutgoingMessageListener() {
@Override
public void onResult() {
log.trace("DepositTxPublishedMessage successfully arrived at peer");
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/SendSignedPayoutTx.java b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/SendSignedPayoutTx.java
index 53421a1c4f..3000aa8b95 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/SendSignedPayoutTx.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/SendSignedPayoutTx.java
@@ -19,7 +19,7 @@ package io.bitsquare.trade.protocol.trade.offerer.tasks;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.msg.MessageFacade;
-import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
+import io.bitsquare.msg.listeners.OutgoingMessageListener;
import io.bitsquare.network.Peer;
import io.bitsquare.trade.handlers.ExceptionHandler;
import io.bitsquare.trade.handlers.ResultHandler;
@@ -68,7 +68,7 @@ public class SendSignedPayoutTx {
takerPaybackAmount,
offererPayoutAddress);
- messageFacade.sendTradeMessage(peer, tradeMessage, new OutgoingTradeMessageListener() {
+ messageFacade.sendMessage(peer, tradeMessage, new OutgoingMessageListener() {
@Override
public void onResult() {
log.trace("BankTransferInitedMessage successfully arrived at peer");
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/VerifyAndSignContract.java b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/VerifyAndSignContract.java
index 7caaa5d2e8..a8afea8c00 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/VerifyAndSignContract.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/offerer/tasks/VerifyAndSignContract.java
@@ -19,8 +19,8 @@ package io.bitsquare.trade.protocol.trade.offerer.tasks;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.crypto.CryptoFacade;
+import io.bitsquare.offer.Offer;
import io.bitsquare.trade.Contract;
-import io.bitsquare.trade.Offer;
import io.bitsquare.trade.handlers.ExceptionHandler;
import io.bitsquare.util.Utilities;
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/taker/SellerTakesOfferProtocol.java b/src/main/java/io/bitsquare/trade/protocol/trade/taker/SellerTakesOfferProtocol.java
index d29cfc46d2..431cf2415a 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/taker/SellerTakesOfferProtocol.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/taker/SellerTakesOfferProtocol.java
@@ -23,8 +23,8 @@ import io.bitsquare.btc.WalletFacade;
import io.bitsquare.crypto.CryptoFacade;
import io.bitsquare.msg.MessageFacade;
import io.bitsquare.network.Peer;
+import io.bitsquare.offer.Offer;
import io.bitsquare.trade.Contract;
-import io.bitsquare.trade.Offer;
import io.bitsquare.trade.Trade;
import io.bitsquare.trade.protocol.trade.offerer.messages.BankTransferInitedMessage;
import io.bitsquare.trade.protocol.trade.offerer.messages.DepositTxPublishedMessage;
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/CreateAndSignContract.java b/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/CreateAndSignContract.java
index 54195001a4..ea634dfa75 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/CreateAndSignContract.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/CreateAndSignContract.java
@@ -19,8 +19,8 @@ package io.bitsquare.trade.protocol.trade.taker.tasks;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.crypto.CryptoFacade;
+import io.bitsquare.offer.Offer;
import io.bitsquare.trade.Contract;
-import io.bitsquare.trade.Offer;
import io.bitsquare.trade.handlers.ExceptionHandler;
import io.bitsquare.util.Utilities;
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/RequestTakeOffer.java b/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/RequestTakeOffer.java
index 41c1aaf060..412f6ceaf0 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/RequestTakeOffer.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/RequestTakeOffer.java
@@ -18,7 +18,7 @@
package io.bitsquare.trade.protocol.trade.taker.tasks;
import io.bitsquare.msg.MessageFacade;
-import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
+import io.bitsquare.msg.listeners.OutgoingMessageListener;
import io.bitsquare.network.Peer;
import io.bitsquare.trade.handlers.ExceptionHandler;
import io.bitsquare.trade.handlers.ResultHandler;
@@ -33,8 +33,8 @@ public class RequestTakeOffer {
public static void run(ResultHandler resultHandler, ExceptionHandler exceptionHandler, Peer peer,
MessageFacade messageFacade, String tradeId) {
log.trace("Run task");
- messageFacade.sendTradeMessage(peer, new RequestTakeOfferMessage(tradeId),
- new OutgoingTradeMessageListener() {
+ messageFacade.sendMessage(peer, new RequestTakeOfferMessage(tradeId),
+ new OutgoingMessageListener() {
@Override
public void onResult() {
log.trace("RequestTakeOfferMessage successfully arrived at peer");
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/SendPayoutTxToOfferer.java b/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/SendPayoutTxToOfferer.java
index e1480dfa8e..79f120bca1 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/SendPayoutTxToOfferer.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/SendPayoutTxToOfferer.java
@@ -18,7 +18,7 @@
package io.bitsquare.trade.protocol.trade.taker.tasks;
import io.bitsquare.msg.MessageFacade;
-import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
+import io.bitsquare.msg.listeners.OutgoingMessageListener;
import io.bitsquare.network.Peer;
import io.bitsquare.trade.handlers.ExceptionHandler;
import io.bitsquare.trade.handlers.ResultHandler;
@@ -34,7 +34,7 @@ public class SendPayoutTxToOfferer {
MessageFacade messageFacade, String tradeId, String payoutTxAsHex) {
log.trace("Run task");
PayoutTxPublishedMessage tradeMessage = new PayoutTxPublishedMessage(tradeId, payoutTxAsHex);
- messageFacade.sendTradeMessage(peer, tradeMessage, new OutgoingTradeMessageListener() {
+ messageFacade.sendMessage(peer, tradeMessage, new OutgoingMessageListener() {
@Override
public void onResult() {
log.trace("PayoutTxPublishedMessage successfully arrived at peer");
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/SendSignedTakerDepositTxAsHex.java b/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/SendSignedTakerDepositTxAsHex.java
index 493a5bef20..45bf09cfe2 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/SendSignedTakerDepositTxAsHex.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/SendSignedTakerDepositTxAsHex.java
@@ -20,7 +20,7 @@ package io.bitsquare.trade.protocol.trade.taker.tasks;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.msg.MessageFacade;
-import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
+import io.bitsquare.msg.listeners.OutgoingMessageListener;
import io.bitsquare.network.Peer;
import io.bitsquare.trade.handlers.ExceptionHandler;
import io.bitsquare.trade.handlers.ResultHandler;
@@ -68,7 +68,7 @@ public class SendSignedTakerDepositTxAsHex {
walletFacade.getAddressInfoByTradeID(tradeId).getAddressString(),
takerTxOutIndex,
offererTxOutIndex);
- messageFacade.sendTradeMessage(peer, tradeMessage, new OutgoingTradeMessageListener() {
+ messageFacade.sendMessage(peer, tradeMessage, new OutgoingMessageListener() {
@Override
public void onResult() {
log.trace("RequestOffererDepositPublicationMessage successfully arrived at peer");
diff --git a/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/SendTakeOfferFeePayedTxId.java b/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/SendTakeOfferFeePayedTxId.java
index 7e21cf4024..e9366ba9a6 100644
--- a/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/SendTakeOfferFeePayedTxId.java
+++ b/src/main/java/io/bitsquare/trade/protocol/trade/taker/tasks/SendTakeOfferFeePayedTxId.java
@@ -18,7 +18,7 @@
package io.bitsquare.trade.protocol.trade.taker.tasks;
import io.bitsquare.msg.MessageFacade;
-import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
+import io.bitsquare.msg.listeners.OutgoingMessageListener;
import io.bitsquare.network.Peer;
import io.bitsquare.trade.handlers.ExceptionHandler;
import io.bitsquare.trade.handlers.ResultHandler;
@@ -44,7 +44,7 @@ public class SendTakeOfferFeePayedTxId {
TakeOfferFeePayedMessage msg = new TakeOfferFeePayedMessage(tradeId, takeOfferFeeTxId, tradeAmount,
pubKeyForThatTradeAsHex);
- messageFacade.sendTradeMessage(peer, msg, new OutgoingTradeMessageListener() {
+ messageFacade.sendMessage(peer, msg, new OutgoingMessageListener() {
@Override
public void onResult() {
log.trace("TakeOfferFeePayedMessage successfully arrived at peer");
diff --git a/src/test/java/io/bitsquare/BitsquareTestSuite.java b/src/test/java/io/bitsquare/BitsquareTestSuite.java
deleted file mode 100644
index ba5df56737..0000000000
--- a/src/test/java/io/bitsquare/BitsquareTestSuite.java
+++ /dev/null
@@ -1,41 +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;
-
-import io.bitsquare.btc.RestrictionsTest;
-import io.bitsquare.gui.main.trade.createoffer.CreateOfferPMTest;
-import io.bitsquare.gui.util.BSFormatterTest;
-import io.bitsquare.gui.util.validation.BtcValidatorTest;
-import io.bitsquare.gui.util.validation.FiatValidatorTest;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- RestrictionsTest.class,
- /* P2PNodeTest.class,*/
- FiatValidatorTest.class,
- RestrictionsTest.class,
- CreateOfferPMTest.class,
- BSFormatterTest.class,
- BtcValidatorTest.class
-})
-
-public class BitsquareTestSuite {
-}
diff --git a/src/test/java/io/bitsquare/gui/ViewLoaderTest.java b/src/test/java/io/bitsquare/gui/ViewLoaderTest.java
new file mode 100644
index 0000000000..26cd7a32e4
--- /dev/null
+++ b/src/test/java/io/bitsquare/gui/ViewLoaderTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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 io.bitsquare.app.BitsquareModule;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+import javafx.application.Application;
+import javafx.stage.Stage;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ViewLoaderTest {
+
+ public static class TestApp extends Application {
+ static Stage primaryStage;
+ @Override
+ public void start(Stage primaryStage) throws Exception {
+ TestApp.primaryStage = primaryStage;
+ }
+ }
+
+ @BeforeClass
+ public static void initJavaFX() throws InterruptedException {
+ Thread t = new Thread("JavaFX Init Thread") {
+ public void run() {
+ Application.launch(TestApp.class);
+ }
+ };
+ t.setDaemon(true);
+ t.start();
+ while (TestApp.primaryStage == null)
+ Thread.sleep(10);
+ }
+
+
+ @Before
+ public void setUp() {
+ Injector injector = Guice.createInjector(new BitsquareModule(TestApp.primaryStage, "testApp"));
+ ViewLoader.setInjector(injector);
+ }
+
+ @After
+ public void tearDown() {
+ ViewLoader.setInjector(null);
+ }
+
+ @Test(expected = FatalException.class)
+ public void loadingBogusFxmlResourceShouldThrow() {
+ new ViewLoader(() -> "a bogus fxml resource", false).load();
+ }
+
+ @Test
+ public void loadingValidFxmlResourceShouldNotThrow() {
+ new ViewLoader(Navigation.Item.ACCOUNT, false).load();
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/bitsquare/gui/main/account/AccountSettingsUITestRunner.java b/src/test/java/io/bitsquare/gui/main/account/AccountSettingsUITestRunner.java
deleted file mode 100644
index 477daeb5f2..0000000000
--- a/src/test/java/io/bitsquare/gui/main/account/AccountSettingsUITestRunner.java
+++ /dev/null
@@ -1,101 +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.main.account;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class AccountSettingsUITestRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(AccountSettingsUITestRunner.class);
- private Scene scene;
- private Pane view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 630);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/account/AccountSettingsView.fxml"), false);
- try {
- view = loader.load();
- pane.getChildren().setAll(view);
- refreshStylesheets();
- } catch (IOException e) {
- e.printStackTrace();
- e.printStackTrace();
- }
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-}
diff --git a/src/test/java/io/bitsquare/gui/main/account/AccountUITestRunner.java b/src/test/java/io/bitsquare/gui/main/account/AccountUITestRunner.java
deleted file mode 100644
index 3210d702a9..0000000000
--- a/src/test/java/io/bitsquare/gui/main/account/AccountUITestRunner.java
+++ /dev/null
@@ -1,101 +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.main.account;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class AccountUITestRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(AccountUITestRunner.class);
- private Scene scene;
- private Node view;
- private StackPane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 630);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/account/AccountView.fxml"), false);
- try {
- view = loader.load();
- pane.getChildren().setAll(view);
- refreshStylesheets();
- } catch (IOException e) {
- e.printStackTrace();
- e.printStackTrace();
- }
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-}
diff --git a/src/test/java/io/bitsquare/gui/main/account/RegistrationUITestRunner.java b/src/test/java/io/bitsquare/gui/main/account/RegistrationUITestRunner.java
deleted file mode 100644
index 4a99ba1d6b..0000000000
--- a/src/test/java/io/bitsquare/gui/main/account/RegistrationUITestRunner.java
+++ /dev/null
@@ -1,101 +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.main.account;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class RegistrationUITestRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(RegistrationUITestRunner.class);
- private Scene scene;
- private Node view;
- private StackPane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 630);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/account/content/RegistrationView.fxml"), false);
- try {
- view = loader.load();
- pane.getChildren().setAll(view);
- refreshStylesheets();
- } catch (IOException e) {
- e.printStackTrace();
- e.printStackTrace();
- }
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-}
diff --git a/src/test/java/io/bitsquare/gui/main/account/SetupUITestRunner.java b/src/test/java/io/bitsquare/gui/main/account/SetupUITestRunner.java
deleted file mode 100644
index 712684b6b9..0000000000
--- a/src/test/java/io/bitsquare/gui/main/account/SetupUITestRunner.java
+++ /dev/null
@@ -1,101 +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.main.account;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class SetupUITestRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(SetupUITestRunner.class);
- private Scene scene;
- private Pane view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 630);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/account/setup/SetupView.fxml"), false);
- try {
- view = loader.load();
- pane.getChildren().setAll(view);
- refreshStylesheets();
- } catch (IOException e) {
- e.printStackTrace();
- e.printStackTrace();
- }
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-}
diff --git a/src/test/java/io/bitsquare/gui/main/account/registration/uimock/FundRegistrationWalletUIMockRunner.java b/src/test/java/io/bitsquare/gui/main/account/registration/uimock/FundRegistrationWalletUIMockRunner.java
deleted file mode 100644
index 0f9078307d..0000000000
--- a/src/test/java/io/bitsquare/gui/main/account/registration/uimock/FundRegistrationWalletUIMockRunner.java
+++ /dev/null
@@ -1,104 +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.main.account.registration.uimock;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class FundRegistrationWalletUIMockRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(FundRegistrationWalletUIMockRunner.class);
- private Scene scene;
- private Parent view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 650);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/account/registration/uimock/FundRegistrationWalletViewUIMock.fxml"), false);
-
- try {
- view = loader.load();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- pane.getChildren().setAll(view);
- refreshStylesheets();
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/test/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-
-
-}
diff --git a/src/test/java/io/bitsquare/gui/main/account/registration/uimock/FundRegistrationWalletViewUIMock.fxml b/src/test/java/io/bitsquare/gui/main/account/registration/uimock/FundRegistrationWalletViewUIMock.fxml
deleted file mode 100644
index 5d58857483..0000000000
--- a/src/test/java/io/bitsquare/gui/main/account/registration/uimock/FundRegistrationWalletViewUIMock.fxml
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/test/java/io/bitsquare/gui/main/account/registration/uimock/RegistrationControllerUIMock.java b/src/test/java/io/bitsquare/gui/main/account/registration/uimock/RegistrationControllerUIMock.java
deleted file mode 100644
index 8156aa7690..0000000000
--- a/src/test/java/io/bitsquare/gui/main/account/registration/uimock/RegistrationControllerUIMock.java
+++ /dev/null
@@ -1,58 +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.main.account.registration.uimock;
-
-import java.net.URL;
-
-import java.util.ResourceBundle;
-
-import javax.inject.Inject;
-
-import javafx.event.EventHandler;
-import javafx.fxml.Initializable;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RegistrationControllerUIMock implements Initializable {
- private static final Logger log = LoggerFactory.getLogger(RegistrationControllerUIMock.class);
- public HBox prefBox;
- public Pane content;
-
-
- @Inject
- private RegistrationControllerUIMock() {
- }
-
- @Override
- public void initialize(URL url, ResourceBundle rb) {
- prefBox.setOnMouseClicked(new EventHandler() {
- @Override
- public void handle(MouseEvent mouseEvent) {
- content.getChildren().remove(0);
-
- }
- });
-
- }
-
-
-}
-
diff --git a/src/test/java/io/bitsquare/gui/main/account/registration/uimock/RegistrationUIMockRunner.java b/src/test/java/io/bitsquare/gui/main/account/registration/uimock/RegistrationUIMockRunner.java
deleted file mode 100644
index 5ef755eb44..0000000000
--- a/src/test/java/io/bitsquare/gui/main/account/registration/uimock/RegistrationUIMockRunner.java
+++ /dev/null
@@ -1,105 +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.main.account.registration.uimock;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class RegistrationUIMockRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(RegistrationUIMockRunner.class);
- private Scene scene;
- private Parent view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 660);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/account/registration/uimock/RegistrationViewUIMock.fxml"), false);
-
- try {
- view = loader.load();
- } catch (IOException e) {
- log.error(e.getMessage());
- e.printStackTrace();
- }
-
- pane.getChildren().setAll(view);
- refreshStylesheets();
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/test/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-
-
-}
diff --git a/src/test/java/io/bitsquare/gui/main/account/registration/uimock/RegistrationViewUIMock.fxml b/src/test/java/io/bitsquare/gui/main/account/registration/uimock/RegistrationViewUIMock.fxml
deleted file mode 100644
index 37255ce77c..0000000000
--- a/src/test/java/io/bitsquare/gui/main/account/registration/uimock/RegistrationViewUIMock.fxml
+++ /dev/null
@@ -1,197 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/test/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesUIRunner.java b/src/test/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesUIRunner.java
deleted file mode 100644
index 56071edbaf..0000000000
--- a/src/test/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesUIRunner.java
+++ /dev/null
@@ -1,104 +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.main.portfolio.pending;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class PendingTradesUIRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(PendingTradesUIRunner.class);
- private Scene scene;
- private Parent view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 630);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/main/portfolio/pending/PendingTradesView.fxml"), false);
-
- try {
- view = loader.load();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- pane.getChildren().setAll(view);
- refreshStylesheets();
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-
-
-}
diff --git a/src/test/java/io/bitsquare/gui/main/portfolio/pending/uimock/PendingTradesControllerUIMock.java b/src/test/java/io/bitsquare/gui/main/portfolio/pending/uimock/PendingTradesControllerUIMock.java
deleted file mode 100644
index ba8ae977b8..0000000000
--- a/src/test/java/io/bitsquare/gui/main/portfolio/pending/uimock/PendingTradesControllerUIMock.java
+++ /dev/null
@@ -1,87 +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.main.portfolio.pending.uimock;
-
-import io.bitsquare.gui.CachedViewCB;
-import io.bitsquare.gui.components.processbar.ProcessStepBar;
-import io.bitsquare.gui.components.processbar.ProcessStepItem;
-
-import java.net.URL;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ResourceBundle;
-
-import javax.inject.Inject;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PendingTradesControllerUIMock extends CachedViewCB {
- private static final Logger log = LoggerFactory.getLogger(PendingTradesControllerUIMock.class);
- public ProcessStepBar processBar;
-
- ///////////////////////////////////////////////////////////////////////////////////////////
- // Constructor
- ///////////////////////////////////////////////////////////////////////////////////////////
-
- @Inject
- public PendingTradesControllerUIMock() {
- }
-
-
- ///////////////////////////////////////////////////////////////////////////////////////////
- // Lifecycle
- ///////////////////////////////////////////////////////////////////////////////////////////
-
- @Override
- public void initialize(URL url, ResourceBundle rb) {
- super.initialize(url, rb);
-
- List items = new ArrayList<>();
- items.add(new ProcessStepItem("Deposit TX published"));
- items.add(new ProcessStepItem("Waiting for other trader"));
- items.add(new ProcessStepItem("Waiting for payment"));
- items.add(new ProcessStepItem("Payment received"));
- processBar.setProcessStepItems(items);
- // processBar.next();
- }
-
- @Override
- public void deactivate() {
- super.deactivate();
- }
-
- @Override
- public void activate() {
- super.activate();
- }
-
-
- ///////////////////////////////////////////////////////////////////////////////////////////
- // GUI handlers
- ///////////////////////////////////////////////////////////////////////////////////////////
-
-
- ///////////////////////////////////////////////////////////////////////////////////////////
- // Private methods
- ///////////////////////////////////////////////////////////////////////////////////////////
-
-
-}
-
diff --git a/src/test/java/io/bitsquare/gui/main/portfolio/pending/uimock/PendingTradesUIMockRunner.java b/src/test/java/io/bitsquare/gui/main/portfolio/pending/uimock/PendingTradesUIMockRunner.java
deleted file mode 100644
index 6a469b663f..0000000000
--- a/src/test/java/io/bitsquare/gui/main/portfolio/pending/uimock/PendingTradesUIMockRunner.java
+++ /dev/null
@@ -1,104 +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.main.portfolio.pending.uimock;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class PendingTradesUIMockRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(PendingTradesUIMockRunner.class);
- private Scene scene;
- private Parent view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 630);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/main/portfolio/pending/uimock/PendingTradesViewUIMock.fxml"), false);
-
- try {
- view = loader.load();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- pane.getChildren().setAll(view);
- refreshStylesheets();
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/test/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-
-
-}
diff --git a/src/test/java/io/bitsquare/gui/main/portfolio/pending/uimock/PendingTradesViewUIMock.fxml b/src/test/java/io/bitsquare/gui/main/portfolio/pending/uimock/PendingTradesViewUIMock.fxml
deleted file mode 100644
index cd68fe2b3e..0000000000
--- a/src/test/java/io/bitsquare/gui/main/portfolio/pending/uimock/PendingTradesViewUIMock.fxml
+++ /dev/null
@@ -1,99 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/test/java/io/bitsquare/gui/main/settings/FiatAccountUITestRunner.java b/src/test/java/io/bitsquare/gui/main/settings/FiatAccountUITestRunner.java
deleted file mode 100644
index 9323e79adb..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/FiatAccountUITestRunner.java
+++ /dev/null
@@ -1,101 +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.main.settings;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class FiatAccountUITestRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(FiatAccountUITestRunner.class);
- private Scene scene;
- private Pane view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 630);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/account/content/FiatAccountView.fxml"), false);
- try {
- view = loader.load();
- pane.getChildren().setAll(view);
- refreshStylesheets();
- } catch (IOException e) {
- e.printStackTrace();
- e.printStackTrace();
- }
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-}
diff --git a/src/test/java/io/bitsquare/gui/main/settings/PasswordUITestRunner.java b/src/test/java/io/bitsquare/gui/main/settings/PasswordUITestRunner.java
deleted file mode 100644
index b500bf1c8c..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/PasswordUITestRunner.java
+++ /dev/null
@@ -1,101 +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.main.settings;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class PasswordUITestRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(PasswordUITestRunner.class);
- private Scene scene;
- private Pane view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 630);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/account/content/PasswordView.fxml"), false);
- try {
- view = loader.load();
- pane.getChildren().setAll(view);
- refreshStylesheets();
- } catch (IOException e) {
- e.printStackTrace();
- e.printStackTrace();
- }
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-}
diff --git a/src/test/java/io/bitsquare/gui/main/settings/RegistrationUITestRunner.java b/src/test/java/io/bitsquare/gui/main/settings/RegistrationUITestRunner.java
deleted file mode 100644
index 89b7c16336..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/RegistrationUITestRunner.java
+++ /dev/null
@@ -1,101 +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.main.settings;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class RegistrationUITestRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(RegistrationUITestRunner.class);
- private Scene scene;
- private Pane view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 530);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/account/content/RegistrationView.fxml"), false);
- try {
- view = loader.load();
- pane.getChildren().setAll(view);
- refreshStylesheets();
- } catch (IOException e) {
- e.printStackTrace();
- e.printStackTrace();
- }
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-}
diff --git a/src/test/java/io/bitsquare/gui/main/settings/RestrictionsUITestRunner.java b/src/test/java/io/bitsquare/gui/main/settings/RestrictionsUITestRunner.java
deleted file mode 100644
index 1cf27b8206..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/RestrictionsUITestRunner.java
+++ /dev/null
@@ -1,101 +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.main.settings;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class RestrictionsUITestRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(RestrictionsUITestRunner.class);
- private Scene scene;
- private Pane view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 530);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/account/content/RestrictionsView.fxml"), false);
- try {
- view = loader.load();
- pane.getChildren().setAll(view);
- refreshStylesheets();
- } catch (IOException e) {
- e.printStackTrace();
- e.printStackTrace();
- }
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-}
diff --git a/src/test/java/io/bitsquare/gui/main/settings/SeedWordsUITestRunner.java b/src/test/java/io/bitsquare/gui/main/settings/SeedWordsUITestRunner.java
deleted file mode 100644
index ba1375373e..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/SeedWordsUITestRunner.java
+++ /dev/null
@@ -1,101 +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.main.settings;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class SeedWordsUITestRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(SeedWordsUITestRunner.class);
- private Scene scene;
- private Pane view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 630);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/account/content/SeedWordsView.fxml"), false);
- try {
- view = loader.load();
- pane.getChildren().setAll(view);
- refreshStylesheets();
- } catch (IOException e) {
- e.printStackTrace();
- e.printStackTrace();
- }
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-}
diff --git a/src/test/java/io/bitsquare/gui/main/settings/uimock/BankAccountSettingsControllerUIMock.java b/src/test/java/io/bitsquare/gui/main/settings/uimock/BankAccountSettingsControllerUIMock.java
deleted file mode 100644
index 870a08c475..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/uimock/BankAccountSettingsControllerUIMock.java
+++ /dev/null
@@ -1,128 +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.main.settings.uimock;
-
-import io.bitsquare.bank.BankAccount;
-import io.bitsquare.bank.BankAccountType;
-import io.bitsquare.locale.BSResources;
-import io.bitsquare.locale.Country;
-import io.bitsquare.locale.CountryUtil;
-import io.bitsquare.locale.CurrencyUtil;
-import io.bitsquare.locale.Region;
-
-import java.net.URL;
-
-import java.util.Currency;
-import java.util.ResourceBundle;
-
-import javafx.collections.FXCollections;
-import javafx.fxml.FXML;
-import javafx.fxml.Initializable;
-import javafx.scene.control.*;
-import javafx.util.StringConverter;
-
-public class BankAccountSettingsControllerUIMock implements Initializable {
-
- @FXML private TextField bankAccountTitleTextField, bankAccountHolderNameTextField, bankAccountPrimaryIDTextField,
- bankAccountSecondaryIDTextField;
- @FXML private Button saveBankAccountButton, addBankAccountButton;
- @FXML private ComboBox bankAccountCountryComboBox;
- @FXML private ComboBox bankAccountRegionComboBox;
- @FXML private ComboBox bankAccountComboBox;
- @FXML private ComboBox bankAccountTypesComboBox;
- @FXML private ComboBox bankAccountCurrencyComboBox;
-
-
- ///////////////////////////////////////////////////////////////////////////////////////////
- // Lifecycle
- ///////////////////////////////////////////////////////////////////////////////////////////
-
- @Override
- public void initialize(URL url, ResourceBundle rb) {
- initBankAccountComboBox();
- initBankAccountTypesComboBox();
- initBankAccountCurrencyComboBox();
- initBankAccountCountryComboBox();
- }
-
- private void initBankAccountComboBox() {
- bankAccountComboBox.setPromptText("No bank account available");
- bankAccountComboBox.setDisable(true);
- }
-
- private void initBankAccountTypesComboBox() {
- bankAccountTypesComboBox.setItems(FXCollections.observableArrayList(BankAccountType.getAllBankAccountTypes()));
- bankAccountTypesComboBox.setConverter(new StringConverter() {
- @Override
- public String toString(BankAccountType bankAccountTypeInfo) {
- return BSResources.get(bankAccountTypeInfo.toString());
- }
-
- @Override
- public BankAccountType fromString(String s) {
- return null;
- }
- });
- }
-
- private void initBankAccountCurrencyComboBox() {
- bankAccountCurrencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllCurrencies()));
- bankAccountCurrencyComboBox.setConverter(new StringConverter() {
- @Override
- public String toString(Currency currency) {
- return currency.getCurrencyCode() + " (" + currency.getDisplayName() + ")";
- }
-
- @Override
- public Currency fromString(String s) {
- return null;
- }
- });
- }
-
- private void initBankAccountCountryComboBox() {
- bankAccountRegionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
- bankAccountRegionComboBox.setConverter(new StringConverter() {
- @Override
- public String toString(Region region) {
- return region.getName();
- }
-
- @Override
- public Region fromString(String s) {
- return null;
- }
- });
-
- bankAccountCountryComboBox.setConverter(new StringConverter() {
- @Override
- public String toString(Country country) {
- return country.getName();
- }
-
-
- @Override
- public Country fromString(String s) {
- return null;
- }
- });
- }
-
-
-}
-
diff --git a/src/test/java/io/bitsquare/gui/main/settings/uimock/BankAccountSettingsUIMockRunner.java b/src/test/java/io/bitsquare/gui/main/settings/uimock/BankAccountSettingsUIMockRunner.java
deleted file mode 100644
index 14ac6c7e8c..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/uimock/BankAccountSettingsUIMockRunner.java
+++ /dev/null
@@ -1,104 +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.main.settings.uimock;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class BankAccountSettingsUIMockRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(BankAccountSettingsUIMockRunner.class);
- private Scene scene;
- private Parent view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 1200);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/settings/uimock/BankAccountSettingsViewUIMock.fxml"), false);
-
- try {
- view = loader.load();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- pane.getChildren().setAll(view);
- refreshStylesheets();
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/test/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-
-
-}
diff --git a/src/test/java/io/bitsquare/gui/main/settings/uimock/BankAccountSettingsViewUIMock.fxml b/src/test/java/io/bitsquare/gui/main/settings/uimock/BankAccountSettingsViewUIMock.fxml
deleted file mode 100644
index cdd35efc10..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/uimock/BankAccountSettingsViewUIMock.fxml
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/test/java/io/bitsquare/gui/main/settings/uimock/RestrictionSettingsControllerUIMock.java b/src/test/java/io/bitsquare/gui/main/settings/uimock/RestrictionSettingsControllerUIMock.java
deleted file mode 100644
index 1f59018b83..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/uimock/RestrictionSettingsControllerUIMock.java
+++ /dev/null
@@ -1,39 +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.main.settings.uimock;
-
-import java.net.URL;
-
-import java.util.ResourceBundle;
-
-import javafx.fxml.Initializable;
-
-public class RestrictionSettingsControllerUIMock implements Initializable {
-
-
- ///////////////////////////////////////////////////////////////////////////////////////////
- // Lifecycle
- ///////////////////////////////////////////////////////////////////////////////////////////
-
- @Override
- public void initialize(URL url, ResourceBundle rb) {
- }
-
-
-}
-
diff --git a/src/test/java/io/bitsquare/gui/main/settings/uimock/RestrictionSettingsUIMockRunner.java b/src/test/java/io/bitsquare/gui/main/settings/uimock/RestrictionSettingsUIMockRunner.java
deleted file mode 100644
index 585c06a906..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/uimock/RestrictionSettingsUIMockRunner.java
+++ /dev/null
@@ -1,104 +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.main.settings.uimock;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class RestrictionSettingsUIMockRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(RestrictionSettingsUIMockRunner.class);
- private Scene scene;
- private Parent view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 1200);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/settings/uimock/RestrictionSettingsViewUIMock.fxml"), false);
-
- try {
- view = loader.load();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- pane.getChildren().setAll(view);
- refreshStylesheets();
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/test/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-
-
-}
diff --git a/src/test/java/io/bitsquare/gui/main/settings/uimock/RestrictionSettingsViewUIMock.fxml b/src/test/java/io/bitsquare/gui/main/settings/uimock/RestrictionSettingsViewUIMock.fxml
deleted file mode 100644
index af1abcef8a..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/uimock/RestrictionSettingsViewUIMock.fxml
+++ /dev/null
@@ -1,180 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/test/java/io/bitsquare/gui/main/settings/uimock/SeedWordsUIMockRunner.java b/src/test/java/io/bitsquare/gui/main/settings/uimock/SeedWordsUIMockRunner.java
deleted file mode 100644
index f987537f4e..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/uimock/SeedWordsUIMockRunner.java
+++ /dev/null
@@ -1,104 +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.main.settings.uimock;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class SeedWordsUIMockRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(SeedWordsUIMockRunner.class);
- private Scene scene;
- private Parent view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 1200);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/settings/uimock/SeedWordsViewUIMock.fxml"), false);
-
- try {
- view = loader.load();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- pane.getChildren().setAll(view);
- refreshStylesheets();
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/test/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-
-
-}
diff --git a/src/test/java/io/bitsquare/gui/main/settings/uimock/SeedWordsViewUIMock.fxml b/src/test/java/io/bitsquare/gui/main/settings/uimock/SeedWordsViewUIMock.fxml
deleted file mode 100644
index 8f6487ecf5..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/uimock/SeedWordsViewUIMock.fxml
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/test/java/io/bitsquare/gui/main/settings/uimock/SetPasswordControllerUIMock.java b/src/test/java/io/bitsquare/gui/main/settings/uimock/SetPasswordControllerUIMock.java
deleted file mode 100644
index 6c0fd429f1..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/uimock/SetPasswordControllerUIMock.java
+++ /dev/null
@@ -1,39 +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.main.settings.uimock;
-
-import java.net.URL;
-
-import java.util.ResourceBundle;
-
-import javafx.fxml.Initializable;
-
-public class SetPasswordControllerUIMock implements Initializable {
-
-
- ///////////////////////////////////////////////////////////////////////////////////////////
- // Lifecycle
- ///////////////////////////////////////////////////////////////////////////////////////////
-
- @Override
- public void initialize(URL url, ResourceBundle rb) {
- }
-
-
-}
-
diff --git a/src/test/java/io/bitsquare/gui/main/settings/uimock/SetPasswordUIMockRunner.java b/src/test/java/io/bitsquare/gui/main/settings/uimock/SetPasswordUIMockRunner.java
deleted file mode 100644
index 0376ccf605..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/uimock/SetPasswordUIMockRunner.java
+++ /dev/null
@@ -1,104 +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.main.settings.uimock;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class SetPasswordUIMockRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(SetPasswordUIMockRunner.class);
- private Scene scene;
- private Parent view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 1200);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/settings/uimock/SetPasswordViewUIMock.fxml"), false);
-
- try {
- view = loader.load();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- pane.getChildren().setAll(view);
- refreshStylesheets();
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/test/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-
-
-}
diff --git a/src/test/java/io/bitsquare/gui/main/settings/uimock/SetPasswordViewUIMock.fxml b/src/test/java/io/bitsquare/gui/main/settings/uimock/SetPasswordViewUIMock.fxml
deleted file mode 100644
index 992a01b5df..0000000000
--- a/src/test/java/io/bitsquare/gui/main/settings/uimock/SetPasswordViewUIMock.fxml
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/test/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferUITestRunner.java b/src/test/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferUITestRunner.java
deleted file mode 100644
index 4fceb10a98..0000000000
--- a/src/test/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferUITestRunner.java
+++ /dev/null
@@ -1,101 +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.main.trade.createoffer;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class CreateOfferUITestRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(CreateOfferUITestRunner.class);
- private Scene scene;
- private Pane view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 630);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml"), false);
- try {
- view = loader.load();
- pane.getChildren().setAll(view);
- refreshStylesheets();
- } catch (IOException e) {
- e.printStackTrace();
- e.printStackTrace();
- }
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-}
diff --git a/src/test/java/io/bitsquare/gui/main/trade/createoffer/uimock/CreateOfferControllerUIMock.java b/src/test/java/io/bitsquare/gui/main/trade/createoffer/uimock/CreateOfferControllerUIMock.java
deleted file mode 100644
index 0aac0a175a..0000000000
--- a/src/test/java/io/bitsquare/gui/main/trade/createoffer/uimock/CreateOfferControllerUIMock.java
+++ /dev/null
@@ -1,171 +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.main.trade.createoffer.uimock;
-
-import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
-
-import java.net.URL;
-
-import java.util.ResourceBundle;
-
-import javax.inject.Inject;
-
-import javafx.fxml.FXML;
-import javafx.fxml.Initializable;
-import javafx.scene.control.*;
-import javafx.scene.image.*;
-import javafx.scene.layout.*;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CreateOfferControllerUIMock implements Initializable {
- private static final Logger log = LoggerFactory.getLogger(CreateOfferControllerUIMock.class);
-
-
- @FXML private GridPane gridPane;
- @FXML private VBox priceAmountMinAmountBox, priceAmountBuyIconBox;
- @FXML private HBox priceAmountHBox;
- @FXML private ImageView priceAmountInfoIcon, payFundsInfoIcon, paymentInfoIcon, showDetailsInfoIcon;
- @FXML private Separator totalsSeparator;
-
- @FXML private Pane priceAmountPane, paymentInfoPane, payFundsPane, showDetailsPane;
- @FXML private Label priceAmountInfoLabel, priceAmountTitleLabel, paymentInfoTitleLabel, addressLabel,
- balanceLabel, paymentInfoLabel,
- payFundsInfoLabel, payFundsTitleLabel, offerFeeLabel, networkFeeLabel, summaryBtcLabel, totalToPayLabel,
- showDetailsTitleLabel, bankAccountTypeLabel, bankAccountCurrencyLabel, bankAccountCountyLabel,
- acceptedCountriesLabel, acceptedLanguagesLabel, acceptedArbitratorsLabel, showDetailsInfoLabel;
- @FXML private Button showPaymentInfoScreenButton, showPayFundsScreenButton, showDetailsButton;
-
- @FXML private TextField offerFeeTextField, networkFeeTextField, acceptedArbitratorsTextField;
- @FXML private TextField addressTextField;
- @FXML private TextField balanceTextField;
-
- @FXML private Label buyLabel, confirmationLabel, txTitleLabel, securityDepositLabel;
- @FXML private TextField amountTextField, minAmountTextField, priceTextField, volumeTextField;
- @FXML private Button placeOfferButton, closeButton;
- @FXML private TextField totalToPayTextField, securityDepositTextField, bankAccountTypeTextField,
- bankAccountCurrencyTextField, bankAccountCountyTextField, acceptedCountriesTextField,
- acceptedLanguagesTextField,
- summaryBtcTextField, transactionIdTextField;
- @FXML private ConfidenceProgressIndicator progressIndicator;
-
-
- @Inject
- private CreateOfferControllerUIMock() {
- }
-
- @Override
- public void initialize(URL url, ResourceBundle rb) {
- }
-
- /* @FXML
- private void collapsePriceAmountPane() {
- for (int i = 1; i < 4; i++) {
- gridPane.getRowConstraints().get(i).setMaxHeight(0);
- }
-
- GridPane.setRowSpan(priceAmountPane, 1);
- priceAmountBuyIconBox.setMaxHeight(0);
-
- // priceAmountPane.setVisible(false);
- // priceAmountTitleLabel.setVisible(false);
- priceAmountBuyIconBox.setVisible(false);
- priceAmountHBox.setVisible(false);
- priceAmountMinAmountBox.setVisible(false);
- priceAmountInfoIcon.setVisible(false);
- priceAmountInfoLabel.setVisible(false);
- }*/
-
- @FXML
- private void showPaymentInfoScreen() {
-
- priceAmountPane.setId("form-group-background");
- priceAmountTitleLabel.setId("form-group-title");
- showPaymentInfoScreenButton.setVisible(false);
-
- paymentInfoPane.setVisible(true);
- securityDepositLabel.setVisible(true);
- securityDepositTextField.setVisible(true);
- offerFeeLabel.setVisible(true);
- offerFeeTextField.setVisible(true);
- networkFeeLabel.setVisible(true);
- networkFeeTextField.setVisible(true);
- totalsSeparator.setVisible(true);
- summaryBtcLabel.setVisible(true);
- summaryBtcTextField.setVisible(true);
- paymentInfoLabel.setVisible(true);
- paymentInfoIcon.setVisible(true);
- showPayFundsScreenButton.setVisible(true);
-
- showPayFundsScreen();
- }
-
- @FXML
- private void showPayFundsScreen() {
- paymentInfoPane.setId("form-group-background");
- paymentInfoTitleLabel.setId("form-group-title");
-
- showPayFundsScreenButton.setVisible(false);
-
- payFundsPane.setVisible(true);
- totalToPayLabel.setVisible(true);
- totalToPayTextField.setVisible(true);
- addressLabel.setVisible(true);
- addressTextField.setVisible(true);
- balanceLabel.setVisible(true);
- balanceTextField.setVisible(true);
- payFundsInfoIcon.setVisible(true);
- payFundsInfoLabel.setVisible(true);
- placeOfferButton.setVisible(true);
- showDetailsButton.setVisible(true);
-
- }
-
- @FXML
- private void showDetailsScreen() {
- payFundsPane.setId("form-group-background");
- payFundsTitleLabel.setId("form-group-title");
-
- showDetailsButton.setManaged(false);
- showDetailsButton.setVisible(false);
-
- showDetailsPane.setVisible(true);
- showDetailsTitleLabel.setVisible(true);
-
- acceptedCountriesLabel.setVisible(true);
- acceptedCountriesTextField.setVisible(true);
- acceptedLanguagesLabel.setVisible(true);
- acceptedLanguagesTextField.setVisible(true);
- acceptedArbitratorsLabel.setVisible(true);
- acceptedArbitratorsTextField.setVisible(true);
-
- bankAccountTypeLabel.setVisible(true);
- bankAccountTypeTextField.setVisible(true);
- bankAccountCurrencyLabel.setVisible(true);
- bankAccountCurrencyTextField.setVisible(true);
- bankAccountCountyLabel.setVisible(true);
- bankAccountCountyTextField.setVisible(true);
-
- showDetailsInfoIcon.setVisible(true);
- showDetailsInfoLabel.setVisible(true);
- }
-
-
-}
-
diff --git a/src/test/java/io/bitsquare/gui/main/trade/createoffer/uimock/CreateOfferUIMockRunner.java b/src/test/java/io/bitsquare/gui/main/trade/createoffer/uimock/CreateOfferUIMockRunner.java
deleted file mode 100644
index e51516259e..0000000000
--- a/src/test/java/io/bitsquare/gui/main/trade/createoffer/uimock/CreateOfferUIMockRunner.java
+++ /dev/null
@@ -1,104 +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.main.trade.createoffer.uimock;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * For testing single isolated UI screens
- */
-public class CreateOfferUIMockRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(CreateOfferUIMockRunner.class);
- private Scene scene;
- private Parent view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 630);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/gui/main/trade/createoffer/uimock/CreateOfferViewUIMock.fxml"), false);
-
- try {
- view = loader.load();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- pane.getChildren().setAll(view);
- refreshStylesheets();
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/test/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-
-
-}
diff --git a/src/test/java/io/bitsquare/gui/main/trade/createoffer/uimock/CreateOfferViewUIMock.fxml b/src/test/java/io/bitsquare/gui/main/trade/createoffer/uimock/CreateOfferViewUIMock.fxml
deleted file mode 100644
index f8193c58eb..0000000000
--- a/src/test/java/io/bitsquare/gui/main/trade/createoffer/uimock/CreateOfferViewUIMock.fxml
+++ /dev/null
@@ -1,389 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/test/java/io/bitsquare/msg/dhttest/DHTTestController.java b/src/test/java/io/bitsquare/msg/dhttest/DHTTestController.java
deleted file mode 100644
index a7d10ee728..0000000000
--- a/src/test/java/io/bitsquare/msg/dhttest/DHTTestController.java
+++ /dev/null
@@ -1,183 +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.msg.dhttest;
-
-import io.bitsquare.Bitsquare;
-import io.bitsquare.bank.BankAccountType;
-import io.bitsquare.gui.main.trade.offerbook.OfferBookListItem;
-import io.bitsquare.locale.CountryUtil;
-import io.bitsquare.msg.BootstrappedPeerFactory;
-import io.bitsquare.msg.MessageFacade;
-import io.bitsquare.msg.listeners.AddOfferListener;
-import io.bitsquare.msg.listeners.BootstrapListener;
-import io.bitsquare.msg.listeners.OfferBookListener;
-import io.bitsquare.trade.Direction;
-import io.bitsquare.trade.Offer;
-import io.bitsquare.user.User;
-
-import org.bitcoinj.core.Coin;
-
-import java.net.URL;
-
-import java.util.ArrayList;
-import java.util.Currency;
-import java.util.List;
-import java.util.ResourceBundle;
-
-import javax.inject.Inject;
-
-import javafx.beans.property.ReadOnlyObjectWrapper;
-import javafx.collections.FXCollections;
-import javafx.collections.ObservableList;
-import javafx.fxml.FXML;
-import javafx.fxml.Initializable;
-import javafx.scene.control.*;
-import javafx.util.Callback;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DHTTestController implements Initializable {
- private static final Logger log = LoggerFactory.getLogger(DHTTestController.class);
-
- private final MessageFacade messageFacade;
- private BootstrappedPeerFactory bootstrappedPeerFactory;
- private User user;
- private final ObservableList offerBookListItems = FXCollections.observableArrayList();
-
- @FXML TableView table;
- @FXML TextArea stateLabel;
- @FXML TextField toSaveTextField;
- @FXML TableColumn idColumn;
-
- @Inject
- private DHTTestController(MessageFacade messageFacade, User user,
- BootstrappedPeerFactory bootstrappedPeerFactory) {
- this.user = user;
- this.messageFacade = messageFacade;
- this.bootstrappedPeerFactory = bootstrappedPeerFactory;
-
- user.applyPersistedUser(null);
- }
-
- @Override
- public void initialize(URL url, ResourceBundle rb) {
- messageFacade.init(Bitsquare.getClientPort(), new BootstrapListener() {
- @Override
- public void onCompleted() {
- onMessageFacadeInitialised();
- }
-
- @Override
- public void onFailed(Throwable throwable) {
- log.error(throwable.toString());
- }
- });
-
- messageFacade.addOfferBookListener(new OfferBookListener() {
- @Override
- public void onOfferAdded(Offer offer) {
- log.debug("offer added " + offer.getId());
- }
-
- @Override
- public void onOffersReceived(List offers) {
- //TODO use deltas instead replacing the whole list
- offerBookListItems.clear();
- offers.stream().forEach(offer -> {
- if (offer != null) {
- offerBookListItems.add(new OfferBookListItem(offer, CountryUtil.getDefaultCountry()));
- }
- });
- }
-
- @Override
- public void onOfferRemoved(Offer offer) {
- offerBookListItems.removeIf(item -> item.getOffer().getId().equals(offer.getId()));
- }
- });
-
- setIDColumnCellFactory();
- table.setItems(offerBookListItems);
-
- bootstrappedPeerFactory.connectionState.addListener((ov, oldValue, newValue) -> {
- stateLabel.setText(newValue);
- });
- }
-
- @FXML
- public void onAddOffer() {
- Offer offer = new Offer(toSaveTextField.getText(),
- user.getMessagePublicKey(),
- Direction.BUY,
- 500,
- Coin.COIN,
- Coin.COIN,
- BankAccountType.SEPA,
- Currency.getInstance("EUR"),
- CountryUtil.getDefaultCountry(),
- "bankAccountUID",
- new ArrayList<>(),
- Coin.parseCoin("0.1"),
- new ArrayList<>(),
- new ArrayList<>());
-
- messageFacade.addOffer(offer, new AddOfferListener() {
- @Override
- public void onComplete() {
- log.debug("onAddOffer onComplete");
- }
-
- @Override
- public void onFailed(String reason, Throwable throwable) {
- log.debug("onAddOffer onFailed");
- }
- });
- }
-
- public void onGetOffers() {
- log.debug("onLoad");
- messageFacade.getOffers("EUR");
- }
-
- private void onMessageFacadeInitialised() {
- log.debug("onMessageFacadeInitialised");
- }
-
- private void setIDColumnCellFactory() {
- idColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
- idColumn.setCellFactory(
- new Callback, TableCell>() {
- @Override
- public TableCell call(
- TableColumn column) {
- return new TableCell() {
- @Override
- public void updateItem(final OfferBookListItem item, boolean empty) {
- super.updateItem(item, empty);
- if (item != null && item.getOffer() != null && item.getOffer().getAmount() != null)
- setText(item.getOffer().getId());
- }
- };
- }
- });
- }
-
-}
-
diff --git a/src/test/java/io/bitsquare/msg/dhttest/DHTTestRunner.java b/src/test/java/io/bitsquare/msg/dhttest/DHTTestRunner.java
deleted file mode 100644
index 443f64c5c4..0000000000
--- a/src/test/java/io/bitsquare/msg/dhttest/DHTTestRunner.java
+++ /dev/null
@@ -1,102 +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.msg.dhttest;
-
-import io.bitsquare.di.BitsquareModule;
-import io.bitsquare.util.ViewLoader;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import java.io.IOException;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javafx.application.Application;
-import javafx.scene.*;
-import javafx.scene.input.*;
-import javafx.scene.layout.*;
-import javafx.stage.Stage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DHTTestRunner extends Application {
- private static final Logger log = LoggerFactory.getLogger(DHTTestRunner.class);
- private Scene scene;
- private Parent view;
- private Pane pane;
- private boolean devTest = true;
-
- public static void main(String[] args) {
- launch(args);
- }
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- Injector injector = Guice.createInjector(new BitsquareModule());
- ViewLoader.setInjector(injector);
-
- pane = new StackPane();
- scene = new Scene(pane, 1000, 630);
- scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
- loadMainWindow();
- primaryStage.setScene(scene);
- primaryStage.show();
- }
-
- public void loadMainWindow() {
- log.debug("re load");
- pane.getChildren().removeAll();
- ViewLoader loader = new ViewLoader(
- getUrl("/io/bitsquare/msg/dhttest/DHTTestView.fxml")
- , false);
-
- try {
- view = loader.load();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- pane.getChildren().setAll(view);
- refreshStylesheets();
- }
-
- private void refreshStylesheets() {
- scene.getStylesheets().clear();
- scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
- }
-
- private URL getUrl(String subPath) {
- if (devTest) {
- try {
- // load from file system location to make a reload possible. makes dev process easier with hot reload
- return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/test/java" + subPath);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
- else {
- return getClass().getResource(subPath);
- }
- }
-
-
-}
diff --git a/src/test/java/io/bitsquare/msg/dhttest/DHTTestView.fxml b/src/test/java/io/bitsquare/msg/dhttest/DHTTestView.fxml
deleted file mode 100644
index c2c8883113..0000000000
--- a/src/test/java/io/bitsquare/msg/dhttest/DHTTestView.fxml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-