Add account settings screens

This commit is contained in:
Manfred Karrer 2014-09-08 18:35:48 +02:00
parent efc2100b26
commit 05525e3558
71 changed files with 1688 additions and 1040 deletions

View file

@ -0,0 +1,101 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.account;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.util.BSFXMLLoader;
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());
BSFXMLLoader.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();
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/settings/AccountSettingsView.fxml"), false);
try {
view = loader.load();
pane.getChildren().setAll(view);
refreshStylesheets();
} catch (IOException e) {
e.printStackTrace();
log.error(e.getStackTrace().toString());
}
}
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);
}
}
}

View file

@ -18,7 +18,7 @@
package io.bitsquare.gui.account;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -54,7 +54,7 @@ public class AccountUITestRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 630);
@ -67,7 +67,7 @@ public class AccountUITestRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/AccountView.fxml"), false);
try {
view = loader.load();

View file

@ -0,0 +1,101 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.account;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.util.BSFXMLLoader;
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());
BSFXMLLoader.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();
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/registration/RegistrationView.fxml"), false);
try {
view = loader.load();
pane.getChildren().setAll(view);
refreshStylesheets();
} catch (IOException e) {
e.printStackTrace();
log.error(e.getStackTrace().toString());
}
}
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);
}
}
}

View file

@ -18,7 +18,7 @@
package io.bitsquare.gui.account;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -54,7 +54,7 @@ public class SetupUITestRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 630);
@ -67,7 +67,7 @@ public class SetupUITestRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/setup/SetupView.fxml"), false);
try {
view = loader.load();

View file

@ -1,7 +1,7 @@
package io.bitsquare.gui.account.registration.uimock;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -37,10 +37,10 @@ public class FundRegistrationWalletUIMockRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 1200);
scene = new Scene(pane, 1000, 650);
scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
loadMainWindow();
primaryStage.setScene(scene);
@ -50,8 +50,8 @@ public class FundRegistrationWalletUIMockRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
getUrl("/io/bitsquare/gui/registration/uimock/FundRegistrationWalletViewUIMock.fxml"), false);
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/registration/uimock/FundRegistrationWalletViewUIMock.fxml"), false);
try {
view = loader.load();

View file

@ -1,7 +1,7 @@
package io.bitsquare.gui.account.registration.uimock;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -37,7 +37,7 @@ public class RegistrationUIMockRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 660);
@ -50,7 +50,7 @@ public class RegistrationUIMockRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/registration/uimock/RegistrationViewUIMock.fxml"), false);
try {

View file

@ -18,7 +18,7 @@
package io.bitsquare.gui.settings;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -54,7 +54,7 @@ public class FiatAccountUITestRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 630);
@ -67,7 +67,7 @@ public class FiatAccountUITestRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/fiataccount/FiatAccountView.fxml"), false);
try {
view = loader.load();

View file

@ -18,7 +18,7 @@
package io.bitsquare.gui.settings;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -54,7 +54,7 @@ public class PasswordUITestRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 630);
@ -67,8 +67,8 @@ public class PasswordUITestRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
getUrl("/io/bitsquare/gui/account/password/PasswordView.fxml"), false);
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/addpassword/PasswordView.fxml"), false);
try {
view = loader.load();
pane.getChildren().setAll(view);

View file

@ -18,7 +18,7 @@
package io.bitsquare.gui.settings;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -54,7 +54,7 @@ public class RegistrationUITestRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 530);
@ -67,7 +67,7 @@ public class RegistrationUITestRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/registration/RegistrationView.fxml"), false);
try {
view = loader.load();

View file

@ -18,7 +18,7 @@
package io.bitsquare.gui.settings;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -54,7 +54,7 @@ public class RestrictionsUITestRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 530);
@ -67,7 +67,7 @@ public class RestrictionsUITestRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/restrictions/RestrictionsView.fxml"), false);
try {
view = loader.load();

View file

@ -18,7 +18,7 @@
package io.bitsquare.gui.settings;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -54,7 +54,7 @@ public class SeedWordsUITestRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 630);
@ -67,7 +67,7 @@ public class SeedWordsUITestRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/seedwords/SeedWordsView.fxml"), false);
try {
view = loader.load();

View file

@ -18,7 +18,7 @@
package io.bitsquare.gui.settings.uimock;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -54,7 +54,7 @@ public class BankAccountSettingsUIMockRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 1200);
@ -67,7 +67,7 @@ public class BankAccountSettingsUIMockRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/settings/uimock/BankAccountSettingsViewUIMock.fxml"), false);
try {

View file

@ -18,7 +18,7 @@
package io.bitsquare.gui.settings.uimock;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -54,7 +54,7 @@ public class RestrictionSettingsUIMockRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 1200);
@ -67,7 +67,7 @@ public class RestrictionSettingsUIMockRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/settings/uimock/RestrictionSettingsViewUIMock.fxml"), false);
try {

View file

@ -1,7 +1,7 @@
package io.bitsquare.gui.settings.uimock;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -37,7 +37,7 @@ public class SeedWordsUIMockRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 1200);
@ -50,7 +50,7 @@ public class SeedWordsUIMockRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/settings/uimock/SeedWordsViewUIMock.fxml"), false);
try {

View file

@ -1,7 +1,7 @@
package io.bitsquare.gui.settings.uimock;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -37,7 +37,7 @@ public class SetPasswordUIMockRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 1200);
@ -50,7 +50,7 @@ public class SetPasswordUIMockRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/settings/uimock/SetPasswordViewUIMock.fxml"), false);
try {

View file

@ -18,7 +18,7 @@
package io.bitsquare.gui.trade.createoffer;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -54,7 +54,7 @@ public class CreateOfferUITestRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 630);
@ -67,7 +67,7 @@ public class CreateOfferUITestRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml"), false);
try {
view = loader.load();

View file

@ -18,7 +18,7 @@
package io.bitsquare.gui.trade.createoffer.uimock;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import io.bitsquare.util.BSFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -54,7 +54,7 @@ public class CreateOfferUIMockRunner extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
BSFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 630);
@ -67,7 +67,7 @@ public class CreateOfferUIMockRunner extends Application {
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/trade/createoffer/uimock/CreateOfferViewUIMock.fxml"), false);
try {