Add setup process UIs. Improve navigation UI.
|
@ -48,7 +48,7 @@ public class CachedCodeBehind<T extends PresentationModel> extends CodeBehind<T>
|
|||
*/
|
||||
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<T extends PresentationModel> extends CodeBehind<T>
|
|||
*/
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -20,8 +20,10 @@ public class CodeBehind<T extends PresentationModel> 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<? extends PresentationModel> when all UIs are updated
|
||||
protected Initializable childController;
|
||||
//TODO Initializable has to be changed to CodeBehind<? extends PresentationModel> when all UIs are updated
|
||||
protected Initializable parentController;
|
||||
@FXML protected Parent root;
|
||||
|
||||
public CodeBehind(T presentationModel) {
|
||||
|
@ -59,7 +61,7 @@ public class CodeBehind<T extends PresentationModel> implements Initializable {
|
|||
public void terminate() {
|
||||
log.trace("Lifecycle: terminate " + this.getClass().getSimpleName());
|
||||
if (childController != null)
|
||||
childController.terminate();
|
||||
((CodeBehind<? extends PresentationModel>) childController).terminate();
|
||||
|
||||
presentationModel.deactivate();
|
||||
presentationModel.terminate();
|
||||
|
@ -69,7 +71,7 @@ public class CodeBehind<T extends PresentationModel> 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<T extends PresentationModel> 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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
-->
|
||||
|
||||
<?import javafx.scene.layout.*?>
|
||||
<BorderPane fx:id="root" id="splash" fx:controller="io.bitsquare.gui.MainController"
|
||||
prefHeight="750" prefWidth="1000" stylesheets="/io/bitsquare/gui/bitsquare.css"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
</BorderPane>
|
||||
<StackPane fx:id="root" fx:controller="io.bitsquare.gui.MainController"
|
||||
prefHeight="750" prefWidth="1000" stylesheets="/io/bitsquare/gui/bitsquare.css"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
</StackPane>
|
|
@ -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");
|
||||
|
|
128
src/main/java/io/bitsquare/gui/account/AccountCB.java
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<SetupPM> {
|
||||
|
||||
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<? extends PresentationModel> 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
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}
|
||||
|
65
src/main/java/io/bitsquare/gui/account/AccountModel.java
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}
|
65
src/main/java/io/bitsquare/gui/account/AccountPm.java
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<AccountModel> {
|
||||
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
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}
|
51
src/main/java/io/bitsquare/gui/account/AccountView.fxml
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<TabPane fx:id="root" fx:controller="io.bitsquare.gui.account.AccountCB"
|
||||
prefHeight="630.0" prefWidth="1000.0"
|
||||
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
|
||||
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<tabs>
|
||||
<Tab fx:id="setupTab" text="Setup" closable="false">
|
||||
<content>
|
||||
<AnchorPane fx:id="contentPane">
|
||||
<children>
|
||||
<Label fx:id="headLineLabel" layoutX="-111.308349609375" layoutY="-70.0"
|
||||
text="You need to register to use the exchange." AnchorPane.leftAnchor="20.0"
|
||||
AnchorPane.topAnchor="50.0"/>
|
||||
<Label fx:id="titleLabel" layoutX="113.353271484375" layoutY="28.0" text="Account overview"
|
||||
AnchorPane.leftAnchor="20.0" AnchorPane.topAnchor="20.0">
|
||||
<font>
|
||||
<Font name="System Bold" size="18.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
<Button fx:id="registrationButton" layoutX="100.0" layoutY="76.0" mnemonicParsing="false"
|
||||
onAction="#onRegister" defaultButton="true"
|
||||
text="Registration" AnchorPane.leftAnchor="20.0" AnchorPane.topAnchor="80.0"/>
|
||||
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</Tab>
|
||||
</tabs>
|
||||
</TabPane>
|
|
@ -15,9 +15,10 @@
|
|||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.setup;
|
||||
package io.bitsquare.gui.account.fiataccount;
|
||||
|
||||
import io.bitsquare.gui.CodeBehind;
|
||||
import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.account.setup.SetupCB;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
|
@ -25,19 +26,21 @@ import java.util.ResourceBundle;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SetupCB extends CodeBehind {
|
||||
public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SetupCB.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(FiatAccountCB.class);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public SetupCB(SetupPm presentationModel) {
|
||||
public FiatAccountCB(FiatAccountPm presentationModel) {
|
||||
super(presentationModel);
|
||||
}
|
||||
|
||||
|
@ -52,6 +55,16 @@ public class SetupCB extends CodeBehind {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate() {
|
||||
super.activate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate() {
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminate() {
|
||||
super.terminate();
|
||||
|
@ -66,6 +79,10 @@ public class SetupCB extends CodeBehind {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@FXML
|
||||
private void onDone() {
|
||||
((SetupCB) parentController).onCompleted(this);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.account.fiataccount;
|
||||
|
||||
import io.bitsquare.gui.UIModel;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class FiatAccountModel extends UIModel {
|
||||
private static final Logger log = LoggerFactory.getLogger(FiatAccountModel.class);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public FiatAccountModel() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Setters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.account.fiataccount;
|
||||
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class FiatAccountPm extends PresentationModel<FiatAccountModel> {
|
||||
private static final Logger log = LoggerFactory.getLogger(FiatAccountPm.class);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public FiatAccountPm(FiatAccountModel model) {
|
||||
super(model);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Setters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.fiataccount.FiatAccountCB" hgap="5.0" vgap="5.0"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="0.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<children>
|
||||
|
||||
<Pane id="form-group-background-active" GridPane.columnSpan="3" GridPane.rowSpan="4">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/>
|
||||
</GridPane.margin>
|
||||
<children>
|
||||
<Label id="form-group-title-active" text="Setup password" layoutX="8" layoutY="-8">
|
||||
<padding>
|
||||
<Insets left="5" right="7"/>
|
||||
</padding>
|
||||
</Label>
|
||||
</children>
|
||||
</Pane>
|
||||
|
||||
|
||||
<Button text="I have made my backup" onAction="#onDone" GridPane.columnIndex="1" GridPane.rowIndex="2"
|
||||
defaultButton="true">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="10"/>
|
||||
</GridPane.margin>
|
||||
</Button>
|
||||
|
||||
<ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"
|
||||
GridPane.rowIndex="3" GridPane.valignment="TOP">
|
||||
<image>
|
||||
<Image url="@/images/info_44.png"/>
|
||||
</image>
|
||||
<GridPane.margin>
|
||||
<Insets right="2.0" top="4.0"/>
|
||||
</GridPane.margin>
|
||||
</ImageView>
|
||||
|
||||
<Label GridPane.columnIndex="1" GridPane.rowIndex="3" prefWidth="340.0" wrapText="true"
|
||||
text="Protect your wallet with a strong password. You need to enter the password any time you withdraw Bitcoins from your trading wallets. You can change the password later in the settings. Open the help menu for more information.">
|
||||
</Label>
|
||||
</children>
|
||||
|
||||
<columnConstraints>
|
||||
<ColumnConstraints halignment="RIGHT" prefWidth="200.0"/>
|
||||
<ColumnConstraints hgrow="ALWAYS" prefWidth="410"/>
|
||||
</columnConstraints>
|
||||
|
||||
<rowConstraints>
|
||||
<RowConstraints/>
|
||||
<RowConstraints/>
|
||||
<RowConstraints/>
|
||||
<RowConstraints/>
|
||||
</rowConstraints>
|
||||
</GridPane>
|
113
src/main/java/io/bitsquare/gui/account/password/PasswordCB.java
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<PasswordPM> {
|
||||
|
||||
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
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<PasswordModel> {
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.password.PasswordCB" hgap="5.0" vgap="5.0"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="0.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<children>
|
||||
|
||||
<Pane id="form-group-background-active" GridPane.columnSpan="3" GridPane.rowSpan="4">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/>
|
||||
</GridPane.margin>
|
||||
<children>
|
||||
<Label id="form-group-title-active" text="Setup password" layoutX="8" layoutY="-8">
|
||||
<padding>
|
||||
<Insets left="5" right="7"/>
|
||||
</padding>
|
||||
</Label>
|
||||
</children>
|
||||
</Pane>
|
||||
|
||||
<Label text="Enter password:">
|
||||
<GridPane.margin>
|
||||
<Insets top="10.0"/>
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
|
||||
<PasswordField fx:id="passwordField" promptText="Min. 8 characters" GridPane.columnIndex="1">
|
||||
<GridPane.margin>
|
||||
<Insets top="10.0"/>
|
||||
</GridPane.margin>
|
||||
</PasswordField>
|
||||
|
||||
<Label text="Repeat password:" GridPane.rowIndex="1"/>
|
||||
<PasswordField fx:id="repeatedPasswordField" promptText="Repeat password" GridPane.columnIndex="1"
|
||||
GridPane.rowIndex="1"/>
|
||||
|
||||
<HBox spacing="10" GridPane.columnIndex="1" GridPane.rowIndex="2">
|
||||
<Button fx:id="saveButton" text="Save password" onAction="#onSaved" disable="true" defaultButton="true"/>
|
||||
<Button fx:id="skipButton" text="I will not use a password" onAction="#onSkipped"/>
|
||||
<GridPane.margin>
|
||||
<Insets bottom="5"/>
|
||||
</GridPane.margin>
|
||||
</HBox>
|
||||
|
||||
<ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"
|
||||
GridPane.rowIndex="3" GridPane.valignment="TOP">
|
||||
<image>
|
||||
<Image url="@/images/info_44.png"/>
|
||||
</image>
|
||||
<GridPane.margin>
|
||||
<Insets right="2.0" top="4.0"/>
|
||||
</GridPane.margin>
|
||||
</ImageView>
|
||||
|
||||
<TextFlow GridPane.columnIndex="1" GridPane.rowIndex="3" prefWidth="410.0">
|
||||
<Label prefWidth="410.0" wrapText="true"
|
||||
text="Protect your wallet with a strong password. You need to enter the password any time you withdraw Bitcoins from your trading wallets. You can change the password later in the settings. Open the help menu for more information."/>
|
||||
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenHelp"/>
|
||||
</TextFlow>
|
||||
|
||||
|
||||
</children>
|
||||
|
||||
<columnConstraints>
|
||||
<ColumnConstraints halignment="RIGHT" prefWidth="140.0"/>
|
||||
<ColumnConstraints hgrow="ALWAYS" prefWidth="470"/>
|
||||
</columnConstraints>
|
||||
|
||||
<rowConstraints>
|
||||
<RowConstraints vgrow="NEVER"/>
|
||||
<RowConstraints vgrow="NEVER"/>
|
||||
<RowConstraints vgrow="NEVER"/>
|
||||
<RowConstraints vgrow="NEVER"/>
|
||||
</rowConstraints>
|
||||
</GridPane>
|
||||
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* 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.registration;
|
||||
|
||||
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 org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RegistrationCB extends CachedCodeBehind<RegistrationPM> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistrationCB.class);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public RegistrationCB(RegistrationPM 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 Methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@FXML
|
||||
private void onDone() {
|
||||
((SetupCB) parentController).onCompleted(this);
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onOpenHelp() {
|
||||
Help.openWindow(HelpId.SETUP_REGISTRATION);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -15,54 +15,45 @@
|
|||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.registration;
|
||||
package io.bitsquare.gui.account.registration;
|
||||
|
||||
import io.bitsquare.gui.CodeBehind;
|
||||
import io.bitsquare.gui.UIModel;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RegistrationController extends CodeBehind {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistrationController.class);
|
||||
public class RegistrationModel extends UIModel {
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistrationModel.class);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public RegistrationController() {
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
super.initialize(url, rb);
|
||||
public RegistrationModel() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminate() {
|
||||
super.terminate();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public Methods
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI handlers
|
||||
// Interface implementation: Initializable
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Setters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
@ -72,4 +63,3 @@ public class RegistrationController extends CodeBehind {
|
|||
|
||||
|
||||
}
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.account.registration;
|
||||
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RegistrationPM extends PresentationModel<RegistrationModel> {
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistrationPM.class);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public RegistrationPM(RegistrationModel model) {
|
||||
super(model);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Setters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.registration.RegistrationCB" hgap="5.0" vgap="5.0"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="0.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<children>
|
||||
|
||||
<Pane id="form-group-background-active" GridPane.columnSpan="3" GridPane.rowSpan="4">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/>
|
||||
</GridPane.margin>
|
||||
<children>
|
||||
<Label id="form-group-title-active" text="Setup password" layoutX="8" layoutY="-8">
|
||||
<padding>
|
||||
<Insets left="5" right="7"/>
|
||||
</padding>
|
||||
</Label>
|
||||
</children>
|
||||
</Pane>
|
||||
|
||||
|
||||
<Button text="I have made my backup" onAction="#onDone" GridPane.columnIndex="1" GridPane.rowIndex="2"
|
||||
defaultButton="true">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="10"/>
|
||||
</GridPane.margin>
|
||||
</Button>
|
||||
|
||||
<ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"
|
||||
GridPane.rowIndex="3" GridPane.valignment="TOP">
|
||||
<image>
|
||||
<Image url="@/images/info_44.png"/>
|
||||
</image>
|
||||
<GridPane.margin>
|
||||
<Insets right="2.0" top="4.0"/>
|
||||
</GridPane.margin>
|
||||
</ImageView>
|
||||
|
||||
<TextFlow GridPane.columnIndex="1" GridPane.rowIndex="3" prefWidth="410.0">
|
||||
<Label prefWidth="410.0" wrapText="true"
|
||||
text="Protect your wallet with a strong password. You need to enter the password any time you withdraw Bitcoins from your trading wallets. You can change the password later in the settings. Open the help menu for more information."/>
|
||||
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenHelp"/>
|
||||
</TextFlow>
|
||||
</children>
|
||||
|
||||
<columnConstraints>
|
||||
<ColumnConstraints halignment="RIGHT" prefWidth="200.0"/>
|
||||
<ColumnConstraints hgrow="ALWAYS" prefWidth="410"/>
|
||||
</columnConstraints>
|
||||
|
||||
<rowConstraints>
|
||||
<RowConstraints/>
|
||||
<RowConstraints/>
|
||||
<RowConstraints/>
|
||||
<RowConstraints/>
|
||||
</rowConstraints>
|
||||
</GridPane>
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<RestrictionsPM> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RestrictionsCB.class);
|
||||
|
||||
@FXML private ListView languagesListView, countriesListView, arbitratorsListView;
|
||||
@FXML private ComboBox<Locale> languageComboBox;
|
||||
@FXML private ComboBox<Region> regionComboBox;
|
||||
@FXML private ComboBox<Country> 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<ListView<Locale>, ListCell<Locale>>() {
|
||||
@Override
|
||||
public ListCell<Locale> call(ListView<Locale> list) {
|
||||
return new ListCell<Locale>() {
|
||||
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<Locale>() {
|
||||
@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<io.bitsquare.locale.Region>() {
|
||||
@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<ListView<Country>, ListCell<Country>>() {
|
||||
@Override
|
||||
public ListCell<Country> call(ListView<Country> list) {
|
||||
return new ListCell<Country>() {
|
||||
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<Country>() {
|
||||
@Override
|
||||
public String toString(Country country) {
|
||||
return country.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Country fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initArbitrators() {
|
||||
arbitratorsListView.setCellFactory(new Callback<ListView<Arbitrator>, ListCell<Arbitrator>>() {
|
||||
@Override
|
||||
public ListCell<Arbitrator> call(ListView<Arbitrator> list) {
|
||||
return new ListCell<Arbitrator>() {
|
||||
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);
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<Locale> languageList;
|
||||
ObservableList<Country> countryList;
|
||||
ObservableList<Arbitrator> arbitratorList;
|
||||
|
||||
ObservableList<Locale> allLanguages = FXCollections.observableArrayList(LanguageUtil.getAllLanguageLocales());
|
||||
ObservableList<Region> 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<Country> 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<Country> 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<Locale> languages = new ArrayList<>();
|
||||
languages.add(LanguageUtil.getDefaultLanguageLocale());
|
||||
List<Arbitrator.METHOD> arbitrationMethods = new ArrayList<>();
|
||||
arbitrationMethods.add(Arbitrator.METHOD.TLS_NOTARY);
|
||||
List<Arbitrator.ID_VERIFICATION> 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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,208 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.restrictions.RestrictionsCB" hgap="5.0" vgap="5.0"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="0.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<children>
|
||||
|
||||
<!--
|
||||
languages
|
||||
-->
|
||||
<Pane id="form-group-background-active" GridPane.columnSpan="3" GridPane.rowSpan="3">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/>
|
||||
</GridPane.margin>
|
||||
<children>
|
||||
<Label id="form-group-title-active" text="Add languages" layoutX="8" layoutY="-8">
|
||||
<padding>
|
||||
<Insets left="5" right="7"/>
|
||||
</padding>
|
||||
</Label>
|
||||
</children>
|
||||
</Pane>
|
||||
|
||||
<Label text="Accepted languages:" GridPane.rowIndex="0" GridPane.valignment="TOP">
|
||||
<padding>
|
||||
<Insets top="10"/>
|
||||
</padding>
|
||||
</Label>
|
||||
<ListView fx:id="languagesListView" GridPane.columnIndex="1" GridPane.rowIndex="0" prefHeight="120.0"/>
|
||||
<ComboBox fx:id="languageComboBox" onAction="#onAddLanguage" promptText="Add language"
|
||||
GridPane.columnIndex="1" GridPane.rowIndex="1"
|
||||
prefWidth="150.0"/>
|
||||
|
||||
<ImageView GridPane.rowIndex="2" GridPane.valignment="TOP" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true"
|
||||
preserveRatio="true">
|
||||
<image>
|
||||
<Image fx:id="infoIcon" url="@/images/info_44.png"/>
|
||||
</image>
|
||||
<GridPane.margin>
|
||||
<Insets right="2.0" top="4.0"/>
|
||||
</GridPane.margin>
|
||||
</ImageView>
|
||||
<TextFlow GridPane.columnIndex="1" GridPane.rowIndex="2" prefWidth="410.0">
|
||||
<Label prefWidth="410.0" wrapText="true"
|
||||
text="Add languages you can support in case of arbitration."/>
|
||||
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenLanguagesHelp"/>
|
||||
<GridPane.margin>
|
||||
<Insets top="10" bottom="5.0"/>
|
||||
</GridPane.margin>
|
||||
</TextFlow>
|
||||
|
||||
<!--
|
||||
countries
|
||||
-->
|
||||
<Pane id="form-group-background-active" GridPane.columnSpan="2" GridPane.rowIndex="3" GridPane.rowSpan="3">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="-10" left="-10" right="-10" top="30"/>
|
||||
</GridPane.margin>
|
||||
<children>
|
||||
<Label id="form-group-title-active" text="Add countries" layoutX="8" layoutY="-8">
|
||||
<padding>
|
||||
<Insets left="5" right="7"/>
|
||||
</padding>
|
||||
</Label>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets top="50.0"/>
|
||||
</padding>
|
||||
</Pane>
|
||||
<Label text="Accepted countries:" GridPane.rowIndex="3" GridPane.valignment="TOP">
|
||||
<GridPane.margin>
|
||||
<Insets top="50"/>
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
<ListView fx:id="countriesListView" GridPane.columnIndex="1" GridPane.rowIndex="3" prefHeight="120.0"
|
||||
>
|
||||
<GridPane.margin>
|
||||
<Insets top="40"/>
|
||||
</GridPane.margin>
|
||||
</ListView>
|
||||
<HBox GridPane.columnIndex="1" GridPane.rowIndex="4" spacing="10">
|
||||
<children>
|
||||
<ComboBox fx:id="regionComboBox" onAction="#onSelectRegion" promptText="Select region"
|
||||
prefWidth="150.0"/>
|
||||
<ComboBox fx:id="countryComboBox" onAction="#onAddCountry" promptText="Add country" visible="false"
|
||||
prefWidth="150.0"/>
|
||||
<Button fx:id="addAllEuroCountriesButton" text="Add Euro countries" onAction="#onAddAllEuroCountries"
|
||||
prefWidth="150.0" visible="false"/>
|
||||
</children>
|
||||
</HBox>
|
||||
<ImageView GridPane.rowIndex="5" GridPane.valignment="TOP" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true"
|
||||
preserveRatio="true">
|
||||
<image>
|
||||
<fx:reference source="infoIcon"/>
|
||||
</image>
|
||||
<GridPane.margin>
|
||||
<Insets right="2.0" top="4.0"/>
|
||||
</GridPane.margin>
|
||||
</ImageView>
|
||||
<TextFlow GridPane.columnIndex="1" GridPane.rowIndex="5" prefWidth="410.0">
|
||||
<Label prefWidth="410.0" wrapText="true"
|
||||
text="Add payments account countries you accept for trades."/>
|
||||
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenCountriesHelp"/>
|
||||
<GridPane.margin>
|
||||
<Insets top="10" bottom="5.0"/>
|
||||
</GridPane.margin>
|
||||
</TextFlow>
|
||||
|
||||
<!--
|
||||
arbitrators
|
||||
-->
|
||||
<Pane id="form-group-background-active" GridPane.columnSpan="2" GridPane.rowIndex="6" GridPane.rowSpan="3">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="-10" left="-10" right="-10" top="30"/>
|
||||
</GridPane.margin>
|
||||
<children>
|
||||
<Label id="form-group-title-active" text="Add arbitrators" layoutX="8" layoutY="-8">
|
||||
<padding>
|
||||
<Insets left="5" right="7"/>
|
||||
</padding>
|
||||
</Label>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets top="50.0"/>
|
||||
</padding>
|
||||
</Pane>
|
||||
<Label text="Accepted arbitrators:" GridPane.rowIndex="6" GridPane.valignment="TOP">
|
||||
<GridPane.margin>
|
||||
<Insets top="50"/>
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
<ListView fx:id="arbitratorsListView" GridPane.columnIndex="1" GridPane.rowIndex="6" prefHeight="120.0">
|
||||
<GridPane.margin>
|
||||
<Insets top="40"/>
|
||||
</GridPane.margin>
|
||||
</ListView>
|
||||
<Button text="Add arbitrator" onAction="#onOpenArbitratorScreen" GridPane.columnIndex="1"
|
||||
GridPane.rowIndex="7"/>
|
||||
<ImageView GridPane.rowIndex="8" GridPane.valignment="TOP" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true"
|
||||
preserveRatio="true">
|
||||
<image>
|
||||
<fx:reference source="infoIcon"/>
|
||||
</image>
|
||||
<GridPane.margin>
|
||||
<Insets right="2.0" top="4.0"/>
|
||||
</GridPane.margin>
|
||||
</ImageView>
|
||||
<TextFlow GridPane.columnIndex="1" GridPane.rowIndex="8" prefWidth="410.0">
|
||||
<Label prefWidth="410.0" wrapText="true"
|
||||
text="Select your arbitrators. You need to choose at least 3 arbitrators. The more you choose the more trading possibilities you gain."/>
|
||||
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenArbitratorsHelp"/>
|
||||
<GridPane.margin>
|
||||
<Insets top="10" bottom="5.0"/>
|
||||
</GridPane.margin>
|
||||
</TextFlow>
|
||||
<Button fx:id="doneButton" text="Completed" onAction="#onDone" disable="true" GridPane.columnIndex="1"
|
||||
GridPane.rowIndex="9"
|
||||
defaultButton="true">
|
||||
<GridPane.margin>
|
||||
<Insets top="20.0"/>
|
||||
</GridPane.margin>
|
||||
</Button>
|
||||
</children>
|
||||
|
||||
<columnConstraints>
|
||||
<ColumnConstraints halignment="RIGHT" prefWidth="140.0"/>
|
||||
<ColumnConstraints hgrow="ALWAYS" prefWidth="470"/>
|
||||
</columnConstraints>
|
||||
|
||||
<rowConstraints>
|
||||
<RowConstraints vgrow="SOMETIMES"/>
|
||||
<RowConstraints vgrow="NEVER" minHeight="30.0"/>
|
||||
<RowConstraints vgrow="NEVER"/>
|
||||
|
||||
<RowConstraints vgrow="SOMETIMES"/>
|
||||
<RowConstraints vgrow="NEVER" minHeight="30.0"/>
|
||||
<RowConstraints vgrow="NEVER"/>
|
||||
|
||||
<RowConstraints vgrow="SOMETIMES"/>
|
||||
<RowConstraints vgrow="NEVER" minHeight="30.0"/>
|
||||
<RowConstraints vgrow="NEVER"/>
|
||||
|
||||
<RowConstraints vgrow="NEVER"/>
|
||||
|
||||
</rowConstraints>
|
||||
</GridPane>
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<SeedWordsPM> {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<String> mnemonicCode;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public SeedWordsModel(WalletFacade walletFacade) {
|
||||
if (walletFacade != null && walletFacade.getWallet() != null)
|
||||
mnemonicCode = walletFacade.getWallet().getKeyChainSeed().getMnemonicCode();
|
||||
}
|
||||
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<SeedWordsModel> {
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.seedwords.SeedWordsCB" hgap="5.0" vgap="5.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<children>
|
||||
<Pane id="form-group-background-active" fx:id="payFundsPane" GridPane.columnSpan="3" GridPane.rowSpan="4">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/>
|
||||
</GridPane.margin>
|
||||
<children>
|
||||
<Label id="form-group-title-active" text="Backup your wallet seed words"
|
||||
layoutX="8" layoutY="-8">
|
||||
<padding>
|
||||
<Insets left="5" right="7"/>
|
||||
</padding>
|
||||
</Label>
|
||||
</children>
|
||||
</Pane>
|
||||
|
||||
<Label text="Wallet seed words:" GridPane.columnIndex="0" GridPane.rowIndex="1" GridPane.valignment="TOP">
|
||||
<GridPane.margin>
|
||||
<Insets top="7.0"/>
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
<TextArea fx:id="seedWordsTextArea" GridPane.columnIndex="1" GridPane.rowIndex="1" wrapText="true"
|
||||
prefHeight="50">
|
||||
<font>
|
||||
<Font size="16.0"/>
|
||||
</font>
|
||||
</TextArea>
|
||||
|
||||
<Button text="I have made my backup" onAction="#onDone" GridPane.columnIndex="1" GridPane.rowIndex="2"
|
||||
defaultButton="true">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="5"/>
|
||||
</GridPane.margin>
|
||||
</Button>
|
||||
|
||||
<ImageView GridPane.rowIndex="3" GridPane.valignment="TOP" fitHeight="24.0" fitWidth="24.0"
|
||||
pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image fx:id="infoIcon" url="@/images/info_44.png"/>
|
||||
</image>
|
||||
<GridPane.margin>
|
||||
<Insets right="2.0" top="4.0"/>
|
||||
</GridPane.margin>
|
||||
</ImageView>
|
||||
|
||||
<TextFlow GridPane.columnIndex="1" GridPane.rowIndex="3" prefWidth="410.0">
|
||||
<Label prefWidth="410.0" wrapText="true"
|
||||
text="You can recreate your wallet our of these words when you lose your wallet. Backup it on paper to have better protection against online theft. Open the help menu for more information."/>
|
||||
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenHelp"/>
|
||||
</TextFlow>
|
||||
|
||||
</children>
|
||||
|
||||
<columnConstraints>
|
||||
<ColumnConstraints halignment="RIGHT" prefWidth="140.0"/>
|
||||
<ColumnConstraints hgrow="ALWAYS" prefWidth="470"/>
|
||||
</columnConstraints>
|
||||
|
||||
<rowConstraints>
|
||||
<RowConstraints vgrow="NEVER"/>
|
||||
<RowConstraints vgrow="NEVER"/>
|
||||
<RowConstraints vgrow="NEVER"/>
|
||||
<RowConstraints vgrow="NEVER"/>
|
||||
</rowConstraints>
|
||||
</GridPane>
|
251
src/main/java/io/bitsquare/gui/account/setup/SetupCB.java
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<SetupPM> {
|
||||
|
||||
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<? extends PresentationModel> 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<? extends PresentationModel> 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<? extends PresentationModel> 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<? extends PresentationModel> 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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.setup;
|
||||
package io.bitsquare.gui.account.setup;
|
||||
|
||||
import io.bitsquare.gui.UIModel;
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<SetupModel> {
|
||||
private static final Logger log = LoggerFactory.getLogger(SetupPm.class);
|
||||
public class SetupPM extends PresentationModel<SetupModel> {
|
||||
private static final Logger log = LoggerFactory.getLogger(SetupPM.class);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public SetupPm(SetupModel model) {
|
||||
public SetupPM(SetupModel model) {
|
||||
super(model);
|
||||
}
|
||||
|
|
@ -17,16 +17,15 @@
|
|||
~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
|
||||
<?import javafx.scene.layout.*?>
|
||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.registration.RegistrationController"
|
||||
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0" AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
|
||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.account.setup.SetupCB"
|
||||
prefHeight="660.0" prefWidth="1000.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<VBox spacing="20" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="0.0">
|
||||
|
||||
<Label id="headline-label" text="Reg"/>
|
||||
|
||||
</VBox>
|
||||
<VBox fx:id="leftVBox" spacing="5" prefWidth="300" AnchorPane.bottomAnchor="20" AnchorPane.leftAnchor="20"
|
||||
AnchorPane.topAnchor="20"/>
|
||||
<AnchorPane fx:id="content" AnchorPane.bottomAnchor="10" AnchorPane.leftAnchor="350"
|
||||
AnchorPane.topAnchor="30" prefWidth="620"/>
|
||||
</AnchorPane>
|
||||
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<PropertyValueFactory property="date"/>
|
||||
</cellValueFactory>
|
||||
</TableColumn>
|
||||
<TableColumn text="Amount (Min.)" fx:id="amountColumn" minWidth="70" sortable="false">
|
||||
<TableColumn text="Amount in BTC (Min.)" fx:id="amountColumn" minWidth="70" sortable="false">
|
||||
<cellValueFactory>
|
||||
<PropertyValueFactory property="amount"/>
|
||||
</cellValueFactory>
|
||||
|
@ -50,7 +50,7 @@
|
|||
<PropertyValueFactory property="price"/>
|
||||
</cellValueFactory>
|
||||
</TableColumn>
|
||||
<TableColumn text="Volume (Min.)" fx:id="volumeColumn" minWidth="70" sortable="false">
|
||||
<TableColumn text="Amount in EUR (Min.)" fx:id="volumeColumn" minWidth="70" sortable="false">
|
||||
<cellValueFactory>
|
||||
<PropertyValueFactory property="volume"/>
|
||||
</cellValueFactory>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
xmlns:fx="http://javafx.com/fxml">
|
||||
<TableView id="orderbook-table" fx:id="openTradesTable" prefHeight="150.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="amountColumn" minWidth="120" text="Amount (Min.)">
|
||||
<TableColumn fx:id="amountColumn" minWidth="120" text="Amount in BTC (Min.)">
|
||||
<cellValueFactory>
|
||||
<PropertyValueFactory property="amount"/>
|
||||
</cellValueFactory>
|
||||
|
@ -38,7 +38,7 @@
|
|||
<PropertyValueFactory property="price"/>
|
||||
</cellValueFactory>
|
||||
</TableColumn>
|
||||
<TableColumn fx:id="volumeColumn" minWidth="130" text="Volume (Min.)">
|
||||
<TableColumn fx:id="volumeColumn" minWidth="130" text="Amount in EUR (Min.)">
|
||||
<cellValueFactory>
|
||||
<PropertyValueFactory property="volume"/>
|
||||
</cellValueFactory>
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.setup.SetupCB"
|
||||
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0" AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<VBox spacing="20" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="0.0">
|
||||
|
||||
<ImageView fitWidth="1000.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@/images/screenshot.png"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
|
||||
</VBox>
|
||||
</AnchorPane>
|
||||
|
|
@ -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);
|
||||
|
|
|
@ -120,6 +120,7 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
|
|||
setupListeners();
|
||||
setupBindings();
|
||||
balanceTextField.setup(presentationModel.getWalletFacade(), presentationModel.address.get());
|
||||
volumeTextField.setPromptText(BSResources.get("createOffer.volume.prompt", presentationModel.fiatCode.get()));
|
||||
}
|
||||
|
||||
@SuppressWarnings("EmptyMethod")
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
</GridPane.margin>
|
||||
<Label fx:id="priceAmountTitleLabel" id="form-group-title-active"
|
||||
text="%createOffer.amountPriceBox.title" layoutX="8" layoutY="-8">
|
||||
<padding>
|
||||
<padding>
|
||||
<Insets left="5" right="7"/>
|
||||
</padding>
|
||||
</Label>
|
||||
|
@ -68,7 +68,7 @@
|
|||
</ImageView>
|
||||
<Label fx:id="buyLabel" id="direction-icon-label" text="%createOffer.amountPriceBox.subTitle"
|
||||
alignment="CENTER">
|
||||
<padding>
|
||||
<padding>
|
||||
<Insets top="-5.0"/>
|
||||
</padding>
|
||||
</Label>
|
||||
|
@ -130,8 +130,7 @@
|
|||
<HBox>
|
||||
<children>
|
||||
<InputTextField fx:id="volumeTextField" id="text-input-with-currency-text-field"
|
||||
promptText="%createOffer.volume.prompt" prefWidth="170"
|
||||
alignment="CENTER_RIGHT"/>
|
||||
prefWidth="170" alignment="CENTER_RIGHT"/>
|
||||
<Label fx:id="volumeFiatLabel" id="currency-info-label"/>
|
||||
</children>
|
||||
</HBox>
|
||||
|
@ -213,7 +212,7 @@
|
|||
focusTraversable="true" visible="false"/>
|
||||
|
||||
<Label fx:id="balanceLabel" text="%createOffer.fundsBox.balance" GridPane.rowIndex="6" visible="false">
|
||||
<GridPane.margin>
|
||||
<GridPane.margin>
|
||||
<Insets bottom="5.0"/>
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
|
@ -304,7 +303,7 @@
|
|||
|
||||
<Label fx:id="bankAccountCountyLabel" text="%createOffer.advancedBox.county" GridPane.rowIndex="14"
|
||||
visible="false">
|
||||
<GridPane.margin>
|
||||
<GridPane.margin>
|
||||
<Insets bottom="5.0"/>
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
<TableView fx:id="orderBookTable" AnchorPane.leftAnchor="10.0"
|
||||
AnchorPane.topAnchor="45.0" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0">
|
||||
<columns>
|
||||
<TableColumn text="Amount (Min.)" fx:id="amountColumn" minWidth="120">
|
||||
<TableColumn text="Amount in BTC (Min.)" fx:id="amountColumn" minWidth="120">
|
||||
<cellValueFactory>
|
||||
<PropertyValueFactory property="amount"/>
|
||||
</cellValueFactory>
|
||||
|
@ -71,7 +71,7 @@
|
|||
<PropertyValueFactory property="price"/>
|
||||
</cellValueFactory>
|
||||
</TableColumn>
|
||||
<TableColumn text="Volume (Min.)" fx:id="volumeColumn" minWidth="130">
|
||||
<TableColumn text="Amount in EUR (Min.)" fx:id="volumeColumn" minWidth="130">
|
||||
<cellValueFactory>
|
||||
<PropertyValueFactory property="volume"/>
|
||||
</cellValueFactory>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,14 +36,14 @@
|
|||
|
||||
<Label text="Take offer:" id="form-header-text"/>
|
||||
|
||||
<Label text="Amount:" GridPane.rowIndex="1"/>
|
||||
<Label text="Amount in BTC:" GridPane.rowIndex="1"/>
|
||||
<ValidatedTextField fx:id="amountTextField" GridPane.rowIndex="1" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Price (EUR/BTC):" GridPane.rowIndex="2"/>
|
||||
<TextField fx:id="priceTextField" editable="false" focusTraversable="false"
|
||||
GridPane.rowIndex="2" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Volume (EUR):" GridPane.rowIndex="3"/>
|
||||
<Label text="Amount in EUR:" GridPane.rowIndex="3"/>
|
||||
<TextField fx:id="volumeTextField" editable="false" focusTraversable="false"
|
||||
GridPane.rowIndex="3" GridPane.columnIndex="1"/>
|
||||
|
||||
|
|
|
@ -17,9 +17,15 @@
|
|||
|
||||
package io.bitsquare.gui.util;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.*;
|
||||
|
||||
public class ImageUtil {
|
||||
|
||||
public static final String hiRes = Toolkit.getDefaultToolkit().getScreenResolution() >= 144 ? "_hi_res" : "";
|
||||
|
||||
public static final String SPLASH_LOGO = "/images/logo_600_600.png";
|
||||
|
||||
public static final String SYS_TRAY = "/images/system_tray_icon_44_32.png";
|
||||
|
@ -39,6 +45,8 @@ public class ImageUtil {
|
|||
public static final String MSG_ACTIVE = "/images/nav/msg_active.png";
|
||||
public static final String SETTINGS = "/images/nav/settings.png";
|
||||
public static final String SETTINGS_ACTIVE = "/images/nav/settings_active.png";
|
||||
public static final String ACCOUNT = "/images/nav/account.png";
|
||||
public static final String ACCOUNT_ACTIVE = "/images/nav/account_active.png";
|
||||
|
||||
public static final String MSG_ALERT = "/images/nav/alertRound.png";
|
||||
|
||||
|
@ -49,11 +57,16 @@ public class ImageUtil {
|
|||
public static final String EXPAND = "/images/expand.png";
|
||||
public static final String COLLAPSE = "/images/collapse.png";
|
||||
|
||||
public static final String TICK = "/images/tick.png";
|
||||
public static final String ARROW_BLUE = "/images/arrow_blue.png";
|
||||
public static final String ARROW_GREY = "/images/arrow_grey.png";
|
||||
|
||||
public static Image getIconImage(String iconName) {
|
||||
return new Image(ImageUtil.class.getResourceAsStream(iconName));
|
||||
return new Image(ImageUtil.class.getResourceAsStream(iconName.replace("/images", "/images" + hiRes)));
|
||||
}
|
||||
|
||||
public static ImageView getIconImageView(String iconName) {
|
||||
return new ImageView(new Image(ImageUtil.class.getResourceAsStream(iconName)));
|
||||
return new ImageView(new Image(ImageUtil.class.getResourceAsStream(iconName.replace("/images",
|
||||
"/images" + hiRes))));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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.util.validation;
|
||||
|
||||
import io.bitsquare.locale.BSResources;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* NumberValidator for validating basic number values.
|
||||
* Localisation not supported at the moment
|
||||
* The decimal mark can be either "." or ",". Thousand separators are not supported yet,
|
||||
* but might be added alter with Local support.
|
||||
* <p>
|
||||
* That class implements just what we need for the moment. It is not intended as a general purpose library class.
|
||||
*/
|
||||
public class PasswordValidator extends InputValidator {
|
||||
private static final Logger log = LoggerFactory.getLogger(PasswordValidator.class);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = validateIfNotEmpty(input);
|
||||
if (result.isValid)
|
||||
result = validateMinLength(input);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Protected methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
protected ValidationResult validateMinLength(String input) {
|
||||
if (input.length() > 7)
|
||||
return new ValidationResult(true);
|
||||
else
|
||||
return new ValidationResult(false, BSResources.get("validation.passwordTooShort"));
|
||||
}
|
||||
|
||||
}
|
|
@ -27,7 +27,12 @@ import java.util.Locale;
|
|||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class CountryUtil {
|
||||
private static final Logger log = LoggerFactory.getLogger(CountryUtil.class);
|
||||
|
||||
private static final String[] countryCodes = new String[]{"AE", "AL", "AR", "AT", "AU", "BA", "BE", "BG", "BH",
|
||||
"BO", "BR", "BY", "CA", "CH", "CL", "CN", "CO", "CR", "CS", "CU", "CY", "CZ", "DE", "DK", "DO", "DZ",
|
||||
"EC", "EE", "EG", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HR", "HU", "ID", "IE", "IL", "IN",
|
||||
|
@ -38,7 +43,7 @@ public class CountryUtil {
|
|||
|
||||
private static final List<String> countryCodeList = Arrays.asList(countryCodes);
|
||||
private static final String[] regionCodes = new String[]{"AS", "EU", "SA", "EU", "OC", "EU", "EU", "EU", "AS",
|
||||
"SA", "SA", "EU", "NA", "EU", "SA", "AS", "SA", "NA", "EU", "NA", "AS", "EU", "EU", "EU", "NA", "AF",
|
||||
"SA", "SA", "EU", "NA", "EU", "SA", "AS", "SA", "NA", "EU", "NA", "EU", "EU", "EU", "EU", "NA", "AF",
|
||||
"SA", "EU", "AF", "EU", "EU", "EU", "EU", "EU", "NA", "AS", "NA", "EU", "EU", "AS", "EU", "AS", "AS",
|
||||
"AS", "EU", "EU", "AS", "AS", "AS", "AS", "AS", "EU", "EU", "EU", "AF", "AF", "EU", "EU", "EU", "NA",
|
||||
"AS", "NA", "EU", "EU", "OC", "AS", "NA", "SA", "AS", "EU", "NA", "EU", "SA", "AS", "EU", "EU", "EU",
|
||||
|
@ -79,6 +84,22 @@ public class CountryUtil {
|
|||
return allRegions;
|
||||
}
|
||||
|
||||
public static List<Country> getAllEuroCountries() {
|
||||
|
||||
List<Country> allEuroCountries = new ArrayList<>();
|
||||
String[] code = {"BE", "DE", "EE", "FI", "FR", "GR", "IE", "IT", "LV", "LU", "MT", "NL", "PT", "SK", "SI",
|
||||
"ES", "AT", "CY"};
|
||||
for (int i = 0; i < code.length; i++) {
|
||||
Locale locale = new Locale("", code[i], "");
|
||||
String regionCode = getRegionCode(locale.getCountry());
|
||||
final Region region = new Region(regionCode, getRegionName(regionCode));
|
||||
final Country country = new Country(locale.getCountry(), locale.getDisplayCountry(), region);
|
||||
allEuroCountries.add(country);
|
||||
}
|
||||
|
||||
return allEuroCountries;
|
||||
}
|
||||
|
||||
public static List<Country> getAllCountriesFor(Region selectedRegion) {
|
||||
return Lists.newArrayList(Collections2.filter(getAllCountries(), country ->
|
||||
selectedRegion != null && country != null && selectedRegion.equals(country.getRegion())));
|
||||
|
@ -111,11 +132,14 @@ public class CountryUtil {
|
|||
return regionCode;
|
||||
}
|
||||
|
||||
// We use getAvailableLocales as we depend on display names (would be a bit painful with translations if handled
|
||||
// from a static list -or we find something ready made?).
|
||||
private static List<Locale> getAllCountryLocales() {
|
||||
List<Locale> allLocales = Arrays.asList(Locale.getAvailableLocales());
|
||||
Set<Locale> allLocalesAsSet =
|
||||
allLocales.stream().filter(locale -> !"".equals(locale.getCountry())).map(locale ->
|
||||
new Locale("", locale.getCountry(), "")).collect(Collectors.toSet());
|
||||
log.debug(allLocales.toString());
|
||||
Set<Locale> allLocalesAsSet = allLocales.stream().filter(locale -> !"".equals(locale.getCountry()))
|
||||
.map(locale -> new Locale("", locale.getCountry(), ""))
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
allLocales = new ArrayList<>();
|
||||
allLocales.addAll(allLocalesAsSet);
|
||||
|
|
|
@ -51,7 +51,7 @@ public class Region implements Serializable {
|
|||
}
|
||||
|
||||
|
||||
String getCode() {
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,9 @@ public class Settings implements Serializable {
|
|||
private long collateral = 100; // is 1/1000 so 100 results to 100/1000 = 0,1 (or 10%)
|
||||
// which will be used for multiplying with the amount to get the collateral size in BTC.
|
||||
|
||||
final StringProperty btcDenomination = new SimpleStringProperty(CoinFormat.CODE_BTC);
|
||||
|
||||
private String btcDenominationString = CoinFormat.CODE_BTC;
|
||||
final transient StringProperty btcDenomination = new SimpleStringProperty(CoinFormat.CODE_BTC);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
|
@ -61,6 +63,7 @@ public class Settings implements Serializable {
|
|||
acceptedCountryLocales = persistedSettings.getAcceptedCountries();
|
||||
acceptedArbitrators = persistedSettings.getAcceptedArbitrators();
|
||||
collateral = persistedSettings.getCollateral();
|
||||
setBtcDenomination(persistedSettings.getBtcDenominationString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +130,12 @@ public class Settings implements Serializable {
|
|||
return btcDenomination;
|
||||
}
|
||||
|
||||
public void setBtcDenomination(String useMBTC) {
|
||||
this.btcDenomination.set(useMBTC);
|
||||
public void setBtcDenomination(String btcDenomination) {
|
||||
btcDenominationString = btcDenomination;
|
||||
this.btcDenomination.set(btcDenomination);
|
||||
}
|
||||
|
||||
public String getBtcDenominationString() {
|
||||
return btcDenominationString;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ public class User implements Serializable {
|
|||
BSFormatter.setFiatCurrencyCode(currentBankAccount.getCurrency().getCurrencyCode());
|
||||
FiatValidator.setFiatCurrencyCode(currentBankAccount.getCurrency().getCurrencyCode());
|
||||
}
|
||||
|
||||
|
||||
int index;
|
||||
for (index = 0; index < bankAccounts.size(); index++) {
|
||||
if (currentBankAccount != null && currentBankAccount.equals(bankAccounts.get(index)))
|
||||
|
|
|
@ -17,12 +17,12 @@ validation.fiat.toSmall=Input smaller as minimum possible {0} value is not allow
|
|||
validation.fiat.toLarge=Input larger as maximum possible {0} value is not allowed.
|
||||
validation.btc.toSmall=Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi).
|
||||
validation.btc.toLarge=Input larger as maximum possible Bitcoin value is not allowed..
|
||||
|
||||
validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters.
|
||||
|
||||
# Create offer
|
||||
createOffer.amount.prompt=Enter amount
|
||||
createOffer.amount.prompt=Enter amount in BTC
|
||||
createOffer.price.prompt=Enter price
|
||||
createOffer.volume.prompt=Trade volume
|
||||
createOffer.volume.prompt=Enter amount in {0}
|
||||
createOffer.minAmount.prompt=Enter min. amount
|
||||
|
||||
createOffer.amountPriceBox.title=Create your offer
|
||||
|
|
|
@ -17,12 +17,12 @@ validation.fiat.toSmall=Input smaller as minimum possible {0} value is not allow
|
|||
validation.fiat.toLarge=Input larger as maximum possible {0} value is not allowed.
|
||||
validation.btc.toSmall=Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi).
|
||||
validation.btc.toLarge=Input larger as maximum possible Bitcoin value is not allowed..
|
||||
|
||||
validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters.
|
||||
|
||||
# Create offer
|
||||
createOffer.amount.prompt=Enter amount
|
||||
createOffer.amount.prompt=Enter amount in BTC
|
||||
createOffer.price.prompt=Enter price
|
||||
createOffer.volume.prompt=Trade volume
|
||||
createOffer.volume.prompt=Enter amount in {0}
|
||||
createOffer.minAmount.prompt=Enter min. amount
|
||||
|
||||
createOffer.amountPriceBox.title=Create your offer
|
||||
|
|
|
@ -17,12 +17,12 @@ validation.fiat.toSmall=Input smaller as minimum possible {0} value is not allow
|
|||
validation.fiat.toLarge=Input larger as maximum possible {0} value is not allowed.
|
||||
validation.btc.toSmall=Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi).
|
||||
validation.btc.toLarge=Input larger as maximum possible Bitcoin value is not allowed..
|
||||
|
||||
validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters.
|
||||
|
||||
# Create offer
|
||||
createOffer.amount.prompt=Enter amount
|
||||
createOffer.amount.prompt=Enter amount in BTC
|
||||
createOffer.price.prompt=Enter price
|
||||
createOffer.volume.prompt=Trade volume
|
||||
createOffer.volume.prompt=Enter amount in {0}
|
||||
createOffer.minAmount.prompt=Enter min. amount
|
||||
|
||||
createOffer.amountPriceBox.title=Create your offer
|
||||
|
|
|
@ -17,12 +17,12 @@ validation.fiat.toSmall=Input smaller as minimum possible {0} value is not allow
|
|||
validation.fiat.toLarge=Input larger as maximum possible {0} value is not allowed.
|
||||
validation.btc.toSmall=Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi).
|
||||
validation.btc.toLarge=Input larger as maximum possible Bitcoin value is not allowed..
|
||||
|
||||
validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters.
|
||||
|
||||
# Create offer
|
||||
createOffer.amount.prompt=Enter amount
|
||||
createOffer.amount.prompt=Enter amount in BTC
|
||||
createOffer.price.prompt=Enter price
|
||||
createOffer.volume.prompt=Trade volume
|
||||
createOffer.volume.prompt=Enter amount in {0}
|
||||
createOffer.minAmount.prompt=Enter min. amount
|
||||
|
||||
createOffer.amountPriceBox.title=Create your offer
|
||||
|
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 461 B |
Before Width: | Height: | Size: 498 B After Width: | Height: | Size: 461 B |
Before Width: | Height: | Size: 540 B After Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 611 B After Width: | Height: | Size: 589 B |
Before Width: | Height: | Size: 437 B After Width: | Height: | Size: 452 B |
Before Width: | Height: | Size: 488 B After Width: | Height: | Size: 456 B |
Before Width: | Height: | Size: 632 B After Width: | Height: | Size: 586 B |
Before Width: | Height: | Size: 632 B After Width: | Height: | Size: 585 B |
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 579 B |
Before Width: | Height: | Size: 606 B After Width: | Height: | Size: 579 B |
Before Width: | Height: | Size: 419 B After Width: | Height: | Size: 395 B |
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 395 B |
Before Width: | Height: | Size: 650 B After Width: | Height: | Size: 795 B |
Before Width: | Height: | Size: 809 B After Width: | Height: | Size: 793 B |
|
@ -34,7 +34,7 @@
|
|||
|
||||
<logger name="io.bitsquare.gui.ViewController" level="OFF"/>
|
||||
<logger name="io.bitsquare.gui.CachedViewController" level="OFF"/>
|
||||
<logger name="io.bitsquare.gui.util.Profiler" level="OFF"/>
|
||||
<logger name="io.bitsquare.gui.util.Profiler" level="TRACE"/>
|
||||
|
||||
<!--
|
||||
<logger name="com.google.bitcoin.core.Wallet" level="OFF"/>
|
||||
|
|
101
src/test/java/io/bitsquare/gui/account/AccountUITestRunner.java
Normal 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.di.GuiceFXMLLoader;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.*;
|
||||
import javafx.scene.input.*;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* For testing single isolated UI screens
|
||||
*/
|
||||
public class AccountUITestRunner extends Application {
|
||||
private static final Logger log = LoggerFactory.getLogger(AccountUITestRunner.class);
|
||||
private Scene scene;
|
||||
private Node view;
|
||||
private StackPane pane;
|
||||
private boolean devTest = true;
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
Injector injector = Guice.createInjector(new BitSquareModule());
|
||||
GuiceFXMLLoader.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();
|
||||
GuiceFXMLLoader loader = new GuiceFXMLLoader(
|
||||
getUrl("/io/bitsquare/gui/account/AccountView.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);
|
||||
}
|
||||
}
|
||||
}
|
101
src/test/java/io/bitsquare/gui/account/SetupUITestRunner.java
Normal 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.di.GuiceFXMLLoader;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.*;
|
||||
import javafx.scene.input.*;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* For testing single isolated UI screens
|
||||
*/
|
||||
public class SetupUITestRunner extends Application {
|
||||
private static final Logger log = LoggerFactory.getLogger(SetupUITestRunner.class);
|
||||
private Scene scene;
|
||||
private Pane view;
|
||||
private Pane pane;
|
||||
private boolean devTest = true;
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
Injector injector = Guice.createInjector(new BitSquareModule());
|
||||
GuiceFXMLLoader.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();
|
||||
GuiceFXMLLoader loader = new GuiceFXMLLoader(
|
||||
getUrl("/io/bitsquare/gui/account/setup/SetupView.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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.registration.uimock;
|
||||
package io.bitsquare.gui.account.registration.uimock;
|
||||
|
||||
import java.net.URL;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package io.bitsquare.gui.registration.uimock;
|
||||
package io.bitsquare.gui.account.registration.uimock;
|
||||
|
||||
import io.bitsquare.di.BitSquareModule;
|
||||
import io.bitsquare.di.GuiceFXMLLoader;
|
|
@ -21,10 +21,10 @@
|
|||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<GridPane fx:id="root" hgap="5.0" stylesheets="@../../../../../../../main/java/io/bitsquare/gui/bitsquare.css"
|
||||
<GridPane fx:id="root" hgap="5.0" stylesheets="@../../../../../../../java/io/bitsquare/gui/bitsquare.css"
|
||||
vgap="5.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="io.bitsquare.gui.registration.uimock.FundRegistrationWalletControllerUIMock">
|
||||
fx:controller="io.bitsquare.gui.account.registration.uimock.FundRegistrationWalletControllerUIMock">
|
||||
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="26.0"/>
|
|
@ -15,7 +15,7 @@
|
|||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.registration.uimock;
|
||||
package io.bitsquare.gui.account.registration.uimock;
|
||||
|
||||
import java.net.URL;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package io.bitsquare.gui.registration.uimock;
|
||||
package io.bitsquare.gui.account.registration.uimock;
|
||||
|
||||
import io.bitsquare.di.BitSquareModule;
|
||||
import io.bitsquare.di.GuiceFXMLLoader;
|
||||
|
@ -51,7 +51,7 @@ public class RegistrationUIMockRunner extends Application {
|
|||
log.debug("re load");
|
||||
pane.getChildren().removeAll();
|
||||
GuiceFXMLLoader loader = new GuiceFXMLLoader(
|
||||
getUrl("/io/bitsquare/gui/registration/uimock/RegistrationViewUIMock.fxml"), false);
|
||||
getUrl("/io/bitsquare/gui/account/registration/uimock/RegistrationViewUIMock.fxml"), false);
|
||||
|
||||
try {
|
||||
view = loader.load();
|
|
@ -22,9 +22,9 @@
|
|||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<BorderPane fx:id="root" prefHeight="660.0" prefWidth="1000.0" style="-fx-background-color: f4f4f4;"
|
||||
stylesheets="@../../../../../../../main/java/io/bitsquare/gui/bitsquare.css"
|
||||
stylesheets="@../../../../../../../../main/java/io/bitsquare/gui/bitsquare.css"
|
||||
xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="io.bitsquare.gui.registration.uimock.RegistrationControllerUIMock">
|
||||
fx:controller="io.bitsquare.gui.account.registration.uimock.RegistrationControllerUIMock">
|
||||
<left>
|
||||
|
||||
<VBox spacing="5" prefWidth="300.0" BorderPane.alignment="CENTER">
|
||||
|
@ -41,7 +41,7 @@
|
|||
<Insets left="8.0" top="8.0"/>
|
||||
</HBox.margin>
|
||||
<image>
|
||||
<Image url="@../../../../../../../main/resources/images/tick.png"/>
|
||||
<Image url="@../../../../../../../../main/resources/images/tick.png"/>
|
||||
</image>
|
||||
|
||||
</ImageView>
|
||||
|
@ -70,7 +70,7 @@
|
|||
<Insets left="8.0" top="8.0"/>
|
||||
</HBox.margin>
|
||||
<image>
|
||||
<Image url="@../../../../../../../main/resources/images/tick.png"/>
|
||||
<Image url="@../../../../../../../../main/resources/images/tick.png"/>
|
||||
</image>
|
||||
|
||||
</ImageView>
|
||||
|
@ -99,7 +99,7 @@
|
|||
<Insets left="8.0" top="8.0"/>
|
||||
</HBox.margin>
|
||||
<image>
|
||||
<Image url="@../../../../../../../main/resources/images/tick.png"/>
|
||||
<Image url="@../../../../../../../../main/resources/images/tick.png"/>
|
||||
</image>
|
||||
|
||||
</ImageView>
|
||||
|
@ -128,7 +128,7 @@
|
|||
<Insets left="8.0" top="8.0"/>
|
||||
</HBox.margin>
|
||||
<image>
|
||||
<Image url="@../../../../../../../main/resources/images/arrow_blue.png"/>
|
||||
<Image url="@../../../../../../../../main/resources/images/arrow_blue.png"/>
|
||||
</image>
|
||||
|
||||
</ImageView>
|
||||
|
@ -158,7 +158,7 @@
|
|||
<Insets left="8.0" top="8.0"/>
|
||||
</HBox.margin>
|
||||
<image>
|
||||
<Image url="@../../../../../../../main/resources/images/arrow_grey.png"/>
|
||||
<Image url="@../../../../../../../../main/resources/images/arrow_grey.png"/>
|
||||
</image>
|
||||
|
||||
</ImageView>
|
||||
|
@ -185,11 +185,11 @@
|
|||
</left>
|
||||
<center>
|
||||
<Pane fx:id="content">
|
||||
<fx:include source="../../settings/uimock/SeedWordsViewUIMock.fxml" visible="true" prefWidth="690"/>
|
||||
<fx:include source="../../settings/uimock/SetPasswordViewUIMock.fxml" visible="false" prefWidth="690"/>
|
||||
<fx:include source="../../settings/uimock/BankAccountSettingsViewUIMock.fxml" visible="false"
|
||||
<fx:include source="../../../settings/uimock/SeedWordsViewUIMock.fxml" visible="true" prefWidth="690"/>
|
||||
<fx:include source="../../../settings/uimock/SetPasswordViewUIMock.fxml" visible="false" prefWidth="690"/>
|
||||
<fx:include source="../../../settings/uimock/BankAccountSettingsViewUIMock.fxml" visible="false"
|
||||
prefWidth="690"/>
|
||||
<fx:include source="../../settings/uimock/RestrictionSettingsViewUIMock.fxml" visible="false"
|
||||
<fx:include source="../../../settings/uimock/RestrictionSettingsViewUIMock.fxml" visible="false"
|
||||
prefWidth="690"/>
|
||||
<fx:include source="FundRegistrationWalletViewUIMock.fxml" visible="false" prefWidth="690"/>
|
||||
</Pane>
|
|
@ -21,8 +21,10 @@
|
|||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<GridPane fx:id="root" hgap="5.0" stylesheets="@../../../../../../../main/java/io/bitsquare/gui/bitsquare.css"
|
||||
vgap="5.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
<?import javafx.scene.text.*?>
|
||||
<GridPane fx:id="root" hgap="5.0" prefHeight="630.0" prefWidth="1000.0"
|
||||
stylesheets="@../../../../../../../main/java/io/bitsquare/gui/bitsquare.css" vgap="5.0"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="io.bitsquare.gui.settings.uimock.SeedWordsControllerUIMock">
|
||||
|
||||
|
@ -32,46 +34,42 @@
|
|||
|
||||
<children>
|
||||
|
||||
<Pane id="form-group-background-active" fx:id="payFundsPane" visible="true" GridPane.columnSpan="3"
|
||||
GridPane.rowSpan="4">
|
||||
<Pane id="form-group-background-active" fx:id="payFundsPane" GridPane.columnSpan="3" GridPane.rowSpan="4">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/>
|
||||
</GridPane.margin>
|
||||
<children>
|
||||
<Label id="form-group-title-active" fx:id="payFundsTitleLabel" layoutX="8" layoutY="-8"
|
||||
text="Setup password">
|
||||
text="Backup your wallet seed words">
|
||||
<padding>
|
||||
<Insets left="5" right="7"/>
|
||||
</padding>
|
||||
</Label>
|
||||
</children>
|
||||
</Pane>
|
||||
|
||||
<Label fx:id="totalToPayLabel" text="Enter password:" visible="true">
|
||||
<Label text="Wallet seed words:" GridPane.columnIndex="0" GridPane.rowIndex="1" GridPane.valignment="TOP">
|
||||
<GridPane.margin>
|
||||
<Insets top="10.0"/>
|
||||
<Insets top="7.0"/>
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
|
||||
<PasswordField promptText="Enter password:" GridPane.columnIndex="1" GridPane.columnSpan="2">
|
||||
<TextArea prefHeight="100.0" text="essay case modify essay case modify essay case modify essay case modify"
|
||||
GridPane.columnIndex="1" GridPane.rowIndex="1">
|
||||
<GridPane.margin>
|
||||
<Insets top="10.0"/>
|
||||
<Insets/>
|
||||
</GridPane.margin>
|
||||
</PasswordField>
|
||||
<font>
|
||||
<Font size="16.0"/>
|
||||
</font>
|
||||
</TextArea>
|
||||
|
||||
<Label fx:id="addressLabel" text="Repeat password:" visible="true" GridPane.rowIndex="1"/>
|
||||
<PasswordField promptText="Repeat password" GridPane.columnIndex="1"
|
||||
GridPane.columnSpan="2" GridPane.rowIndex="1"/>
|
||||
|
||||
<Button GridPane.columnIndex="1" GridPane.rowIndex="2" defaultButton="true"
|
||||
text="Save password" visible="true">
|
||||
<Button defaultButton="true" text="I have made my backup" GridPane.columnIndex="1" GridPane.rowIndex="2">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="10"/>
|
||||
</GridPane.margin>
|
||||
</Button>
|
||||
|
||||
<ImageView fx:id="payFundsInfoIcon" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"
|
||||
visible="true" GridPane.rowIndex="3" GridPane.valignment="TOP">
|
||||
GridPane.rowIndex="3" GridPane.valignment="TOP">
|
||||
<image>
|
||||
<Image fx:id="infoIcon" url="@../../../../../../../main/resources/images/info_44.png"/>
|
||||
</image>
|
||||
|
@ -81,8 +79,8 @@
|
|||
</ImageView>
|
||||
|
||||
<Label fx:id="payFundsInfoLabel" prefWidth="740.0"
|
||||
text="Protect your wallet with a strong password. You need to enter the password any time you withdraw Bitcoins from your trading wallets. You can change the password later in the settings. Open the help menu for more information."
|
||||
visible="true" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="3">
|
||||
text="You can recreate your wallet our of these words when you lose your wallet. Backup it on paper to have better protection against cycer criminals. Open the help menu for more information."
|
||||
wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="3">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="5.0"/>
|
||||
</GridPane.margin>
|
||||
|
@ -92,9 +90,9 @@
|
|||
</children>
|
||||
|
||||
<columnConstraints>
|
||||
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" minWidth="200"/>
|
||||
<ColumnConstraints halignment="RIGHT" minWidth="200.0"/>
|
||||
<ColumnConstraints hgrow="ALWAYS"/>
|
||||
<ColumnConstraints hgrow="NEVER" prefWidth="25.0"/>
|
||||
<ColumnConstraints/>
|
||||
</columnConstraints>
|
||||
|
||||
<rowConstraints>
|
||||
|
|
|
@ -93,10 +93,10 @@ public class CreateOfferPMTest {
|
|||
|
||||
|
||||
model.collateralAsLong.set(100);
|
||||
assertEquals("Collateral (10.0 %):", presenter.collateralLabel.get());
|
||||
assertEquals("Refundable collateral (10.0 %):", presenter.collateralLabel.get());
|
||||
|
||||
model.collateralAsLong.set(0);
|
||||
assertEquals("Collateral (0.0 %):", presenter.collateralLabel.get());
|
||||
assertEquals("Refundable collateral (0.0 %):", presenter.collateralLabel.get());
|
||||
|
||||
|
||||
model.bankAccountType.set(BankAccountType.SEPA.toString());
|
||||
|
|
|
@ -40,8 +40,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* For testing single isolated UI screens
|
||||
*/
|
||||
public class UITestRunner extends Application {
|
||||
private static final Logger log = LoggerFactory.getLogger(UITestRunner.class);
|
||||
public class CreateOfferUITestRunner extends Application {
|
||||
private static final Logger log = LoggerFactory.getLogger(CreateOfferUITestRunner.class);
|
||||
private Scene scene;
|
||||
private Pane view;
|
||||
private Pane pane;
|