diff --git a/src/main/java/io/bitsquare/gui/CachedCodeBehind.java b/src/main/java/io/bitsquare/gui/CachedCodeBehind.java index 14d0505808..bc5a16f3c9 100644 --- a/src/main/java/io/bitsquare/gui/CachedCodeBehind.java +++ b/src/main/java/io/bitsquare/gui/CachedCodeBehind.java @@ -48,7 +48,7 @@ public class CachedCodeBehind extends CodeBehind */ public void activate() { log.trace("Lifecycle: activate " + this.getClass().getSimpleName()); - if (childController instanceof CachedViewController) ((CachedViewController) childController).activate(); + if (childController instanceof CachedCodeBehind) ((CachedCodeBehind) childController).activate(); presentationModel.activate(); } @@ -58,7 +58,7 @@ public class CachedCodeBehind extends CodeBehind */ public void deactivate() { log.trace("Lifecycle: deactivate " + this.getClass().getSimpleName()); - if (childController instanceof CachedViewController) ((CachedViewController) childController).deactivate(); + if (childController instanceof CachedCodeBehind) ((CachedCodeBehind) childController).deactivate(); presentationModel.deactivate(); } diff --git a/src/main/java/io/bitsquare/gui/CodeBehind.java b/src/main/java/io/bitsquare/gui/CodeBehind.java index c8563ff728..f88f9344bc 100644 --- a/src/main/java/io/bitsquare/gui/CodeBehind.java +++ b/src/main/java/io/bitsquare/gui/CodeBehind.java @@ -20,8 +20,10 @@ public class CodeBehind implements Initializable { private static final Logger log = LoggerFactory.getLogger(CodeBehind.class); protected T presentationModel; - protected ViewController childController; - protected ViewController parentController; + //TODO Initializable has to be changed to CodeBehind when all UIs are updated + protected Initializable childController; + //TODO Initializable has to be changed to CodeBehind when all UIs are updated + protected Initializable parentController; @FXML protected Parent root; public CodeBehind(T presentationModel) { @@ -59,7 +61,7 @@ public class CodeBehind implements Initializable { public void terminate() { log.trace("Lifecycle: terminate " + this.getClass().getSimpleName()); if (childController != null) - childController.terminate(); + ((CodeBehind) childController).terminate(); presentationModel.deactivate(); presentationModel.terminate(); @@ -69,7 +71,7 @@ public class CodeBehind implements Initializable { * @param parentController Controller who has created this.getClass().getSimpleName() instance (via * navigateToView/FXMLLoader). */ - public void setParentController(ViewController parentController) { + public void setParentController(Initializable parentController) { log.trace("Lifecycle: setParentController " + this.getClass().getSimpleName() + " / parent = " + parentController); this.parentController = parentController; @@ -79,7 +81,7 @@ public class CodeBehind implements Initializable { * @param navigationItem NavigationItem to be loaded. * @return The ViewController of the loaded view. */ - public ViewController loadViewAndGetChildController(NavigationItem navigationItem) { + public Initializable loadViewAndGetChildController(NavigationItem navigationItem) { log.trace("Lifecycle: loadViewAndGetChildController " + this.getClass().getSimpleName() + " / navigationItem " + "= " + navigationItem); return null; diff --git a/src/main/java/io/bitsquare/gui/MainController.java b/src/main/java/io/bitsquare/gui/MainController.java index 4102eaa943..47bfa5e3b2 100644 --- a/src/main/java/io/bitsquare/gui/MainController.java +++ b/src/main/java/io/bitsquare/gui/MainController.java @@ -75,16 +75,16 @@ public class MainController extends ViewController { private final MessageFacade messageFacade; private final TradeManager tradeManager; private final Persistence persistence; - private final ToggleGroup toggleGroup = new ToggleGroup(); private final ViewBuilder viewBuilder; + private final ToggleGroup navButtonsGroup = new ToggleGroup(); - private ToggleButton prevToggleButton; - private Image prevToggleButtonIcon; - private ToggleButton buyButton, sellButton, homeButton, msgButton, ordersButton, fundsButton, settingsButton; + private ToggleButton buyButton, sellButton, homeButton, msgButton, ordersButton, fundsButton, settingsButton, + accountButton; private Pane ordersButtonButtonHolder; private boolean messageFacadeInited; private boolean walletFacadeInited; private VBox accountComboBoxHolder; + private Pane setupView; /////////////////////////////////////////////////////////////////////////////////////////// @@ -124,7 +124,7 @@ public class MainController extends ViewController { super.initialize(url, rb); Profiler.printMsgWithTime("MainController.initialize"); - Platform.runLater(() -> viewBuilder.buildSplashScreen((BorderPane) root, this)); + Platform.runLater(() -> viewBuilder.buildSplashScreen((StackPane) root, this)); } @Override @@ -161,6 +161,9 @@ public class MainController extends ViewController { case BUY: buyButton.fire(); break; + case ACCOUNT: + accountButton.fire(); + break; } return childController; } @@ -200,40 +203,11 @@ public class MainController extends ViewController { private void onNavigationAdded() { Profiler.printMsgWithTime("MainController.onNavigationAdded"); - // Platform.runLater(this::loadContentView); - // TODO for dev testing - Platform.runLater(this::loadSetup); - } - - //TODO for dev testing - private void loadSetup() { - Profiler.printMsgWithTime("MainController.loadSetup"); - - final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(NavigationItem.SETUP.getFxmlUrl())); - try { - final Node view = loader.load(); - viewBuilder.contentPane.getChildren().setAll(view); - childController = loader.getController(); - - //TODO Remove that when all UIs are converted to CodeBehind - if (childController instanceof ViewController) - ((ViewController) childController).setParentController(this); - else if (childController instanceof CodeBehind) - ((CodeBehind) childController).setParentController(this); - - } catch (IOException e) { - log.error("Loading view failed. FxmlUrl = " + NavigationItem.SETUP.getFxmlUrl()); - log.error(e.getCause().toString()); - log.error(e.getMessage()); - log.error(e.getStackTrace().toString()); - } - - Platform.runLater(this::onContentViewLoaded); + Platform.runLater(this::loadContentView); } private void onContentViewLoaded() { Profiler.printMsgWithTime("MainController.onContentViewLoaded"); - root.setId("main-view"); Platform.runLater(this::fadeOutSplash); } @@ -292,6 +266,7 @@ public class MainController extends ViewController { private void addNavigation() { Profiler.printMsgWithTime("MainController.addNavigation"); + homeButton = addNavButton(viewBuilder.leftNavPane, "Overview", NavigationItem.HOME); buyButton = addNavButton(viewBuilder.leftNavPane, "Buy BTC", NavigationItem.BUY); sellButton = addNavButton(viewBuilder.leftNavPane, "Sell BTC", NavigationItem.SELL); @@ -318,6 +293,7 @@ public class MainController extends ViewController { }); settingsButton = addNavButton(viewBuilder.rightNavPane, "Settings", NavigationItem.SETTINGS); + accountButton = addNavButton(viewBuilder.rightNavPane, "Account", NavigationItem.ACCOUNT); Platform.runLater(this::onNavigationAdded); } @@ -350,7 +326,8 @@ public class MainController extends ViewController { ((ViewController) childController).setParentController(this); else if (childController instanceof CodeBehind) ((CodeBehind) childController).setParentController(this); - + + persistence.write(this, "selectedNavigationItem", navigationItem); } catch (IOException e) { log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl()); log.error(e.getCause().toString()); @@ -360,34 +337,50 @@ public class MainController extends ViewController { } private ToggleButton addNavButton(Pane parent, String title, NavigationItem navigationItem) { - final Pane pane = new Pane(); - pane.setPrefSize(50, 50); - final ToggleButton toggleButton = new ToggleButton("", ImageUtil.getIconImageView(navigationItem.getIcon())); - toggleButton.setToggleGroup(toggleGroup); + // final Pane pane = new Pane(); + // pane.setPrefSize(50, 50); + + ImageView icon = ImageUtil.getIconImageView(navigationItem.getIcon()); + icon.setFitWidth(32); + icon.setFitHeight(32); + + final ToggleButton toggleButton = new ToggleButton(title, icon); + toggleButton.setToggleGroup(navButtonsGroup); toggleButton.setId("nav-button"); - toggleButton.setPrefSize(50, 50); - toggleButton.setOnAction(e -> { - if (prevToggleButton != null) { - ((ImageView) (prevToggleButton.getGraphic())).setImage(prevToggleButtonIcon); + toggleButton.setPadding(new Insets(0, -10, -10, -10)); + toggleButton.setMinSize(50, 50); + toggleButton.setMaxSize(50, 50); + toggleButton.setContentDisplay(ContentDisplay.TOP); + toggleButton.setGraphicTextGap(0); + + toggleButton.selectedProperty().addListener((ov, oldValue, newValue) -> { + toggleButton.setMouseTransparent(newValue); + toggleButton.setMinSize(50, 50); + toggleButton.setMaxSize(50, 50); + toggleButton.setGraphicTextGap(newValue ? -1 : 0); + if (newValue) { + Image activeIcon = ImageUtil.getIconImage(navigationItem.getActiveIcon()); + ((ImageView) toggleButton.getGraphic()).setImage(activeIcon); + } + else { + Image activeIcon = ImageUtil.getIconImage(navigationItem.getIcon()); + ((ImageView) toggleButton.getGraphic()).setImage(activeIcon); } - prevToggleButtonIcon = ((ImageView) (toggleButton.getGraphic())).getImage(); - ((ImageView) (toggleButton.getGraphic())).setImage(ImageUtil.getIconImage(navigationItem.getActiveIcon())); - - loadView(navigationItem); - - persistence.write(this, "selectedNavigationItem", navigationItem); - - prevToggleButton = toggleButton; }); - final Label titleLabel = new Label(title); - titleLabel.setPrefWidth(60); - titleLabel.setLayoutY(40); + toggleButton.setOnAction(e -> loadView(navigationItem)); + + /* final Label titleLabel = new Label(title); + titleLabel.setLayoutY(35); titleLabel.setId("nav-button-label"); titleLabel.setMouseTransparent(true); - - pane.getChildren().setAll(toggleButton, titleLabel); - parent.getChildren().add(pane); + titleLabel.widthProperty().addListener((observableValue, number, newValue) -> + titleLabel.setLayoutX((50.0 - (double) newValue) / 2 - 1)); +*/ + // pane.getChildren().addAll(toggleButton); + // pane.getChildren().addAll(toggleButton, titleLabel); + // parent.getChildren().add(pane); + parent.getChildren().add(toggleButton); return toggleButton; } @@ -465,33 +458,36 @@ class ViewBuilder { HBox leftNavPane, rightNavPane; AnchorPane contentPane; NetworkSyncPane networkSyncPane; - StackPane stackPane; + BorderPane baseContentContainer; AnchorPane contentScreen; VBox splashVBox; MenuBar menuBar; - BorderPane root; + StackPane root; Label loadingLabel; boolean showNetworkSyncPane; - void buildSplashScreen(BorderPane root, MainController controller) { + void buildSplashScreen(StackPane root, MainController controller) { Profiler.printMsgWithTime("MainController.ViewBuilder.buildSplashScreen"); + this.root = root; - stackPane = new StackPane(); + baseContentContainer = new BorderPane(); + baseContentContainer.setId("base-content-container"); splashVBox = getSplashScreen(); - stackPane.getChildren().add(splashVBox); - root.setCenter(stackPane); - menuBar = getMenuBar(); - root.setTop(menuBar); + root.getChildren().addAll(baseContentContainer, splashVBox); Platform.runLater(() -> buildContentView(controller)); } void buildContentView(MainController controller) { Profiler.printMsgWithTime("MainController.ViewBuilder.buildContentView"); + + menuBar = getMenuBar(); + baseContentContainer.setTop(menuBar); + contentScreen = getContentScreen(); - stackPane.getChildren().add(contentScreen); + baseContentContainer.setCenter(contentScreen); Platform.runLater(controller::onViewInitialized); } @@ -503,7 +499,7 @@ class ViewBuilder { leftNavPane = new HBox(); leftNavPane.setAlignment(Pos.CENTER); leftNavPane.setSpacing(10); - AnchorPane.setLeftAnchor(leftNavPane, 0d); + AnchorPane.setLeftAnchor(leftNavPane, 10d); AnchorPane.setTopAnchor(leftNavPane, 0d); rightNavPane = new HBox(); @@ -549,6 +545,7 @@ class ViewBuilder { VBox splashVBox = new VBox(); splashVBox.setAlignment(Pos.CENTER); splashVBox.setSpacing(10); + splashVBox.setId("splash"); ImageView logo = ImageUtil.getIconImageView(ImageUtil.SPLASH_LOGO); logo.setFitWidth(300); diff --git a/src/main/java/io/bitsquare/gui/MainView.fxml b/src/main/java/io/bitsquare/gui/MainView.fxml index a87b4bc448..c2eb22c969 100644 --- a/src/main/java/io/bitsquare/gui/MainView.fxml +++ b/src/main/java/io/bitsquare/gui/MainView.fxml @@ -17,7 +17,7 @@ --> - - \ No newline at end of file + + \ No newline at end of file diff --git a/src/main/java/io/bitsquare/gui/NavigationItem.java b/src/main/java/io/bitsquare/gui/NavigationItem.java index cca73d29a7..ec22c2cfb1 100644 --- a/src/main/java/io/bitsquare/gui/NavigationItem.java +++ b/src/main/java/io/bitsquare/gui/NavigationItem.java @@ -28,8 +28,8 @@ public enum NavigationItem { FUNDS("/io/bitsquare/gui/funds/FundsView.fxml", ImageUtil.FUNDS, ImageUtil.FUNDS_ACTIVE), MSG("/io/bitsquare/gui/msg/MsgView.fxml", ImageUtil.MSG, ImageUtil.MSG_ACTIVE), SETTINGS("/io/bitsquare/gui/settings/SettingsView.fxml", ImageUtil.SETTINGS, ImageUtil.SETTINGS_ACTIVE), - REGISTRATION("/io/bitsquare/gui/registration/RegistrationView.fxml"), - SETUP("/io/bitsquare/gui/setup/SetupView.fxml"), + ACCOUNT("/io/bitsquare/gui/account/AccountView.fxml", ImageUtil.ACCOUNT, ImageUtil.ACCOUNT_ACTIVE), + SETUP("/io/bitsquare/gui/account/setup/SetupView.fxml"), ORDER_BOOK("/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml"), CREATE_OFFER("/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml"), @@ -44,6 +44,13 @@ public enum NavigationItem { WITHDRAWAL("/io/bitsquare/gui/funds/withdrawal/WithdrawalView.fxml"), TRANSACTIONS("/io/bitsquare/gui/funds/transactions/TransactionsView.fxml"), + SEED_WORDS("/io/bitsquare/gui/account/seedwords/SeedWordsView.fxml"), + PASSWORD("/io/bitsquare/gui/account/password/PasswordView.fxml"), + RESTRICTIONS("/io/bitsquare/gui/account/restrictions/RestrictionsView.fxml"), + REGISTRATION("/io/bitsquare/gui/account/registration/RegistrationView.fxml"), + FIAT_ACCOUNT("/io/bitsquare/gui/account/fiataccount/FiatAccountView.fxml"), + + ARBITRATOR_PROFILE("/io/bitsquare/gui/arbitrators/profile/ArbitratorProfileView.fxml"), ARBITRATOR_BROWSER("/io/bitsquare/gui/arbitrators/browser/ArbitratorBrowserView.fxml"), ARBITRATOR_REGISTRATION("/io/bitsquare/gui/arbitrators/registration/ArbitratorRegistrationView.fxml"); diff --git a/src/main/java/io/bitsquare/gui/account/AccountCB.java b/src/main/java/io/bitsquare/gui/account/AccountCB.java new file mode 100644 index 0000000000..f9efa9830e --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/AccountCB.java @@ -0,0 +1,128 @@ +/* + * 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.account; + +import io.bitsquare.di.GuiceFXMLLoader; +import io.bitsquare.gui.CachedCodeBehind; +import io.bitsquare.gui.CodeBehind; +import io.bitsquare.gui.NavigationItem; +import io.bitsquare.gui.PresentationModel; +import io.bitsquare.gui.account.setup.SetupPM; + +import java.io.IOException; + +import java.net.URL; + +import java.util.ResourceBundle; + +import javax.inject.Inject; + +import javafx.event.ActionEvent; +import javafx.scene.control.*; +import javafx.scene.layout.*; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AccountCB extends CachedCodeBehind { + + private static final Logger log = LoggerFactory.getLogger(AccountCB.class); + public Button registrationButton; + public Label headLineLabel; + public Label titleLabel; + public Tab setupTab; + private Pane setupView; + + /////////////////////////////////////////////////////////////////////////////////////////// + // Constructor + /////////////////////////////////////////////////////////////////////////////////////////// + + @Inject + public AccountCB(SetupPM presentationModel) { + super(presentationModel); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Lifecycle + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public void initialize(URL url, ResourceBundle rb) { + super.initialize(url, rb); + + } + + @Override + public void activate() { + super.activate(); + } + + @Override + public void deactivate() { + super.deactivate(); + } + + @Override + public void terminate() { + super.terminate(); + } + + public void onRegister(ActionEvent actionEvent) { + loadViewAndGetChildController(NavigationItem.SETUP); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Public Methods + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public CodeBehind loadViewAndGetChildController(NavigationItem navigationItem) { + super.loadViewAndGetChildController(navigationItem); + + final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl())); + try { + setupView = loader.load(); + setupTab.setContent(setupView); + childController = loader.getController(); + + ((CodeBehind) childController).setParentController(this); + + } catch (IOException e) { + log.error("Loading view failed. FxmlUrl = " + NavigationItem.ACCOUNT.getFxmlUrl()); + log.error(e.getCause().toString()); + log.error(e.getMessage()); + log.error(e.getStackTrace().toString()); + } + + return null; + } + + /////////////////////////////////////////////////////////////////////////////////////////// + // UI handlers + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Private methods + /////////////////////////////////////////////////////////////////////////////////////////// + + +} + diff --git a/src/main/java/io/bitsquare/gui/account/AccountModel.java b/src/main/java/io/bitsquare/gui/account/AccountModel.java new file mode 100644 index 0000000000..4ed9abf1bf --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/AccountModel.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.gui.account; + +import io.bitsquare.gui.UIModel; + +import com.google.inject.Inject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AccountModel extends UIModel { + private static final Logger log = LoggerFactory.getLogger(AccountModel.class); + + /////////////////////////////////////////////////////////////////////////////////////////// + // Constructor + /////////////////////////////////////////////////////////////////////////////////////////// + + @Inject + public AccountModel() { + + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Public methods + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Interface implementation: Initializable + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Getters + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Setters + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Private methods + /////////////////////////////////////////////////////////////////////////////////////////// + + +} diff --git a/src/main/java/io/bitsquare/gui/account/AccountPm.java b/src/main/java/io/bitsquare/gui/account/AccountPm.java new file mode 100644 index 0000000000..aad29a4b98 --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/AccountPm.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.gui.account; + +import io.bitsquare.gui.PresentationModel; + +import com.google.inject.Inject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AccountPM extends PresentationModel { + private static final Logger log = LoggerFactory.getLogger(AccountPM.class); + + /////////////////////////////////////////////////////////////////////////////////////////// + // Constructor + /////////////////////////////////////////////////////////////////////////////////////////// + + @Inject + public AccountPM(AccountModel model) { + super(model); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Public methods + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Interface implementation: Initializable + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Getters + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Setters + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Private methods + /////////////////////////////////////////////////////////////////////////////////////////// + + +} diff --git a/src/main/java/io/bitsquare/gui/account/AccountView.fxml b/src/main/java/io/bitsquare/gui/account/AccountView.fxml new file mode 100644 index 0000000000..d2dc50163b --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/AccountView.fxml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/io/bitsquare/gui/account/password/PasswordCB.java b/src/main/java/io/bitsquare/gui/account/password/PasswordCB.java new file mode 100644 index 0000000000..d19c4d0787 --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/password/PasswordCB.java @@ -0,0 +1,113 @@ +/* + * 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.account.password; + +import io.bitsquare.gui.CachedCodeBehind; +import io.bitsquare.gui.account.setup.SetupCB; +import io.bitsquare.gui.help.Help; +import io.bitsquare.gui.help.HelpId; + +import java.net.URL; + +import java.util.ResourceBundle; + +import javax.inject.Inject; + +import javafx.fxml.FXML; +import javafx.scene.control.*; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PasswordCB extends CachedCodeBehind { + + private static final Logger log = LoggerFactory.getLogger(PasswordCB.class); + + @FXML private Button saveButton; + @FXML private PasswordField passwordField, repeatedPasswordField; + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Constructor + /////////////////////////////////////////////////////////////////////////////////////////// + + @Inject + public PasswordCB(PasswordPM presentationModel) { + super(presentationModel); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Lifecycle + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public void initialize(URL url, ResourceBundle rb) { + super.initialize(url, rb); + + passwordField.textProperty().bindBidirectional(presentationModel.passwordField); + repeatedPasswordField.textProperty().bindBidirectional(presentationModel.repeatedPasswordField); + + saveButton.disableProperty().bind(presentationModel.saveButtonDisabled); + } + + @Override + public void activate() { + super.activate(); + } + + @Override + public void deactivate() { + super.deactivate(); + } + + @Override + public void terminate() { + super.terminate(); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // UI handlers + /////////////////////////////////////////////////////////////////////////////////////////// + + @FXML + private void onSaved() { + boolean result = presentationModel.savePassword(); + if (result) + ((SetupCB) parentController).onCompleted(this); + else + log.debug(presentationModel.errorMessage); // TODO use validating TF + } + + @FXML + private void onOpenHelp() { + Help.openWindow(HelpId.SETUP_PASSWORD); + } + + public void onSkipped() { + ((SetupCB) parentController).onCompleted(this); + } + + /////////////////////////////////////////////////////////////////////////////////////////// + // Private methods + /////////////////////////////////////////////////////////////////////////////////////////// + + +} + diff --git a/src/main/java/io/bitsquare/gui/account/password/PasswordModel.java b/src/main/java/io/bitsquare/gui/account/password/PasswordModel.java new file mode 100644 index 0000000000..6e70129143 --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/password/PasswordModel.java @@ -0,0 +1,70 @@ +/* + * 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.account.password; + +import io.bitsquare.gui.UIModel; + +import com.google.inject.Inject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PasswordModel extends UIModel { + private static final Logger log = LoggerFactory.getLogger(PasswordModel.class); + + /////////////////////////////////////////////////////////////////////////////////////////// + // Constructor + /////////////////////////////////////////////////////////////////////////////////////////// + + @Inject + public PasswordModel() { + + } + + void savePassword(String password) { + + //TODO Implement password encryption for wallet + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Public methods + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Interface implementation: Initializable + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Getters + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Setters + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Private methods + /////////////////////////////////////////////////////////////////////////////////////////// + + +} diff --git a/src/main/java/io/bitsquare/gui/account/password/PasswordPm.java b/src/main/java/io/bitsquare/gui/account/password/PasswordPm.java new file mode 100644 index 0000000000..8f8cd5bacd --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/password/PasswordPm.java @@ -0,0 +1,93 @@ +/* + * 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.account.password; + +import io.bitsquare.gui.PresentationModel; +import io.bitsquare.gui.util.validation.InputValidator; +import io.bitsquare.gui.util.validation.PasswordValidator; + +import com.google.inject.Inject; + +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PasswordPM extends PresentationModel { + private static final Logger log = LoggerFactory.getLogger(PasswordPM.class); + + private PasswordValidator passwordValidator = new PasswordValidator(); + + String errorMessage; + StringProperty passwordField = new SimpleStringProperty(); + StringProperty repeatedPasswordField = new SimpleStringProperty(); + BooleanProperty saveButtonDisabled = new SimpleBooleanProperty(true); + + /////////////////////////////////////////////////////////////////////////////////////////// + // Constructor + /////////////////////////////////////////////////////////////////////////////////////////// + + @Inject + public PasswordPM(PasswordModel model) { + super(model); + + passwordField.addListener((ov) -> saveButtonDisabled.set(!validate())); + repeatedPasswordField.addListener((ov) -> saveButtonDisabled.set(!validate())); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Lifecycle + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public void initialized() { + super.initialized(); + } + + boolean savePassword() { + if (validate()) { + model.savePassword(passwordField.get()); + return true; + } + return false; + } + + boolean validate() { + InputValidator.ValidationResult result = passwordValidator.validate(passwordField.get()); + if (result.isValid) { + result = passwordValidator.validate(repeatedPasswordField.get()); + if (result.isValid) { + if (passwordField.get().equals(repeatedPasswordField.get())) + return true; + else + errorMessage = "The 2 passwords does not match."; + } + else { + errorMessage = result.errorMessage; + } + } + else { + errorMessage = result.errorMessage; + } + return false; + } +} diff --git a/src/main/java/io/bitsquare/gui/account/password/PasswordView.fxml b/src/main/java/io/bitsquare/gui/account/password/PasswordView.fxml new file mode 100644 index 0000000000..a11544c412 --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/password/PasswordView.fxml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/io/bitsquare/gui/account/restrictions/RestrictionsCB.java b/src/main/java/io/bitsquare/gui/account/restrictions/RestrictionsCB.java new file mode 100644 index 0000000000..9ed605495d --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/restrictions/RestrictionsCB.java @@ -0,0 +1,398 @@ +/* + * 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.account.restrictions; + +import io.bitsquare.BitSquare; +import io.bitsquare.arbitrator.Arbitrator; +import io.bitsquare.di.GuiceFXMLLoader; +import io.bitsquare.gui.CachedCodeBehind; +import io.bitsquare.gui.NavigationItem; +import io.bitsquare.gui.account.setup.SetupCB; +import io.bitsquare.gui.help.Help; +import io.bitsquare.gui.help.HelpId; +import io.bitsquare.gui.util.ImageUtil; +import io.bitsquare.locale.Country; +import io.bitsquare.locale.Region; + +import java.io.IOException; + +import java.net.URL; + +import java.util.Locale; +import java.util.ResourceBundle; + +import javax.inject.Inject; + +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.geometry.Pos; +import javafx.scene.*; +import javafx.scene.control.*; +import javafx.scene.image.*; +import javafx.scene.layout.*; +import javafx.stage.Modality; +import javafx.stage.Stage; +import javafx.util.Callback; +import javafx.util.StringConverter; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RestrictionsCB extends CachedCodeBehind { + + private static final Logger log = LoggerFactory.getLogger(RestrictionsCB.class); + + @FXML private ListView languagesListView, countriesListView, arbitratorsListView; + @FXML private ComboBox languageComboBox; + @FXML private ComboBox regionComboBox; + @FXML private ComboBox countryComboBox; + @FXML private Button doneButton, addAllEuroCountriesButton; + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Constructor + /////////////////////////////////////////////////////////////////////////////////////////// + + @Inject + public RestrictionsCB(RestrictionsPM presentationModel) { + super(presentationModel); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Lifecycle + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public void initialize(URL url, ResourceBundle rb) { + super.initialize(url, rb); + + initLanguage(); + initCountry(); + initArbitrators(); + + doneButton.disableProperty().bind(presentationModel.doneButtonDisabled); + } + + @Override + public void activate() { + super.activate(); + + languagesListView.setItems(presentationModel.getLanguageList()); + countriesListView.setItems(presentationModel.getCountryList()); + arbitratorsListView.setItems(presentationModel.getArbitratorList()); + } + + @Override + public void deactivate() { + super.deactivate(); + } + + @Override + public void terminate() { + super.terminate(); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // UI handlers + /////////////////////////////////////////////////////////////////////////////////////////// + + @FXML + private void onAddLanguage() { + presentationModel.onAddLanguage(languageComboBox.getSelectionModel().getSelectedItem()); + languageComboBox.getSelectionModel().clearSelection(); + } + + @FXML + private void onSelectRegion() { + countryComboBox.setVisible(true); + Region region = regionComboBox.getSelectionModel().getSelectedItem(); + countryComboBox.setItems(presentationModel.getAllCountriesFor(region)); + + addAllEuroCountriesButton.setVisible(region.getCode().equals("EU")); + } + + @FXML + private void onAddCountry() { + presentationModel.onAddCountry(countryComboBox.getSelectionModel().getSelectedItem()); + countryComboBox.getSelectionModel().clearSelection(); + } + + @FXML + private void onAddAllEuroCountries() { + countriesListView.setItems(presentationModel.getListWithAllEuroCountries()); + } + + @FXML + private void onOpenArbitratorScreen() { + loadViewAndGetChildController(NavigationItem.ARBITRATOR_BROWSER); + } + + + @FXML + private void onDone() { + ((SetupCB) parentController).onCompleted(this); + } + + @FXML + private void onOpenLanguagesHelp() { + Help.openWindow(HelpId.SETUP_RESTRICTION_LANGUAGES); + } + + @FXML + private void onOpenCountriesHelp() { + Help.openWindow(HelpId.SETUP_RESTRICTION_COUNTRIES); + } + + @FXML + private void onOpenArbitratorsHelp() { + Help.openWindow(HelpId.SETUP_RESTRICTION_ARBITRATORS); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Navigation + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public Initializable loadViewAndGetChildController(NavigationItem navigationItem) { + // TODO caching causes exception + final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()), false); + try { + final Node view = loader.load(); + //TODO Resolve type problem... + Initializable childController = loader.getController(); + //childController.setParentController(this); + + final Stage rootStage = BitSquare.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 == NavigationItem.ARBITRATOR_BROWSER) + updateArbitratorList(); + }); + stage.show(); + + return childController; + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Private methods + /////////////////////////////////////////////////////////////////////////////////////////// + + void updateArbitratorList() { + presentationModel.updateArbitratorList(); + arbitratorsListView.setItems(presentationModel.getArbitratorList()); + } + + private void initLanguage() { + languagesListView.setCellFactory(new Callback, ListCell>() { + @Override + public ListCell call(ListView list) { + return new ListCell() { + final HBox hBox = new HBox(); + final Label label = new Label(); + final Button removeButton = new Button(); + final ImageView icon = ImageUtil.getIconImageView(ImageUtil.REMOVE); + + { + label.setPrefWidth(395); + icon.setMouseTransparent(true); + removeButton.setGraphic(icon); + removeButton.setId("icon-button"); + hBox.setSpacing(3); + hBox.setAlignment(Pos.CENTER_LEFT); + hBox.getChildren().addAll(label, removeButton); + } + + @Override + public void updateItem(final Locale item, boolean empty) { + super.updateItem(item, empty); + if (item != null && !empty) { + label.setText(item.getDisplayName()); + removeButton.setOnAction(actionEvent -> removeLanguage(item)); + setGraphic(hBox); + } + else { + setGraphic(null); + } + } + }; + } + }); + + languageComboBox.setItems(presentationModel.getAllLanguages()); + languageComboBox.setConverter(new StringConverter() { + @Override + public String toString(Locale locale) { + return locale.getDisplayLanguage(); + } + + @Override + public Locale fromString(String s) { + return null; + } + }); + } + + private void initCountry() { + regionComboBox.setItems(presentationModel.getAllRegions()); + regionComboBox.setConverter(new StringConverter() { + @Override + public String toString(io.bitsquare.locale.Region region) { + return region.getName(); + } + + @Override + public io.bitsquare.locale.Region fromString(String s) { + return null; + } + }); + + countriesListView.setCellFactory(new Callback, ListCell>() { + @Override + public ListCell call(ListView list) { + return new ListCell() { + final HBox hBox = new HBox(); + final Label label = new Label(); + final Button removeButton = new Button(); + final ImageView icon = ImageUtil.getIconImageView(ImageUtil.REMOVE); + + { + label.setPrefWidth(395); + icon.setMouseTransparent(true); + removeButton.setGraphic(icon); + removeButton.setId("icon-button"); + hBox.setSpacing(3); + hBox.setAlignment(Pos.CENTER_LEFT); + hBox.getChildren().addAll(label, removeButton); + } + + @Override + public void updateItem(final Country item, boolean empty) { + super.updateItem(item, empty); + if (item != null && !empty) { + label.setText(item.getName()); + removeButton.setOnAction(actionEvent -> removeCountry(item)); + setGraphic(hBox); + } + else { + setGraphic(null); + } + } + }; + } + }); + + countryComboBox.setConverter(new StringConverter() { + @Override + public String toString(Country country) { + return country.getName(); + } + + @Override + public Country fromString(String s) { + return null; + } + }); + } + + private void initArbitrators() { + arbitratorsListView.setCellFactory(new Callback, ListCell>() { + @Override + public ListCell call(ListView list) { + return new ListCell() { + final HBox hBox = new HBox(); + final Label label = new Label(); + final Button removeButton = new Button(); + final ImageView icon = ImageUtil.getIconImageView(ImageUtil.REMOVE); + + { + label.setPrefWidth(395); + icon.setMouseTransparent(true); + removeButton.setGraphic(icon); + removeButton.setId("icon-button"); + hBox.setSpacing(3); + hBox.setAlignment(Pos.CENTER_LEFT); + hBox.getChildren().addAll(label, removeButton); + } + + @Override + public void updateItem(final Arbitrator item, boolean empty) { + super.updateItem(item, empty); + if (item != null && !empty) { + label.setText(item.getName()); + removeButton.setOnAction(actionEvent -> removeArbitrator(item)); + setGraphic(hBox); + } + else { + setGraphic(null); + } + } + }; + } + }); + } + + private void removeLanguage(Locale locale) { + presentationModel.removeLanguage(locale); + } + + private void removeCountry(Country country) { + presentationModel.removeCountry(country); + } + + private void removeArbitrator(Arbitrator arbitrator) { + presentationModel.removeArbitrator(arbitrator); + } + + + + /* private void addCountry(Country country) { + if (!countryList.contains(country) && country != null) { + countryList.add(country); + settings.addAcceptedCountry(country); + saveSettings(); + } + }*/ + + /* private void addLanguage(Locale locale) { + if (locale != null && !languageList.contains(locale)) { + languageList.add(locale); + settings.addAcceptedLanguageLocale(locale); + } + }*/ + +} + diff --git a/src/main/java/io/bitsquare/gui/account/restrictions/RestrictionsModel.java b/src/main/java/io/bitsquare/gui/account/restrictions/RestrictionsModel.java new file mode 100644 index 0000000000..1c8b04a21e --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/restrictions/RestrictionsModel.java @@ -0,0 +1,225 @@ +/* + * 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.account.restrictions; + +import io.bitsquare.arbitrator.Arbitrator; +import io.bitsquare.arbitrator.Reputation; +import io.bitsquare.gui.UIModel; +import io.bitsquare.locale.Country; +import io.bitsquare.locale.CountryUtil; +import io.bitsquare.locale.LanguageUtil; +import io.bitsquare.locale.Region; +import io.bitsquare.msg.MessageFacade; +import io.bitsquare.persistence.Persistence; +import io.bitsquare.settings.Settings; +import io.bitsquare.user.User; +import io.bitsquare.util.DSAKeyUtil; + +import com.google.bitcoin.core.ECKey; +import com.google.bitcoin.core.Utils; + +import com.google.inject.Inject; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RestrictionsModel extends UIModel { + private static final Logger log = LoggerFactory.getLogger(RestrictionsModel.class); + + private final User user; + private final Settings settings; + private final Persistence persistence; + private final MessageFacade messageFacade; + + ObservableList languageList; + ObservableList countryList; + ObservableList arbitratorList; + + ObservableList allLanguages = FXCollections.observableArrayList(LanguageUtil.getAllLanguageLocales()); + ObservableList allRegions = FXCollections.observableArrayList(CountryUtil.getAllRegions()); + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Constructor + /////////////////////////////////////////////////////////////////////////////////////////// + + @Inject + public RestrictionsModel(User user, Settings settings, Persistence persistence, MessageFacade messageFacade) { + this.user = user; + this.settings = settings; + this.persistence = persistence; + this.messageFacade = messageFacade; + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Lifecycle + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public void initialized() { + super.initialized(); + + Settings persistedSettings = (Settings) persistence.read(settings); + if (persistedSettings != null) { + settings.applyPersistedSettings(persistedSettings); + } + else { + languageList = FXCollections.observableArrayList(new ArrayList<>()); + countryList = FXCollections.observableArrayList(new ArrayList<>()); + arbitratorList = FXCollections.observableArrayList(new ArrayList<>()); + + if (Locale.getDefault() != null) { + addLanguage(LanguageUtil.getDefaultLanguageLocale()); + addCountry(CountryUtil.getDefaultCountry()); + } + + // Add english as default as well + addLanguage(LanguageUtil.getEnglishLanguageLocale()); + } + + addMockArbitrator(); + } + + @Override + public void activate() { + super.activate(); + + languageList = FXCollections.observableArrayList(settings.getAcceptedLanguageLocales()); + countryList = FXCollections.observableArrayList(settings.getAcceptedCountries()); + arbitratorList = FXCollections.observableArrayList(settings.getAcceptedArbitrators()); + } + + @Override + public void deactivate() { + super.deactivate(); + } + + + @Override + public void terminate() { + super.terminate(); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Package scope + /////////////////////////////////////////////////////////////////////////////////////////// + + ObservableList getAllCountriesFor(Region selectedRegion) { + return FXCollections.observableArrayList(CountryUtil.getAllCountriesFor(selectedRegion)); + } + + void updateArbitratorList() { + arbitratorList = FXCollections.observableArrayList(settings.getAcceptedArbitrators()); + } + + void addLanguage(Locale locale) { + if (locale != null && !languageList.contains(locale)) { + languageList.add(locale); + settings.addAcceptedLanguageLocale(locale); + } + } + + void removeLanguage(Locale locale) { + languageList.remove(locale); + settings.removeAcceptedLanguageLocale(locale); + saveSettings(); + } + + void addCountry(Country country) { + if (!countryList.contains(country) && country != null) { + countryList.add(country); + settings.addAcceptedCountry(country); + saveSettings(); + } + } + + ObservableList getListWithAllEuroCountries() { + // TODO use Set instead of List + // In addAcceptedCountry there is a check to no add duplicates, so it works correctly for now + CountryUtil.getAllEuroCountries().stream().forEach(e -> settings.addAcceptedCountry(e)); + countryList = FXCollections.observableArrayList(settings.getAcceptedCountries()); + saveSettings(); + return countryList; + } + + void removeCountry(Country country) { + countryList.remove(country); + settings.removeAcceptedCountry(country); + saveSettings(); + } + + void removeArbitrator(Arbitrator arbitrator) { + arbitratorList.remove(arbitrator); + settings.removeAcceptedArbitrator(arbitrator); + saveSettings(); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Private + /////////////////////////////////////////////////////////////////////////////////////////// + + private void saveSettings() { + persistence.write(settings); + } + + private void addMockArbitrator() { + if (settings.getAcceptedArbitrators().isEmpty() && user.getMessageKeyPair() != null) { + String pubKeyAsHex = Utils.HEX.encode(new ECKey().getPubKey()); + String messagePubKeyAsHex = DSAKeyUtil.getHexStringFromPublicKey(user.getMessagePublicKey()); + List languages = new ArrayList<>(); + languages.add(LanguageUtil.getDefaultLanguageLocale()); + List arbitrationMethods = new ArrayList<>(); + arbitrationMethods.add(Arbitrator.METHOD.TLS_NOTARY); + List idVerifications = new ArrayList<>(); + idVerifications.add(Arbitrator.ID_VERIFICATION.PASSPORT); + idVerifications.add(Arbitrator.ID_VERIFICATION.GOV_ID); + + Arbitrator arbitrator = new Arbitrator(pubKeyAsHex, + messagePubKeyAsHex, + "Manfred Karrer", + Arbitrator.ID_TYPE.REAL_LIFE_ID, + languages, + new Reputation(), + 1, + 0.01, + 0.001, + 10, + 0.1, + arbitrationMethods, + idVerifications, + "http://bitsquare.io/", + "Bla bla..."); + + arbitratorList.add(arbitrator); + settings.addAcceptedArbitrator(arbitrator); + persistence.write(settings); + + messageFacade.addArbitrator(arbitrator); + } + } +} diff --git a/src/main/java/io/bitsquare/gui/account/restrictions/RestrictionsView.fxml b/src/main/java/io/bitsquare/gui/account/restrictions/RestrictionsView.fxml new file mode 100644 index 0000000000..d64e12f7db --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/restrictions/RestrictionsView.fxml @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/io/bitsquare/gui/account/seedwords/SeedWordsCB.java b/src/main/java/io/bitsquare/gui/account/seedwords/SeedWordsCB.java new file mode 100644 index 0000000000..ea8facb5cc --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/seedwords/SeedWordsCB.java @@ -0,0 +1,94 @@ +/* + * 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.account.seedwords; + +import io.bitsquare.gui.CachedCodeBehind; +import io.bitsquare.gui.account.setup.SetupCB; +import io.bitsquare.gui.help.Help; +import io.bitsquare.gui.help.HelpId; + +import java.net.URL; + +import java.util.ResourceBundle; + +import javax.inject.Inject; + +import javafx.fxml.FXML; +import javafx.scene.control.*; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SeedWordsCB extends CachedCodeBehind { + + private static final Logger log = LoggerFactory.getLogger(SeedWordsCB.class); + + @FXML private TextArea seedWordsTextArea; + + /////////////////////////////////////////////////////////////////////////////////////////// + // Constructor + /////////////////////////////////////////////////////////////////////////////////////////// + + @Inject + public SeedWordsCB(SeedWordsPM presentationModel) { + super(presentationModel); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Lifecycle + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public void initialize(URL url, ResourceBundle rb) { + super.initialize(url, rb); + + seedWordsTextArea.setText(presentationModel.seedWords.get()); + } + + @Override + public void activate() { + super.activate(); + } + + @Override + public void deactivate() { + super.deactivate(); + } + + @Override + public void terminate() { + super.terminate(); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // UI handlers + /////////////////////////////////////////////////////////////////////////////////////////// + + @FXML + private void onDone() { + ((SetupCB) parentController).onCompleted(this); + } + + @FXML + private void onOpenHelp() { + Help.openWindow(HelpId.SETUP_SEED_WORDS); + } +} + diff --git a/src/main/java/io/bitsquare/gui/account/seedwords/SeedWordsModel.java b/src/main/java/io/bitsquare/gui/account/seedwords/SeedWordsModel.java new file mode 100644 index 0000000000..9d9eea61ab --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/seedwords/SeedWordsModel.java @@ -0,0 +1,46 @@ +/* + * 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.account.seedwords; + +import io.bitsquare.btc.WalletFacade; +import io.bitsquare.gui.UIModel; + +import com.google.inject.Inject; + +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SeedWordsModel extends UIModel { + private static final Logger log = LoggerFactory.getLogger(SeedWordsModel.class); + + List mnemonicCode; + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Constructor + /////////////////////////////////////////////////////////////////////////////////////////// + + @Inject + public SeedWordsModel(WalletFacade walletFacade) { + if (walletFacade != null && walletFacade.getWallet() != null) + mnemonicCode = walletFacade.getWallet().getKeyChainSeed().getMnemonicCode(); + } + +} diff --git a/src/main/java/io/bitsquare/gui/account/seedwords/SeedWordsPm.java b/src/main/java/io/bitsquare/gui/account/seedwords/SeedWordsPm.java new file mode 100644 index 0000000000..8ad07f8ebf --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/seedwords/SeedWordsPm.java @@ -0,0 +1,59 @@ +/* + * 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.account.seedwords; + +import io.bitsquare.gui.PresentationModel; +import io.bitsquare.gui.util.BSFormatter; + +import com.google.inject.Inject; + +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SeedWordsPM extends PresentationModel { + private static final Logger log = LoggerFactory.getLogger(SeedWordsPM.class); + + StringProperty seedWords = new SimpleStringProperty(); + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Constructor + /////////////////////////////////////////////////////////////////////////////////////////// + + @Inject + public SeedWordsPM(SeedWordsModel model) { + super(model); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Lifecycle + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public void initialized() { + super.initialized(); + + if (model.mnemonicCode != null) + seedWords.set(BSFormatter.mnemonicCodeToString(model.mnemonicCode)); + } + +} diff --git a/src/main/java/io/bitsquare/gui/account/seedwords/SeedWordsView.fxml b/src/main/java/io/bitsquare/gui/account/seedwords/SeedWordsView.fxml new file mode 100644 index 0000000000..78fa04ae38 --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/seedwords/SeedWordsView.fxml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/io/bitsquare/gui/account/setup/SetupCB.java b/src/main/java/io/bitsquare/gui/account/setup/SetupCB.java new file mode 100644 index 0000000000..5e56281a61 --- /dev/null +++ b/src/main/java/io/bitsquare/gui/account/setup/SetupCB.java @@ -0,0 +1,251 @@ +/* + * 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.account.setup; + +import io.bitsquare.di.GuiceFXMLLoader; +import io.bitsquare.gui.CachedCodeBehind; +import io.bitsquare.gui.CodeBehind; +import io.bitsquare.gui.NavigationItem; +import io.bitsquare.gui.PresentationModel; +import io.bitsquare.gui.account.fiataccount.FiatAccountCB; +import io.bitsquare.gui.account.password.PasswordCB; +import io.bitsquare.gui.account.registration.RegistrationCB; +import io.bitsquare.gui.account.restrictions.RestrictionsCB; +import io.bitsquare.gui.account.seedwords.SeedWordsCB; +import io.bitsquare.gui.util.ImageUtil; + +import java.io.IOException; + +import java.net.URL; + +import java.util.ResourceBundle; + +import javax.inject.Inject; + +import javafx.geometry.Insets; +import javafx.scene.*; +import javafx.scene.control.*; +import javafx.scene.image.*; +import javafx.scene.layout.*; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SetupCB extends CachedCodeBehind { + + private static final Logger log = LoggerFactory.getLogger(SetupCB.class); + public VBox leftVBox; + public AnchorPane content; + private WizardItem seedWords, password, fiatAccount, restrictions, registration; + + /////////////////////////////////////////////////////////////////////////////////////////// + // Constructor + /////////////////////////////////////////////////////////////////////////////////////////// + + @Inject + public SetupCB(SetupPM presentationModel) { + super(presentationModel); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Lifecycle + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public void initialize(URL url, ResourceBundle rb) { + super.initialize(url, rb); + + seedWords = new WizardItem(this, content, "Backup wallet seed", "Write down the seed word for your wallet", + NavigationItem.SEED_WORDS); + password = new WizardItem(this, content, "Setup password", "Protect your wallet with a password", + NavigationItem.PASSWORD); + restrictions = new WizardItem(this, content, "Setup your preferences", + "You need to setup your preferences used for trade restrictions", + NavigationItem.RESTRICTIONS); + fiatAccount = new WizardItem(this, content, " Setup Bank account", + "You need to add the bank account details to your trading account", + NavigationItem.FIAT_ACCOUNT); + registration = new WizardItem(this, root, "Register your account", + "Pay in the registration fee of 0.0002 BTC and store your account in the BTC block chain", + NavigationItem.REGISTRATION); + + leftVBox.getChildren().addAll(seedWords, password, restrictions, fiatAccount, registration); + + childController = seedWords.show(NavigationItem.SEED_WORDS); + } + + @Override + public void activate() { + super.activate(); + } + + @Override + public void deactivate() { + super.deactivate(); + } + + @Override + public void terminate() { + super.terminate(); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // UI handlers + /////////////////////////////////////////////////////////////////////////////////////////// + + + public void onCompleted(CodeBehind childView) { + if (childView instanceof SeedWordsCB) { + seedWords.onCompleted(); + childController = password.show(NavigationItem.PASSWORD); + } + else if (childView instanceof PasswordCB) { + password.onCompleted(); + childController = restrictions.show(NavigationItem.RESTRICTIONS); + } + else if (childView instanceof RestrictionsCB) { + restrictions.onCompleted(); + childController = fiatAccount.show(NavigationItem.FIAT_ACCOUNT); + } + else if (childView instanceof FiatAccountCB) { + fiatAccount.onCompleted(); + childController = registration.show(NavigationItem.REGISTRATION); + } + else if (childView instanceof RegistrationCB) { + registration.onCompleted(); + childController = null; + } + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Public Methods + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // UI handlers + /////////////////////////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Private methods + /////////////////////////////////////////////////////////////////////////////////////////// +} + +class WizardItem extends HBox { + + private static final Logger log = LoggerFactory.getLogger(WizardItem.class); + + private final ImageView imageView; + private final Label titleLabel; + private final Label subTitleLabel; + private SetupCB parentCB; + private Parent content; + + + private CodeBehind childController; + + WizardItem(SetupCB parentCB, Parent content, String title, String subTitle, NavigationItem navigationItem) { + this.parentCB = parentCB; + this.content = content; + setId("wizard-item-background-deactivated"); + layout(); + setSpacing(5); + setPrefWidth(200); + + imageView = ImageUtil.getIconImageView(ImageUtil.ARROW_GREY); + imageView.setFitHeight(15); + imageView.setFitWidth(20); + imageView.setPickOnBounds(true); + imageView.setMouseTransparent(true); + HBox.setMargin(imageView, new Insets(8, 0, 0, 8)); + + final VBox vBox = new VBox(); + vBox.setSpacing(1); + HBox.setMargin(vBox, new Insets(5, 0, 8, 0)); + vBox.setMouseTransparent(true); + + titleLabel = new Label(title); + titleLabel.setId("wizard-title-deactivated"); + titleLabel.setLayoutX(7); + titleLabel.setMouseTransparent(true); + + subTitleLabel = new Label(subTitle); + subTitleLabel.setId("wizard-sub-title-deactivated"); + subTitleLabel.setLayoutX(40); + subTitleLabel.setLayoutY(33); + subTitleLabel.setMaxWidth(250); + subTitleLabel.setWrapText(true); + subTitleLabel.setMouseTransparent(true); + + vBox.getChildren().addAll(titleLabel, subTitleLabel); + getChildren().addAll(imageView, vBox); + } + + public CodeBehind show(NavigationItem navigationItem) { + loadView(navigationItem); + setId("wizard-item-background-active"); + imageView.setImage(ImageUtil.getIconImage(ImageUtil.ARROW_BLUE)); + titleLabel.setId("wizard-title-active"); + subTitleLabel.setId("wizard-sub-title-active"); + return childController; + } + + public void onCompleted() { + setId("wizard-item-background-completed"); + imageView.setImage(ImageUtil.getIconImage(ImageUtil.TICK)); + titleLabel.setId("wizard-title-completed"); + subTitleLabel.setId("wizard-sub-title-completed"); + } + + public CodeBehind getChildController() { + return childController; + } + + public ImageView getImageView() { + return imageView; + } + + public Label getTitleLabel() { + return titleLabel; + } + + public Label getSubTitleLabel() { + return subTitleLabel; + } + + private void loadView(NavigationItem navigationItem) { + final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl())); + try { + final Pane view = loader.load(); + ((AnchorPane) content).getChildren().setAll(view); + childController = loader.getController(); + childController.setParentController(parentCB); + } catch (IOException e) { + log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl()); + // log.error(e.getCause().toString()); + log.error(e.getMessage()); + log.error(e.getStackTrace().toString()); + } + + } +} + diff --git a/src/main/java/io/bitsquare/gui/setup/SetupModel.java b/src/main/java/io/bitsquare/gui/account/setup/SetupModel.java similarity index 98% rename from src/main/java/io/bitsquare/gui/setup/SetupModel.java rename to src/main/java/io/bitsquare/gui/account/setup/SetupModel.java index e557a749af..aa487dc70e 100644 --- a/src/main/java/io/bitsquare/gui/setup/SetupModel.java +++ b/src/main/java/io/bitsquare/gui/account/setup/SetupModel.java @@ -15,7 +15,7 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.setup; +package io.bitsquare.gui.account.setup; import io.bitsquare.gui.UIModel; diff --git a/src/main/java/io/bitsquare/gui/setup/SetupPm.java b/src/main/java/io/bitsquare/gui/account/setup/SetupPm.java similarity index 93% rename from src/main/java/io/bitsquare/gui/setup/SetupPm.java rename to src/main/java/io/bitsquare/gui/account/setup/SetupPm.java index e474ee1d23..225c0ec59b 100644 --- a/src/main/java/io/bitsquare/gui/setup/SetupPm.java +++ b/src/main/java/io/bitsquare/gui/account/setup/SetupPm.java @@ -15,7 +15,7 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.setup; +package io.bitsquare.gui.account.setup; import io.bitsquare.gui.PresentationModel; @@ -24,15 +24,15 @@ import com.google.inject.Inject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class SetupPm extends PresentationModel { - private static final Logger log = LoggerFactory.getLogger(SetupPm.class); +public class SetupPM extends PresentationModel { + private static final Logger log = LoggerFactory.getLogger(SetupPM.class); /////////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public SetupPm(SetupModel model) { + public SetupPM(SetupModel model) { super(model); } diff --git a/src/main/java/io/bitsquare/gui/registration/RegistrationView.fxml b/src/main/java/io/bitsquare/gui/account/setup/SetupView.fxml similarity index 65% rename from src/main/java/io/bitsquare/gui/registration/RegistrationView.fxml rename to src/main/java/io/bitsquare/gui/account/setup/SetupView.fxml index f34db48d12..3f296830ad 100644 --- a/src/main/java/io/bitsquare/gui/registration/RegistrationView.fxml +++ b/src/main/java/io/bitsquare/gui/account/setup/SetupView.fxml @@ -17,16 +17,15 @@ ~ along with Bitsquare. If not, see . --> - + - - - + + diff --git a/src/main/java/io/bitsquare/gui/bitsquare.css b/src/main/java/io/bitsquare/gui/bitsquare.css index d8f977302d..e02aa59fed 100644 --- a/src/main/java/io/bitsquare/gui/bitsquare.css +++ b/src/main/java/io/bitsquare/gui/bitsquare.css @@ -7,9 +7,17 @@ dark grey: #333333 main bg grey: dddddd content bg grey: f4f4f4 +tab pane upper bg gradient color mid dark grey to bright grey: cfcfcf -> dddddd */ +/* Account */ + +#content-pane-top { + -fx-background-color: linear-gradient(to bottom, #cfcfcf, #dddddd); +} + + /* Create offer */ #direction-icon-label { -fx-font-weight:bold; @@ -98,11 +106,6 @@ content bg grey: f4f4f4 -fx-background-radius: 3px, 3px, 2px, 1px; } -#wizard-item-background-active:hover { - -fx-body-color: linear-gradient(to bottom, #d2e2e6, #dfe9eb); - -fx-cursor: hand; -} - #wizard-item-background-completed { -fx-body-color: linear-gradient(to bottom, #f4f4f4, #F0F0F0); -fx-outer-border: linear-gradient(to bottom, #99ba9c, #619865); @@ -121,13 +124,13 @@ content bg grey: f4f4f4 -fx-background-color: #ffffff; } -/* Mmain UI */ +/* Main UI */ #logo-sub-title-label { -fx-font-weight: bold; -fx-font-size: 24; } -#main-view { +#base-content-container { -fx-background-color: #dddddd; } @@ -153,10 +156,19 @@ content bg grey: f4f4f4 } /* main nav */ + #nav-button { -fx-cursor: hand; -fx-background-color: transparent; - -fx-alignment: center; +} + +#nav-button .text { + -fx-font-size: 10; +} + +#nav-button:selected .text { + -fx-font-size: 11; + -fx-font-weight: bold; } #nav-alert-button { @@ -166,8 +178,7 @@ content bg grey: f4f4f4 } #nav-button-label { - -fx-font-size: 10; - -fx-alignment: center; + -fx-font-size: 10; } #nav-balance-label { diff --git a/src/main/java/io/bitsquare/gui/help/HelpId.java b/src/main/java/io/bitsquare/gui/help/HelpId.java index bba5d42ebc..6660d12df6 100644 --- a/src/main/java/io/bitsquare/gui/help/HelpId.java +++ b/src/main/java/io/bitsquare/gui/help/HelpId.java @@ -20,5 +20,12 @@ package io.bitsquare.gui.help; public enum HelpId { CREATE_OFFER_GENERAL, CREATE_OFFER_FUNDING, - CREATE_OFFER_ADVANCED + CREATE_OFFER_ADVANCED, + SETUP_SEED_WORDS, + SETUP_PASSWORD, + SETUP_RESTRICTION_LANGUAGES, + SETUP_RESTRICTION_COUNTRIES, + SETUP_RESTRICTION_ARBITRATORS, + SETUP_REGISTRATION + } diff --git a/src/main/java/io/bitsquare/gui/orders/offer/OfferView.fxml b/src/main/java/io/bitsquare/gui/orders/offer/OfferView.fxml index 3e055e9dfa..5c6f0485f2 100644 --- a/src/main/java/io/bitsquare/gui/orders/offer/OfferView.fxml +++ b/src/main/java/io/bitsquare/gui/orders/offer/OfferView.fxml @@ -40,7 +40,7 @@ - + @@ -50,7 +50,7 @@ - + diff --git a/src/main/java/io/bitsquare/gui/orders/pending/PendingTradeView.fxml b/src/main/java/io/bitsquare/gui/orders/pending/PendingTradeView.fxml index e35c441c26..9da07ccbb1 100644 --- a/src/main/java/io/bitsquare/gui/orders/pending/PendingTradeView.fxml +++ b/src/main/java/io/bitsquare/gui/orders/pending/PendingTradeView.fxml @@ -28,7 +28,7 @@ xmlns:fx="http://javafx.com/fxml"> - + @@ -38,7 +38,7 @@ - + diff --git a/src/main/java/io/bitsquare/gui/setup/SetupView.fxml b/src/main/java/io/bitsquare/gui/setup/SetupView.fxml deleted file mode 100644 index 39a6231305..0000000000 --- a/src/main/java/io/bitsquare/gui/setup/SetupView.fxml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/io/bitsquare/gui/trade/TradeController.java b/src/main/java/io/bitsquare/gui/trade/TradeController.java index d660399f69..d6aa5d44f5 100644 --- a/src/main/java/io/bitsquare/gui/trade/TradeController.java +++ b/src/main/java/io/bitsquare/gui/trade/TradeController.java @@ -134,7 +134,6 @@ public class TradeController extends CachedViewController { try { createOfferView = loader.load(); createOfferCodeBehind = loader.getController(); - log.debug("####### loader.getController() " + createOfferCodeBehind); createOfferCodeBehind.setParentController(this); final Tab tab = new Tab("Create offer"); tab.setContent(createOfferView); diff --git a/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferCB.java b/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferCB.java index dd557590fd..65cc5d3920 100644 --- a/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferCB.java +++ b/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferCB.java @@ -120,6 +120,7 @@ public class CreateOfferCB extends CachedCodeBehind { setupListeners(); setupBindings(); balanceTextField.setup(presentationModel.getWalletFacade(), presentationModel.address.get()); + volumeTextField.setPromptText(BSResources.get("createOffer.volume.prompt", presentationModel.fiatCode.get())); } @SuppressWarnings("EmptyMethod") diff --git a/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml b/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml index f1e1d9b23d..ae2d568a88 100644 --- a/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml +++ b/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml @@ -51,7 +51,7 @@ @@ -68,7 +68,7 @@ @@ -130,8 +130,7 @@ + prefWidth="170" alignment="CENTER_RIGHT"/> @@ -213,7 +212,7 @@ focusTraversable="true" visible="false"/> @@ -304,7 +303,7 @@ diff --git a/src/main/java/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml b/src/main/java/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml index 85ce0d8c9f..b65868dd86 100644 --- a/src/main/java/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml +++ b/src/main/java/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml @@ -61,7 +61,7 @@ - + @@ -71,7 +71,7 @@ - + diff --git a/src/main/java/io/bitsquare/gui/trade/takeoffer/TakeOfferController.java b/src/main/java/io/bitsquare/gui/trade/takeoffer/TakeOfferController.java index 516e516056..5b4a3394fd 100644 --- a/src/main/java/io/bitsquare/gui/trade/takeoffer/TakeOfferController.java +++ b/src/main/java/io/bitsquare/gui/trade/takeoffer/TakeOfferController.java @@ -181,7 +181,7 @@ public class TakeOfferController extends CachedViewController { accordion.setExpandedPane(waitBankTxTitledPane); infoLabel.setText("Deposit transaction published by offerer.\n" + "As soon as the offerer starts the \n" + - "Bank transfer, you will get informed."); + "Bank transfer, you will be informed."); depositTxIdTextField.setText(depositTxId); } diff --git a/src/main/java/io/bitsquare/gui/trade/takeoffer/TakeOfferView.fxml b/src/main/java/io/bitsquare/gui/trade/takeoffer/TakeOfferView.fxml index 70747737aa..6def44d4e3 100644 --- a/src/main/java/io/bitsquare/gui/trade/takeoffer/TakeOfferView.fxml +++ b/src/main/java/io/bitsquare/gui/trade/takeoffer/TakeOfferView.fxml @@ -36,14 +36,14 @@