Refactor gui package structure to avoid cyclic dependencies

This commit is contained in:
Manfred Karrer 2014-09-09 09:38:47 +02:00
parent 87a057cf5d
commit 173073caf8
52 changed files with 779 additions and 324 deletions

View file

@ -38,7 +38,7 @@ public class FeePolicy {
// The remaining 0.0000454 BTC is given to miners at the moment as it is lower then dust. // The remaining 0.0000454 BTC is given to miners at the moment as it is lower then dust.
public static final Coin REGISTRATION_FEE = TX_FEE.add(TX_FEE); public static final Coin REGISTRATION_FEE = TX_FEE.add(TX_FEE);
public static final Coin CREATE_OFFER_FEE = Coin.MILLICOIN; // 0.001 public static final Coin CREATE_OFFER_FEE = REGISTRATION_FEE; // 0.0002
public static final Coin TAKE_OFFER_FEE = CREATE_OFFER_FEE; public static final Coin TAKE_OFFER_FEE = CREATE_OFFER_FEE;
private static final Logger log = LoggerFactory.getLogger(FeePolicy.class); private static final Logger log = LoggerFactory.getLogger(FeePolicy.class);

View file

@ -20,38 +20,48 @@ package io.bitsquare.gui;
import io.bitsquare.gui.util.ImageUtil; import io.bitsquare.gui.util.ImageUtil;
public enum NavigationItem { public enum NavigationItem {
// app
MAIN("/io/bitsquare/gui/MainView.fxml"), MAIN("/io/bitsquare/gui/MainView.fxml"),
// main menu screens
HOME("/io/bitsquare/gui/home/HomeView.fxml", ImageUtil.HOME, ImageUtil.HOME_ACTIVE), HOME("/io/bitsquare/gui/home/HomeView.fxml", ImageUtil.HOME, ImageUtil.HOME_ACTIVE),
BUY("/io/bitsquare/gui/trade/BuyView.fxml", ImageUtil.NAV_BUY, ImageUtil.NAV_BUY_ACTIVE),
SELL("/io/bitsquare/gui/trade/SellView.fxml", ImageUtil.NAV_SELL, ImageUtil.NAV_SELL_ACTIVE),
ORDERS("/io/bitsquare/gui/orders/OrdersView.fxml", ImageUtil.ORDERS, ImageUtil.ORDERS_ACTIVE), ORDERS("/io/bitsquare/gui/orders/OrdersView.fxml", ImageUtil.ORDERS, ImageUtil.ORDERS_ACTIVE),
FUNDS("/io/bitsquare/gui/funds/FundsView.fxml", ImageUtil.FUNDS, ImageUtil.FUNDS_ACTIVE), FUNDS("/io/bitsquare/gui/funds/FundsView.fxml", ImageUtil.FUNDS, ImageUtil.FUNDS_ACTIVE),
MSG("/io/bitsquare/gui/msg/MsgView.fxml", ImageUtil.MSG, ImageUtil.MSG_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), SETTINGS("/io/bitsquare/gui/settings/SettingsView.fxml", ImageUtil.SETTINGS, ImageUtil.SETTINGS_ACTIVE),
ACCOUNT("/io/bitsquare/gui/account/AccountView.fxml", ImageUtil.ACCOUNT, ImageUtil.ACCOUNT_ACTIVE), ACCOUNT("/io/bitsquare/gui/view/AccountView.fxml", ImageUtil.ACCOUNT, ImageUtil.ACCOUNT_ACTIVE),
// trade
ORDER_BOOK("/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml"), ORDER_BOOK("/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml"),
BUY("/io/bitsquare/gui/trade/BuyView.fxml", ImageUtil.NAV_BUY, ImageUtil.NAV_BUY_ACTIVE),
SELL("/io/bitsquare/gui/trade/SellView.fxml", ImageUtil.NAV_SELL, ImageUtil.NAV_SELL_ACTIVE),
CREATE_OFFER("/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml"), CREATE_OFFER("/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml"),
TAKE_OFFER("/io/bitsquare/gui/trade/takeoffer/TakeOfferView.fxml"), TAKE_OFFER("/io/bitsquare/gui/trade/takeoffer/TakeOfferView.fxml"),
//OFFERER_TRADE("/io/bitsquare/gui/orders/OffererTradeView.fxml"),
// orders
OFFER("/io/bitsquare/gui/orders/offer/OfferView.fxml"), OFFER("/io/bitsquare/gui/orders/offer/OfferView.fxml"),
PENDING_TRADE("/io/bitsquare/gui/orders/pending/PendingTradeView.fxml"), PENDING_TRADE("/io/bitsquare/gui/orders/pending/PendingTradeView.fxml"),
CLOSED_TRADE("/io/bitsquare/gui/orders/closed/ClosedTradeView.fxml"), CLOSED_TRADE("/io/bitsquare/gui/orders/closed/ClosedTradeView.fxml"),
// funds
DEPOSIT("/io/bitsquare/gui/funds/deposit/DepositView.fxml"),
WITHDRAWAL("/io/bitsquare/gui/funds/withdrawal/WithdrawalView.fxml"), WITHDRAWAL("/io/bitsquare/gui/funds/withdrawal/WithdrawalView.fxml"),
TRANSACTIONS("/io/bitsquare/gui/funds/transactions/TransactionsView.fxml"), TRANSACTIONS("/io/bitsquare/gui/funds/transactions/TransactionsView.fxml"),
ACCOUNT_SETUP("/io/bitsquare/gui/account/setup/SetupView.fxml"), // account
ACCOUNT_SETTINGS("/io/bitsquare/gui/account/settings/AccountSettingsView.fxml"), ACCOUNT_SETUP("/io/bitsquare/gui/view/account/AccountSetupView.fxml"),
SEED_WORDS("/io/bitsquare/gui/account/seedwords/SeedWordsView.fxml"), ACCOUNT_SETTINGS("/io/bitsquare/gui/view/account/AccountSettingsView.fxml"),
ADD_PASSWORD("/io/bitsquare/gui/account/addpassword/PasswordView.fxml"),
CHANGE_PASSWORD("/io/bitsquare/gui/account/changepassword/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"),
// account content
SEED_WORDS("/io/bitsquare/gui/view/account/content/SeedWordsView.fxml"),
ADD_PASSWORD("/io/bitsquare/gui/view/account/content/PasswordView.fxml"),
CHANGE_PASSWORD("/io/bitsquare/gui/view/account/content/PasswordView.fxml"),
RESTRICTIONS("/io/bitsquare/gui/view/account/content/RestrictionsView.fxml"),
REGISTRATION("/io/bitsquare/gui/view/account/content/RegistrationView.fxml"),
FIAT_ACCOUNT("/io/bitsquare/gui/view/account/content/FiatAccountView.fxml"),
// arbitrator
ARBITRATOR_PROFILE("/io/bitsquare/gui/arbitrators/profile/ArbitratorProfileView.fxml"), ARBITRATOR_PROFILE("/io/bitsquare/gui/arbitrators/profile/ArbitratorProfileView.fxml"),
ARBITRATOR_BROWSER("/io/bitsquare/gui/arbitrators/browser/ArbitratorBrowserView.fxml"), ARBITRATOR_BROWSER("/io/bitsquare/gui/arbitrators/browser/ArbitratorBrowserView.fxml"),
ARBITRATOR_REGISTRATION("/io/bitsquare/gui/arbitrators/registration/ArbitratorRegistrationView.fxml"); ARBITRATOR_REGISTRATION("/io/bitsquare/gui/arbitrators/registration/ArbitratorRegistrationView.fxml");

View file

@ -58,7 +58,8 @@ public class FundsController extends CachedViewController {
public void initialize(URL url, ResourceBundle rb) { public void initialize(URL url, ResourceBundle rb) {
super.initialize(url, rb); super.initialize(url, rb);
((CachingTabPane) root).initialize(this, persistence, NavigationItem.WITHDRAWAL.getFxmlUrl(), ((CachingTabPane) root).initialize(
this, persistence, NavigationItem.DEPOSIT.getFxmlUrl(), NavigationItem.WITHDRAWAL.getFxmlUrl(),
NavigationItem.TRANSACTIONS.getFxmlUrl()); NavigationItem.TRANSACTIONS.getFxmlUrl());
} }

View file

@ -24,6 +24,7 @@
AnchorPane.topAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<Tab text="Deposit" closable="false"/>
<Tab text="Withdrawal" closable="false"/> <Tab text="Withdrawal" closable="false"/>
<Tab text="Transactions" closable="false"/> <Tab text="Transactions" closable="false"/>

View file

@ -0,0 +1,246 @@
/*
* 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.funds.deposit;
import io.bitsquare.btc.AddressEntry;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.gui.CachedViewController;
import java.net.URL;
import java.util.List;
import java.util.ResourceBundle;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.input.*;
import javafx.util.Callback;
import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// TODO: might be removed completely
public class DepositController extends CachedViewController {
private static final Logger log = LoggerFactory.getLogger(DepositController.class);
private final WalletFacade walletFacade;
private ObservableList<DepositListItem> addressList;
@FXML private TableView<DepositListItem> tableView;
@FXML private TableColumn<String, DepositListItem> labelColumn, addressColumn, balanceColumn, copyColumn,
confidenceColumn;
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private DepositController(WalletFacade walletFacade) {
this.walletFacade = walletFacade;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Lifecycle
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public void initialize(URL url, ResourceBundle rb) {
super.initialize(url, rb);
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
setLabelColumnCellFactory();
setBalanceColumnCellFactory();
setCopyColumnCellFactory();
setConfidenceColumnCellFactory();
}
@Override
public void deactivate() {
super.deactivate();
for (DepositListItem anAddressList : addressList)
anAddressList.cleanup();
}
@Override
public void activate() {
super.activate();
List<AddressEntry> addressEntryList = walletFacade.getAddressEntryList();
addressList = FXCollections.observableArrayList();
addressList.addAll(addressEntryList.stream().map(anAddressEntryList ->
new DepositListItem(anAddressEntryList, walletFacade)).collect(Collectors.toList()));
tableView.setItems(addressList);
}
///////////////////////////////////////////////////////////////////////////////////////////
// UI handlers
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Cell factories
///////////////////////////////////////////////////////////////////////////////////////////
private void setLabelColumnCellFactory() {
labelColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue()));
labelColumn.setCellFactory(new Callback<TableColumn<String, DepositListItem>, TableCell<String,
DepositListItem>>() {
@Override
public TableCell<String, DepositListItem> call(TableColumn<String, DepositListItem> column) {
return new TableCell<String, DepositListItem>() {
Hyperlink hyperlink;
@Override
public void updateItem(final DepositListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
hyperlink = new Hyperlink(item.getLabel());
hyperlink.setId("id-link");
if (item.getAddressEntry().getOfferId() != null) {
Tooltip tooltip = new Tooltip(item.getAddressEntry().getOfferId());
Tooltip.install(hyperlink, tooltip);
hyperlink.setOnAction(event ->
log.info("Show trade details " + item.getAddressEntry().getOfferId()));
}
setGraphic(hyperlink);
}
else {
setGraphic(null);
setId(null);
}
}
};
}
});
}
private void setBalanceColumnCellFactory() {
balanceColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue()));
balanceColumn.setCellFactory(
new Callback<TableColumn<String, DepositListItem>, TableCell<String, DepositListItem>>() {
@Override
public TableCell<String, DepositListItem> call(TableColumn<String, DepositListItem> column) {
return new TableCell<String, DepositListItem>() {
@Override
public void updateItem(final DepositListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
setGraphic(item.getBalanceLabel());
}
else {
setGraphic(null);
}
}
};
}
});
}
private void setCopyColumnCellFactory() {
copyColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue()));
copyColumn.setCellFactory(
new Callback<TableColumn<String, DepositListItem>, TableCell<String, DepositListItem>>() {
@Override
public TableCell<String, DepositListItem> call(TableColumn<String, DepositListItem> column) {
return new TableCell<String, DepositListItem>() {
final Label copyIcon = new Label();
{
copyIcon.getStyleClass().add("copy-icon");
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
Tooltip.install(copyIcon, new Tooltip("Copy address to clipboard"));
}
@Override
public void updateItem(final DepositListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
setGraphic(copyIcon);
copyIcon.setOnMouseClicked(e -> {
Clipboard clipboard = Clipboard.getSystemClipboard();
ClipboardContent content = new ClipboardContent();
content.putString(item.addressStringProperty().get());
clipboard.setContent(content);
});
}
else {
setGraphic(null);
}
}
};
}
});
}
private void setConfidenceColumnCellFactory() {
confidenceColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue
()));
confidenceColumn.setCellFactory(new Callback<TableColumn<String, DepositListItem>, TableCell<String,
DepositListItem>>() {
@Override
public TableCell<String, DepositListItem> call(TableColumn<String, DepositListItem> column) {
return new TableCell<String, DepositListItem>() {
@Override
public void updateItem(final DepositListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
setGraphic(item.getProgressIndicator());
}
else {
setGraphic(null);
}
}
};
}
});
}
}

View file

@ -0,0 +1,29 @@
/*
* 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.funds.deposit;
import io.bitsquare.btc.AddressEntry;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.gui.funds.withdrawal.WithdrawalListItem;
public class DepositListItem extends WithdrawalListItem {
public DepositListItem(AddressEntry addressEntry, WalletFacade walletFacade) {
super(addressEntry, walletFacade);
}
}

View file

@ -0,0 +1,42 @@
<?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.cell.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<VBox fx:id="root" fx:controller="io.bitsquare.gui.funds.deposit.DepositController"
spacing="10" xmlns:fx="http://javafx.com/fxml">
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
</padding>
<TableView fx:id="tableView" VBox.vgrow="ALWAYS">
<columns>
<TableColumn text="Label" fx:id="labelColumn" minWidth="100" sortable="false"/>
<TableColumn text="Address" fx:id="addressColumn" minWidth="240" sortable="false">
<cellValueFactory>
<PropertyValueFactory property="addressString"/>
</cellValueFactory>
</TableColumn>
<TableColumn text="Balance" fx:id="balanceColumn" minWidth="50" sortable="false"/>
<TableColumn text="Copy" fx:id="copyColumn" minWidth="30" sortable="false"/>
<TableColumn text="Status" fx:id="confidenceColumn" minWidth="30" sortable="false"/>
</columns>
</TableView>
</VBox>

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account; package io.bitsquare.gui.model;
import io.bitsquare.gui.UIModel; import io.bitsquare.gui.UIModel;
import io.bitsquare.user.User; import io.bitsquare.user.User;
@ -25,7 +25,7 @@ import com.google.inject.Inject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class AccountModel extends UIModel { public class AccountModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(AccountModel.class); private static final Logger log = LoggerFactory.getLogger(AccountModel.class);
private final User user; private final User user;
@ -54,7 +54,7 @@ class AccountModel extends UIModel {
// Getters // Getters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
boolean getNeedRegistration() { public boolean getNeedRegistration() {
return user.getAccountId() == null; return user.getAccountId() == null;
} }

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.settings; package io.bitsquare.gui.model.account;
import io.bitsquare.gui.UIModel; import io.bitsquare.gui.UIModel;
@ -24,7 +24,7 @@ import com.google.inject.Inject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class AccountSettingsModel extends UIModel { public class AccountSettingsModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(AccountSettingsModel.class); private static final Logger log = LoggerFactory.getLogger(AccountSettingsModel.class);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.setup; package io.bitsquare.gui.model.account;
import io.bitsquare.gui.UIModel; import io.bitsquare.gui.UIModel;
@ -24,15 +24,15 @@ import com.google.inject.Inject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class SetupModel extends UIModel { public class AccountSetupModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(SetupModel.class); private static final Logger log = LoggerFactory.getLogger(AccountSetupModel.class);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
private SetupModel() { private AccountSetupModel() {
} }

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.changepassword; package io.bitsquare.gui.model.account.content;
import io.bitsquare.gui.UIModel; import io.bitsquare.gui.UIModel;
@ -24,47 +24,55 @@ import com.google.inject.Inject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class PasswordModel extends UIModel { public class ChangePasswordModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(PasswordModel.class); private static final Logger log = LoggerFactory.getLogger(ChangePasswordModel.class);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
private PasswordModel() { private ChangePasswordModel() {
} }
void savePassword(String password) {
///////////////////////////////////////////////////////////////////////////////////////////
// Lifecycle
///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override
public void initialized() {
super.initialized();
}
@Override
public void activate() {
super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void terminate() {
super.terminate();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Public
///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
public void savePassword(String password) {
//TODO Implement password encryption for wallet //TODO Implement password encryption for wallet
} }
///////////////////////////////////////////////////////////////////////////////////////////
// Public methods
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Interface implementation: Initializable
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Getters
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
} }

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.fiataccount; package io.bitsquare.gui.model.account.content;
import io.bitsquare.bank.BankAccount; import io.bitsquare.bank.BankAccount;
import io.bitsquare.bank.BankAccountType; import io.bitsquare.bank.BankAccountType;
@ -44,29 +44,30 @@ import javafx.collections.ObservableList;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class FiatAccountModel extends UIModel { public class FiatAccountModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(FiatAccountModel.class); private static final Logger log = LoggerFactory.getLogger(FiatAccountModel.class);
private final User user; private final User user;
private final Settings settings; private final Settings settings;
private final Persistence persistence; private final Persistence persistence;
final StringProperty title = new SimpleStringProperty(); public final StringProperty title = new SimpleStringProperty();
final StringProperty holderName = new SimpleStringProperty(); public final StringProperty holderName = new SimpleStringProperty();
final StringProperty primaryID = new SimpleStringProperty(); public final StringProperty primaryID = new SimpleStringProperty();
final StringProperty secondaryID = new SimpleStringProperty(); public final StringProperty secondaryID = new SimpleStringProperty();
final StringProperty primaryIDPrompt = new SimpleStringProperty(); public final StringProperty primaryIDPrompt = new SimpleStringProperty();
final StringProperty secondaryIDPrompt = new SimpleStringProperty(); public final StringProperty secondaryIDPrompt = new SimpleStringProperty();
final BooleanProperty countryNotInAcceptedCountriesList = new SimpleBooleanProperty(); public final BooleanProperty countryNotInAcceptedCountriesList = new SimpleBooleanProperty();
final ObjectProperty<BankAccountType> type = new SimpleObjectProperty<>(); public final ObjectProperty<BankAccountType> type = new SimpleObjectProperty<>();
final ObjectProperty<Country> country = new SimpleObjectProperty<>(); public final ObjectProperty<Country> country = new SimpleObjectProperty<>();
final ObjectProperty<Currency> currency = new SimpleObjectProperty<>(); public final ObjectProperty<Currency> currency = new SimpleObjectProperty<>();
final ObjectProperty<BankAccount> currentBankAccount = new SimpleObjectProperty<>(); public final ObjectProperty<BankAccount> currentBankAccount = new SimpleObjectProperty<>();
final ObservableList<BankAccountType> allTypes = FXCollections.observableArrayList(BankAccountType public final ObservableList<BankAccountType> allTypes = FXCollections.observableArrayList(BankAccountType
.getAllBankAccountTypes()); .getAllBankAccountTypes());
final ObservableList<BankAccount> allBankAccounts = FXCollections.observableArrayList(); public final ObservableList<BankAccount> allBankAccounts = FXCollections.observableArrayList();
final ObservableList<Currency> allCurrencies = FXCollections.observableArrayList(CurrencyUtil.getAllCurrencies()); public final ObservableList<Currency> allCurrencies = FXCollections.observableArrayList(CurrencyUtil
final ObservableList<Region> allRegions = FXCollections.observableArrayList(CountryUtil.getAllRegions()); .getAllCurrencies());
public final ObservableList<Region> allRegions = FXCollections.observableArrayList(CountryUtil.getAllRegions());
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -85,6 +86,7 @@ class FiatAccountModel extends UIModel {
// Lifecycle // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override @Override
public void initialized() { public void initialized() {
super.initialized(); super.initialized();
@ -98,11 +100,13 @@ class FiatAccountModel extends UIModel {
allBankAccounts.setAll(user.getBankAccounts()); allBankAccounts.setAll(user.getBankAccounts());
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void deactivate() { public void deactivate() {
super.deactivate(); super.deactivate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void terminate() { public void terminate() {
super.terminate(); super.terminate();
@ -110,10 +114,10 @@ class FiatAccountModel extends UIModel {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Package scope // Public
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
void saveBankAccount() { public void saveBankAccount() {
BankAccount bankAccount = new BankAccount(type.get(), BankAccount bankAccount = new BankAccount(type.get(),
currency.get(), currency.get(),
country.get(), country.get(),
@ -128,7 +132,7 @@ class FiatAccountModel extends UIModel {
reset(); reset();
} }
void removeBankAccount() { public void removeBankAccount() {
user.removeCurrentBankAccount(); user.removeCurrentBankAccount();
saveUser(); saveUser();
allBankAccounts.setAll(user.getBankAccounts()); allBankAccounts.setAll(user.getBankAccounts());
@ -137,13 +141,13 @@ class FiatAccountModel extends UIModel {
// We ask the user if he likes to add his own bank account country to the accepted country list if he has not // We ask the user if he likes to add his own bank account country to the accepted country list if he has not
// already added it before // already added it before
void addCountryToAcceptedCountriesList() { public void addCountryToAcceptedCountriesList() {
settings.addAcceptedCountry(country.get()); settings.addAcceptedCountry(country.get());
saveSettings(); saveSettings();
countryNotInAcceptedCountriesList.set(false); countryNotInAcceptedCountriesList.set(false);
} }
void selectBankAccount(BankAccount bankAccount) { public void selectBankAccount(BankAccount bankAccount) {
currentBankAccount.set(bankAccount); currentBankAccount.set(bankAccount);
user.setCurrentBankAccount(bankAccount); user.setCurrentBankAccount(bankAccount);
@ -171,7 +175,7 @@ class FiatAccountModel extends UIModel {
// Getters // Getters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
ObservableList<Country> getAllCountriesFor(Region selectedRegion) { public ObservableList<Country> getAllCountriesFor(Region selectedRegion) {
return FXCollections.observableArrayList(CountryUtil.getAllCountriesFor(selectedRegion)); return FXCollections.observableArrayList(CountryUtil.getAllCountriesFor(selectedRegion));
} }
@ -180,7 +184,7 @@ class FiatAccountModel extends UIModel {
// Setters // Setters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
void setType(BankAccountType type) { public void setType(BankAccountType type) {
this.type.set(type); this.type.set(type);
if (type != null) { if (type != null) {
@ -193,11 +197,11 @@ class FiatAccountModel extends UIModel {
} }
} }
void setCountry(Country country) { public void setCountry(Country country) {
this.country.set(country); this.country.set(country);
} }
void setCurrency(Currency currency) { public void setCurrency(Currency currency) {
this.currency.set(currency); this.currency.set(currency);
} }

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.addpassword; package io.bitsquare.gui.model.account.content;
import io.bitsquare.gui.UIModel; import io.bitsquare.gui.UIModel;
@ -24,7 +24,7 @@ import com.google.inject.Inject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class PasswordModel extends UIModel { public class PasswordModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(PasswordModel.class); private static final Logger log = LoggerFactory.getLogger(PasswordModel.class);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -33,38 +33,45 @@ class PasswordModel extends UIModel {
@Inject @Inject
private PasswordModel() { private PasswordModel() {
} }
void savePassword(String password) {
///////////////////////////////////////////////////////////////////////////////////////////
// Lifecycle
///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override
public void initialized() {
super.initialized();
}
@Override
public void activate() {
super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void terminate() {
super.terminate();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Public
///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
public void savePassword(String password) {
//TODO Implement password encryption for wallet //TODO Implement password encryption for wallet
} }
///////////////////////////////////////////////////////////////////////////////////////////
// Public methods
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Interface implementation: Initializable
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Getters
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
} }

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.registration; package io.bitsquare.gui.model.account.content;
import io.bitsquare.btc.AddressEntry; import io.bitsquare.btc.AddressEntry;
import io.bitsquare.btc.FeePolicy; import io.bitsquare.btc.FeePolicy;
@ -45,17 +45,17 @@ import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class RegistrationModel extends UIModel { public class RegistrationModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(RegistrationModel.class); private static final Logger log = LoggerFactory.getLogger(RegistrationModel.class);
private final WalletFacade walletFacade; private final WalletFacade walletFacade;
private final User user; private final User user;
private final Persistence persistence; private final Persistence persistence;
AddressEntry addressEntry; public AddressEntry addressEntry;
final BooleanProperty isWalletFunded = new SimpleBooleanProperty(); public final BooleanProperty isWalletFunded = new SimpleBooleanProperty();
final BooleanProperty payFeeSuccess = new SimpleBooleanProperty(); public final BooleanProperty payFeeSuccess = new SimpleBooleanProperty();
private String transactionId; private String transactionId;
final StringProperty payFeeErrorMessage = new SimpleStringProperty(); public final StringProperty payFeeErrorMessage = new SimpleStringProperty();
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
@ -113,7 +113,7 @@ class RegistrationModel extends UIModel {
// Methods // Methods
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
void payFee() { public void payFee() {
FutureCallback<Transaction> callback = new FutureCallback<Transaction>() { FutureCallback<Transaction> callback = new FutureCallback<Transaction>() {
@Override @Override
public void onSuccess(@Nullable Transaction transaction) { public void onSuccess(@Nullable Transaction transaction) {
@ -148,15 +148,15 @@ class RegistrationModel extends UIModel {
// Getters // Getters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
WalletFacade getWalletFacade() { public WalletFacade getWalletFacade() {
return walletFacade; return walletFacade;
} }
Coin getFeeAsCoin() { public Coin getFeeAsCoin() {
return FeePolicy.REGISTRATION_FEE; return FeePolicy.REGISTRATION_FEE;
} }
String getTransactionId() { public String getTransactionId() {
return transactionId; return transactionId;
} }

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.restrictions; package io.bitsquare.gui.model.account.content;
import io.bitsquare.arbitrator.Arbitrator; import io.bitsquare.arbitrator.Arbitrator;
import io.bitsquare.arbitrator.Reputation; import io.bitsquare.arbitrator.Reputation;
@ -45,7 +45,7 @@ import javafx.collections.ObservableList;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class RestrictionsModel extends UIModel { public class RestrictionsModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(RestrictionsModel.class); private static final Logger log = LoggerFactory.getLogger(RestrictionsModel.class);
private final User user; private final User user;
@ -53,12 +53,13 @@ class RestrictionsModel extends UIModel {
private final Persistence persistence; private final Persistence persistence;
private final MessageFacade messageFacade; private final MessageFacade messageFacade;
ObservableList<Locale> languageList = FXCollections.observableArrayList(); public final ObservableList<Locale> languageList = FXCollections.observableArrayList();
ObservableList<Country> countryList = FXCollections.observableArrayList(); public final ObservableList<Country> countryList = FXCollections.observableArrayList();
ObservableList<Arbitrator> arbitratorList = FXCollections.observableArrayList(); public final ObservableList<Arbitrator> arbitratorList = FXCollections.observableArrayList();
final ObservableList<Locale> allLanguages = FXCollections.observableArrayList(LanguageUtil.getAllLanguageLocales()); public final ObservableList<Locale> allLanguages = FXCollections.observableArrayList(LanguageUtil
final ObservableList<Region> allRegions = FXCollections.observableArrayList(CountryUtil.getAllRegions()); .getAllLanguageLocales());
public final ObservableList<Region> allRegions = FXCollections.observableArrayList(CountryUtil.getAllRegions());
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -87,10 +88,6 @@ class RestrictionsModel extends UIModel {
settings.applyPersistedSettings(persistedSettings); settings.applyPersistedSettings(persistedSettings);
} }
else { else {
languageList = FXCollections.observableArrayList(new ArrayList<>());
countryList = FXCollections.observableArrayList(new ArrayList<>());
arbitratorList = FXCollections.observableArrayList(new ArrayList<>());
if (Locale.getDefault() != null) { if (Locale.getDefault() != null) {
addLanguage(LanguageUtil.getDefaultLanguageLocale()); addLanguage(LanguageUtil.getDefaultLanguageLocale());
addCountry(CountryUtil.getDefaultCountry()); addCountry(CountryUtil.getDefaultCountry());
@ -106,18 +103,19 @@ class RestrictionsModel extends UIModel {
@Override @Override
public void activate() { public void activate() {
super.activate(); super.activate();
languageList.setAll(settings.getAcceptedLanguageLocales());
languageList = FXCollections.observableArrayList(settings.getAcceptedLanguageLocales()); countryList.setAll(settings.getAcceptedCountries());
countryList = FXCollections.observableArrayList(settings.getAcceptedCountries()); arbitratorList.setAll(settings.getAcceptedArbitrators());
arbitratorList = FXCollections.observableArrayList(settings.getAcceptedArbitrators());
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void deactivate() { public void deactivate() {
super.deactivate(); super.deactivate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void terminate() { public void terminate() {
super.terminate(); super.terminate();
@ -125,31 +123,31 @@ class RestrictionsModel extends UIModel {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Package scope // Public
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
ObservableList<Country> getAllCountriesFor(Region selectedRegion) { public ObservableList<Country> getAllCountriesFor(Region selectedRegion) {
return FXCollections.observableArrayList(CountryUtil.getAllCountriesFor(selectedRegion)); return FXCollections.observableArrayList(CountryUtil.getAllCountriesFor(selectedRegion));
} }
void updateArbitratorList() { public void updateArbitratorList() {
arbitratorList = FXCollections.observableArrayList(settings.getAcceptedArbitrators()); arbitratorList.setAll(settings.getAcceptedArbitrators());
} }
void addLanguage(Locale locale) { public void addLanguage(Locale locale) {
if (locale != null && !languageList.contains(locale)) { if (locale != null && !languageList.contains(locale)) {
languageList.add(locale); languageList.add(locale);
settings.addAcceptedLanguageLocale(locale); settings.addAcceptedLanguageLocale(locale);
} }
} }
void removeLanguage(Locale locale) { public void removeLanguage(Locale locale) {
languageList.remove(locale); languageList.remove(locale);
settings.removeAcceptedLanguageLocale(locale); settings.removeAcceptedLanguageLocale(locale);
saveSettings(); saveSettings();
} }
void addCountry(Country country) { public void addCountry(Country country) {
if (!countryList.contains(country) && country != null) { if (!countryList.contains(country) && country != null) {
countryList.add(country); countryList.add(country);
settings.addAcceptedCountry(country); settings.addAcceptedCountry(country);
@ -157,22 +155,22 @@ class RestrictionsModel extends UIModel {
} }
} }
ObservableList<Country> getListWithAllEuroCountries() { public ObservableList<Country> getListWithAllEuroCountries() {
// TODO use Set instead of List // TODO use Set instead of List
// In addAcceptedCountry there is a check to no add duplicates, so it works correctly for now // In addAcceptedCountry there is a check to no add duplicates, so it works correctly for now
CountryUtil.getAllEuroCountries().stream().forEach(settings::addAcceptedCountry); CountryUtil.getAllEuroCountries().stream().forEach(settings::addAcceptedCountry);
countryList = FXCollections.observableArrayList(settings.getAcceptedCountries()); countryList.setAll(settings.getAcceptedCountries());
saveSettings(); saveSettings();
return countryList; return countryList;
} }
void removeCountry(Country country) { public void removeCountry(Country country) {
countryList.remove(country); countryList.remove(country);
settings.removeAcceptedCountry(country); settings.removeAcceptedCountry(country);
saveSettings(); saveSettings();
} }
void removeArbitrator(Arbitrator arbitrator) { public void removeArbitrator(Arbitrator arbitrator) {
arbitratorList.remove(arbitrator); arbitratorList.remove(arbitrator);
settings.removeAcceptedArbitrator(arbitrator); settings.removeAcceptedArbitrator(arbitrator);
saveSettings(); saveSettings();

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.seedwords; package io.bitsquare.gui.model.account.content;
import io.bitsquare.btc.WalletFacade; import io.bitsquare.btc.WalletFacade;
import io.bitsquare.gui.UIModel; import io.bitsquare.gui.UIModel;
@ -27,10 +27,10 @@ import java.util.List;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class SeedWordsModel extends UIModel { public class SeedWordsModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(SeedWordsModel.class); private static final Logger log = LoggerFactory.getLogger(SeedWordsModel.class);
List<String> mnemonicCode; public List<String> mnemonicCode;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -15,16 +15,17 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account; package io.bitsquare.gui.pm;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.model.AccountModel;
import com.google.inject.Inject; import com.google.inject.Inject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class AccountPM extends PresentationModel<AccountModel> { public class AccountPM extends PresentationModel<AccountModel> {
private static final Logger log = LoggerFactory.getLogger(AccountPM.class); private static final Logger log = LoggerFactory.getLogger(AccountPM.class);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -51,7 +52,7 @@ class AccountPM extends PresentationModel<AccountModel> {
// Getters // Getters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
boolean getNeedRegistration() { public boolean getNeedRegistration() {
return model.getNeedRegistration(); return model.getNeedRegistration();
} }

View file

@ -15,16 +15,17 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.settings; package io.bitsquare.gui.pm.account;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.model.account.AccountSettingsModel;
import com.google.inject.Inject; import com.google.inject.Inject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class AccountSettingsPM extends PresentationModel<AccountSettingsModel> { public class AccountSettingsPM extends PresentationModel<AccountSettingsModel> {
private static final Logger log = LoggerFactory.getLogger(AccountSettingsPM.class); private static final Logger log = LoggerFactory.getLogger(AccountSettingsPM.class);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -15,24 +15,25 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.setup; package io.bitsquare.gui.pm.account;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.model.account.AccountSetupModel;
import com.google.inject.Inject; import com.google.inject.Inject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class SetupPM extends PresentationModel<SetupModel> { public class AccountSetupPM extends PresentationModel<AccountSetupModel> {
private static final Logger log = LoggerFactory.getLogger(SetupPM.class); private static final Logger log = LoggerFactory.getLogger(AccountSetupPM.class);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
private SetupPM(SetupModel model) { private AccountSetupPM(AccountSetupModel model) {
super(model); super(model);
} }

View file

@ -15,9 +15,10 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.addpassword; package io.bitsquare.gui.pm.account.content;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.model.account.content.ChangePasswordModel;
import io.bitsquare.gui.util.validation.InputValidator; import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.gui.util.validation.PasswordValidator; import io.bitsquare.gui.util.validation.PasswordValidator;
@ -31,22 +32,22 @@ import javafx.beans.property.StringProperty;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class PasswordPM extends PresentationModel<PasswordModel> { public class ChangePasswordPM extends PresentationModel<ChangePasswordModel> {
private static final Logger log = LoggerFactory.getLogger(PasswordPM.class); private static final Logger log = LoggerFactory.getLogger(ChangePasswordPM.class);
private final PasswordValidator passwordValidator = new PasswordValidator(); private final PasswordValidator passwordValidator = new PasswordValidator();
String errorMessage; private String errorMessage;
final StringProperty passwordField = new SimpleStringProperty(); public final StringProperty passwordField = new SimpleStringProperty();
final StringProperty repeatedPasswordField = new SimpleStringProperty(); public final StringProperty repeatedPasswordField = new SimpleStringProperty();
final BooleanProperty saveButtonDisabled = new SimpleBooleanProperty(true); public final BooleanProperty saveButtonDisabled = new SimpleBooleanProperty(true);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
private PasswordPM(PasswordModel model) { private ChangePasswordPM(ChangePasswordModel model) {
super(model); super(model);
passwordField.addListener((ov) -> saveButtonDisabled.set(!validate())); passwordField.addListener((ov) -> saveButtonDisabled.set(!validate()));
@ -58,12 +59,35 @@ class PasswordPM extends PresentationModel<PasswordModel> {
// Lifecycle // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override @Override
public void initialized() { public void initialized() {
super.initialized(); super.initialized();
} }
boolean savePassword() { @Override
public void activate() {
super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void terminate() {
super.terminate();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Public
///////////////////////////////////////////////////////////////////////////////////////////
public boolean savePassword() {
if (validate()) { if (validate()) {
model.savePassword(passwordField.get()); model.savePassword(passwordField.get());
return true; return true;
@ -71,7 +95,16 @@ class PasswordPM extends PresentationModel<PasswordModel> {
return false; return false;
} }
boolean validate() { public String getErrorMessage() {
return errorMessage;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Private
///////////////////////////////////////////////////////////////////////////////////////////
private boolean validate() {
InputValidator.ValidationResult result = passwordValidator.validate(passwordField.get()); InputValidator.ValidationResult result = passwordValidator.validate(passwordField.get());
if (result.isValid) { if (result.isValid) {
result = passwordValidator.validate(repeatedPasswordField.get()); result = passwordValidator.validate(repeatedPasswordField.get());
@ -90,4 +123,6 @@ class PasswordPM extends PresentationModel<PasswordModel> {
} }
return false; return false;
} }
} }

View file

@ -15,11 +15,12 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.fiataccount; package io.bitsquare.gui.pm.account.content;
import io.bitsquare.bank.BankAccount; import io.bitsquare.bank.BankAccount;
import io.bitsquare.bank.BankAccountType; import io.bitsquare.bank.BankAccountType;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.model.account.content.FiatAccountModel;
import io.bitsquare.gui.util.validation.BankAccountNumberValidator; import io.bitsquare.gui.util.validation.BankAccountNumberValidator;
import io.bitsquare.gui.util.validation.InputValidator; import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.locale.BSResources; import io.bitsquare.locale.BSResources;
@ -43,24 +44,24 @@ import javafx.util.StringConverter;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class FiatAccountPm extends PresentationModel<FiatAccountModel> { public class FiatAccountPm extends PresentationModel<FiatAccountModel> {
private static final Logger log = LoggerFactory.getLogger(FiatAccountPm.class); private static final Logger log = LoggerFactory.getLogger(FiatAccountPm.class);
private final BankAccountNumberValidator validator = new BankAccountNumberValidator(); private final BankAccountNumberValidator validator = new BankAccountNumberValidator();
final StringProperty title = new SimpleStringProperty(); public final StringProperty title = new SimpleStringProperty();
final StringProperty holderName = new SimpleStringProperty(); public final StringProperty holderName = new SimpleStringProperty();
final StringProperty primaryID = new SimpleStringProperty(); public final StringProperty primaryID = new SimpleStringProperty();
final StringProperty secondaryID = new SimpleStringProperty(); public final StringProperty secondaryID = new SimpleStringProperty();
final StringProperty primaryIDPrompt = new SimpleStringProperty(); public final StringProperty primaryIDPrompt = new SimpleStringProperty();
final StringProperty secondaryIDPrompt = new SimpleStringProperty(); public final StringProperty secondaryIDPrompt = new SimpleStringProperty();
final StringProperty selectionPrompt = new SimpleStringProperty(); public final StringProperty selectionPrompt = new SimpleStringProperty();
final BooleanProperty selectionDisable = new SimpleBooleanProperty(); public final BooleanProperty selectionDisable = new SimpleBooleanProperty();
final BooleanProperty saveButtonDisable = new SimpleBooleanProperty(true); public final BooleanProperty saveButtonDisable = new SimpleBooleanProperty(true);
final ObjectProperty<BankAccountType> type = new SimpleObjectProperty<>(); public final ObjectProperty<BankAccountType> type = new SimpleObjectProperty<>();
final ObjectProperty<Country> country = new SimpleObjectProperty<>(); public final ObjectProperty<Country> country = new SimpleObjectProperty<>();
final ObjectProperty<Currency> currency = new SimpleObjectProperty<>(); public final ObjectProperty<Currency> currency = new SimpleObjectProperty<>();
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -118,11 +119,13 @@ class FiatAccountPm extends PresentationModel<FiatAccountModel> {
}); });
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void deactivate() { public void deactivate() {
super.deactivate(); super.deactivate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void terminate() { public void terminate() {
super.terminate(); super.terminate();
@ -130,10 +133,10 @@ class FiatAccountPm extends PresentationModel<FiatAccountModel> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Package scope // Public
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
InputValidator.ValidationResult saveBankAccount() { public InputValidator.ValidationResult saveBankAccount() {
InputValidator.ValidationResult result = validateInput(); InputValidator.ValidationResult result = validateInput();
if (result.isValid) { if (result.isValid) {
model.saveBankAccount(); model.saveBankAccount();
@ -141,15 +144,15 @@ class FiatAccountPm extends PresentationModel<FiatAccountModel> {
return result; return result;
} }
void removeBankAccount() { public void removeBankAccount() {
model.removeBankAccount(); model.removeBankAccount();
} }
void addCountryToAcceptedCountriesList() { public void addCountryToAcceptedCountriesList() {
model.addCountryToAcceptedCountriesList(); model.addCountryToAcceptedCountriesList();
} }
void selectBankAccount(BankAccount bankAccount) { public void selectBankAccount(BankAccount bankAccount) {
model.selectBankAccount(bankAccount); model.selectBankAccount(bankAccount);
} }
@ -158,7 +161,7 @@ class FiatAccountPm extends PresentationModel<FiatAccountModel> {
// Converters // Converters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
StringConverter<BankAccountType> getTypesConverter() { public StringConverter<BankAccountType> getTypesConverter() {
return new StringConverter<BankAccountType>() { return new StringConverter<BankAccountType>() {
@Override @Override
public String toString(BankAccountType TypeInfo) { public String toString(BankAccountType TypeInfo) {
@ -172,7 +175,7 @@ class FiatAccountPm extends PresentationModel<FiatAccountModel> {
}; };
} }
StringConverter<BankAccount> getSelectionConverter() { public StringConverter<BankAccount> getSelectionConverter() {
return new StringConverter<BankAccount>() { return new StringConverter<BankAccount>() {
@Override @Override
public String toString(BankAccount bankAccount) { public String toString(BankAccount bankAccount) {
@ -186,7 +189,7 @@ class FiatAccountPm extends PresentationModel<FiatAccountModel> {
}; };
} }
StringConverter<Currency> getCurrencyConverter() { public StringConverter<Currency> getCurrencyConverter() {
return new StringConverter<Currency>() { return new StringConverter<Currency>() {
@Override @Override
@ -202,7 +205,7 @@ class FiatAccountPm extends PresentationModel<FiatAccountModel> {
}; };
} }
StringConverter<Region> getRegionConverter() { public StringConverter<Region> getRegionConverter() {
return new StringConverter<io.bitsquare.locale.Region>() { return new StringConverter<io.bitsquare.locale.Region>() {
@Override @Override
public String toString(io.bitsquare.locale.Region region) { public String toString(io.bitsquare.locale.Region region) {
@ -216,7 +219,7 @@ class FiatAccountPm extends PresentationModel<FiatAccountModel> {
}; };
} }
StringConverter<Country> getCountryConverter() { public StringConverter<Country> getCountryConverter() {
return new StringConverter<Country>() { return new StringConverter<Country>() {
@Override @Override
public String toString(Country country) { public String toString(Country country) {
@ -235,31 +238,31 @@ class FiatAccountPm extends PresentationModel<FiatAccountModel> {
// Getters // Getters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
ObservableList<BankAccountType> getAllTypes() { public ObservableList<BankAccountType> getAllTypes() {
return model.allTypes; return model.allTypes;
} }
ObjectProperty<BankAccount> getCurrentBankAccount() { public ObjectProperty<BankAccount> getCurrentBankAccount() {
return model.currentBankAccount; return model.currentBankAccount;
} }
ObservableList<BankAccount> getAllBankAccounts() { public ObservableList<BankAccount> getAllBankAccounts() {
return model.allBankAccounts; return model.allBankAccounts;
} }
ObservableList<Currency> getAllCurrencies() { public ObservableList<Currency> getAllCurrencies() {
return model.allCurrencies; return model.allCurrencies;
} }
ObservableList<Region> getAllRegions() { public ObservableList<Region> getAllRegions() {
return model.allRegions; return model.allRegions;
} }
ObservableList<Country> getAllCountriesFor(Region selectedRegion) { public ObservableList<Country> getAllCountriesFor(Region selectedRegion) {
return model.getAllCountriesFor(selectedRegion); return model.getAllCountriesFor(selectedRegion);
} }
BooleanProperty getCountryNotInAcceptedCountriesList() { public BooleanProperty getCountryNotInAcceptedCountriesList() {
return model.countryNotInAcceptedCountriesList; return model.countryNotInAcceptedCountriesList;
} }
@ -268,26 +271,26 @@ class FiatAccountPm extends PresentationModel<FiatAccountModel> {
// Setters // Setters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
void setType(BankAccountType type) { public void setType(BankAccountType type) {
model.setType(type); model.setType(type);
validateInput(); validateInput();
} }
void setCountry(Country country) { public void setCountry(Country country) {
model.setCountry(country); model.setCountry(country);
validateInput(); validateInput();
} }
void setCurrency(Currency currency) { public void setCurrency(Currency currency) {
model.setCurrency(currency); model.setCurrency(currency);
validateInput(); validateInput();
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Private methods // Private methods
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private InputValidator.ValidationResult validateInput() { private InputValidator.ValidationResult validateInput() {
InputValidator.ValidationResult result = validator.validate(model.title.get()); InputValidator.ValidationResult result = validator.validate(model.title.get());
if (result.isValid) { if (result.isValid) {

View file

@ -15,9 +15,10 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.changepassword; package io.bitsquare.gui.pm.account.content;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.model.account.content.PasswordModel;
import io.bitsquare.gui.util.validation.InputValidator; import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.gui.util.validation.PasswordValidator; import io.bitsquare.gui.util.validation.PasswordValidator;
@ -31,15 +32,15 @@ import javafx.beans.property.StringProperty;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class PasswordPM extends PresentationModel<PasswordModel> { public class PasswordPM extends PresentationModel<PasswordModel> {
private static final Logger log = LoggerFactory.getLogger(PasswordPM.class); private static final Logger log = LoggerFactory.getLogger(PasswordPM.class);
private final PasswordValidator passwordValidator = new PasswordValidator(); private final PasswordValidator passwordValidator = new PasswordValidator();
String errorMessage; private String errorMessage;
final StringProperty passwordField = new SimpleStringProperty(); public final StringProperty passwordField = new SimpleStringProperty();
final StringProperty repeatedPasswordField = new SimpleStringProperty(); public final StringProperty repeatedPasswordField = new SimpleStringProperty();
final BooleanProperty saveButtonDisabled = new SimpleBooleanProperty(true); public final BooleanProperty saveButtonDisabled = new SimpleBooleanProperty(true);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
@ -58,12 +59,35 @@ class PasswordPM extends PresentationModel<PasswordModel> {
// Lifecycle // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override @Override
public void initialized() { public void initialized() {
super.initialized(); super.initialized();
} }
boolean savePassword() { @Override
public void activate() {
super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void terminate() {
super.terminate();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Public
///////////////////////////////////////////////////////////////////////////////////////////
public boolean savePassword() {
if (validate()) { if (validate()) {
model.savePassword(passwordField.get()); model.savePassword(passwordField.get());
return true; return true;
@ -71,7 +95,16 @@ class PasswordPM extends PresentationModel<PasswordModel> {
return false; return false;
} }
boolean validate() { public String getErrorMessage() {
return errorMessage;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Private
///////////////////////////////////////////////////////////////////////////////////////////
private boolean validate() {
InputValidator.ValidationResult result = passwordValidator.validate(passwordField.get()); InputValidator.ValidationResult result = passwordValidator.validate(passwordField.get());
if (result.isValid) { if (result.isValid) {
result = passwordValidator.validate(repeatedPasswordField.get()); result = passwordValidator.validate(repeatedPasswordField.get());

View file

@ -15,10 +15,11 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.registration; package io.bitsquare.gui.pm.account.content;
import io.bitsquare.btc.WalletFacade; import io.bitsquare.btc.WalletFacade;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.model.account.content.RegistrationModel;
import io.bitsquare.locale.BSResources; import io.bitsquare.locale.BSResources;
import com.google.bitcoin.core.Address; import com.google.bitcoin.core.Address;
@ -38,14 +39,14 @@ import org.slf4j.LoggerFactory;
import static io.bitsquare.gui.util.BSFormatter.formatCoinWithCode; import static io.bitsquare.gui.util.BSFormatter.formatCoinWithCode;
class RegistrationPM extends PresentationModel<RegistrationModel> { public class RegistrationPM extends PresentationModel<RegistrationModel> {
private static final Logger log = LoggerFactory.getLogger(RegistrationPM.class); private static final Logger log = LoggerFactory.getLogger(RegistrationPM.class);
// Those are needed for the addressTextField // Those are needed for the addressTextField
final ObjectProperty<Address> address = new SimpleObjectProperty<>(); public final ObjectProperty<Address> address = new SimpleObjectProperty<>();
final BooleanProperty isPayButtonDisabled = new SimpleBooleanProperty(true); public final BooleanProperty isPayButtonDisabled = new SimpleBooleanProperty(true);
final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty(); public final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty();
final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty(); public final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty();
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -105,7 +106,7 @@ class RegistrationPM extends PresentationModel<RegistrationModel> {
// UI actions (called by CB) // UI actions (called by CB)
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
void payFee() { public void payFee() {
model.payFeeErrorMessage.set(null); model.payFeeErrorMessage.set(null);
model.payFeeSuccess.set(false); model.payFeeSuccess.set(false);
@ -119,27 +120,27 @@ class RegistrationPM extends PresentationModel<RegistrationModel> {
// Getters (called by CB) // Getters (called by CB)
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
WalletFacade getWalletFacade() { public WalletFacade getWalletFacade() {
return model.getWalletFacade(); return model.getWalletFacade();
} }
Coin getFeeAsCoin() { public Coin getFeeAsCoin() {
return model.getFeeAsCoin(); return model.getFeeAsCoin();
} }
String getAddressAsString() { public String getAddressAsString() {
return model.addressEntry != null ? model.addressEntry.getAddress().toString() : ""; return model.addressEntry != null ? model.addressEntry.getAddress().toString() : "";
} }
String getPaymentLabel() { public String getPaymentLabel() {
return BSResources.get("Bitsquare account registration fee"); return BSResources.get("Bitsquare account registration fee");
} }
String getFeeAsString() { public String getFeeAsString() {
return formatCoinWithCode(model.getFeeAsCoin()); return formatCoinWithCode(model.getFeeAsCoin());
} }
String getTransactionId() { public String getTransactionId() {
return model.getTransactionId(); return model.getTransactionId();
} }

View file

@ -15,10 +15,11 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.restrictions; package io.bitsquare.gui.pm.account.content;
import io.bitsquare.arbitrator.Arbitrator; import io.bitsquare.arbitrator.Arbitrator;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.model.account.content.RestrictionsModel;
import io.bitsquare.locale.Country; import io.bitsquare.locale.Country;
import io.bitsquare.locale.Region; import io.bitsquare.locale.Region;
@ -33,7 +34,7 @@ import javafx.collections.ObservableList;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class RestrictionsPM extends PresentationModel<RestrictionsModel> { public class RestrictionsPM extends PresentationModel<RestrictionsModel> {
private static final Logger log = LoggerFactory.getLogger(RestrictionsPM.class); private static final Logger log = LoggerFactory.getLogger(RestrictionsPM.class);
@ -54,6 +55,7 @@ class RestrictionsPM extends PresentationModel<RestrictionsModel> {
// Lifecycle // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override @Override
public void initialized() { public void initialized() {
super.initialized(); super.initialized();
@ -67,6 +69,7 @@ class RestrictionsPM extends PresentationModel<RestrictionsModel> {
updateDoneButtonDisabled(); updateDoneButtonDisabled();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void deactivate() { public void deactivate() {
super.deactivate(); super.deactivate();
@ -74,75 +77,75 @@ class RestrictionsPM extends PresentationModel<RestrictionsModel> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Package scope // Public
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
void onAddLanguage(Locale locale) { public void onAddLanguage(Locale locale) {
model.addLanguage(locale); model.addLanguage(locale);
updateDoneButtonDisabled(); updateDoneButtonDisabled();
} }
ObservableList<Locale> getLanguageList() { public ObservableList<Locale> getLanguageList() {
updateDoneButtonDisabled(); updateDoneButtonDisabled();
return model.languageList; return model.languageList;
} }
ObservableList<Locale> getAllLanguages() { public ObservableList<Locale> getAllLanguages() {
updateDoneButtonDisabled(); updateDoneButtonDisabled();
return model.allLanguages; return model.allLanguages;
} }
void removeLanguage(Locale locale) { public void removeLanguage(Locale locale) {
model.removeLanguage(locale); model.removeLanguage(locale);
updateDoneButtonDisabled(); updateDoneButtonDisabled();
} }
void onAddCountry(Country country) { public void onAddCountry(Country country) {
model.addCountry(country); model.addCountry(country);
updateDoneButtonDisabled(); updateDoneButtonDisabled();
} }
ObservableList<Country> getListWithAllEuroCountries() { public ObservableList<Country> getListWithAllEuroCountries() {
ObservableList<Country> result = model.getListWithAllEuroCountries(); ObservableList<Country> result = model.getListWithAllEuroCountries();
updateDoneButtonDisabled(); updateDoneButtonDisabled();
return result; return result;
} }
ObservableList<Country> getAllCountriesFor(Region selectedRegion) { public ObservableList<Country> getAllCountriesFor(Region selectedRegion) {
return model.getAllCountriesFor(selectedRegion); return model.getAllCountriesFor(selectedRegion);
} }
ObservableList<Region> getAllRegions() { public ObservableList<Region> getAllRegions() {
return model.allRegions; return model.allRegions;
} }
ObservableList<Country> getCountryList() { public ObservableList<Country> getCountryList() {
updateDoneButtonDisabled(); updateDoneButtonDisabled();
return model.countryList; return model.countryList;
} }
void removeCountry(Country country) { public void removeCountry(Country country) {
model.removeCountry(country); model.removeCountry(country);
updateDoneButtonDisabled(); updateDoneButtonDisabled();
} }
ObservableList<Arbitrator> getArbitratorList() { public ObservableList<Arbitrator> getArbitratorList() {
updateDoneButtonDisabled(); updateDoneButtonDisabled();
return model.arbitratorList; return model.arbitratorList;
} }
void removeArbitrator(Arbitrator arbitrator) { public void removeArbitrator(Arbitrator arbitrator) {
model.removeArbitrator(arbitrator); model.removeArbitrator(arbitrator);
updateDoneButtonDisabled(); updateDoneButtonDisabled();
} }
void updateArbitratorList() { public void updateArbitratorList() {
model.updateArbitratorList(); model.updateArbitratorList();
updateDoneButtonDisabled(); updateDoneButtonDisabled();
} }
//TODO Revert -1 to 0(2 later). For mock testing disabled arbitratorList test //TODO Revert size() > -1 to 0(2 later). For mock testing disabled arbitratorList test
void updateDoneButtonDisabled() { public void updateDoneButtonDisabled() {
boolean isValid = model.languageList != null && model.languageList.size() > 0 && boolean isValid = model.languageList != null && model.languageList.size() > 0 &&
model.countryList != null && model.countryList.size() > 0 && model.countryList != null && model.countryList.size() > 0 &&
model.arbitratorList != null && model.arbitratorList.size() > -1; model.arbitratorList != null && model.arbitratorList.size() > -1;

View file

@ -15,9 +15,10 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.seedwords; package io.bitsquare.gui.pm.account.content;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.model.account.content.SeedWordsModel;
import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.BSFormatter;
import com.google.inject.Inject; import com.google.inject.Inject;
@ -28,10 +29,10 @@ import javafx.beans.property.StringProperty;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class SeedWordsPM extends PresentationModel<SeedWordsModel> { public class SeedWordsPM extends PresentationModel<SeedWordsModel> {
private static final Logger log = LoggerFactory.getLogger(SeedWordsPM.class); private static final Logger log = LoggerFactory.getLogger(SeedWordsPM.class);
final StringProperty seedWords = new SimpleStringProperty(); public final StringProperty seedWords = new SimpleStringProperty();
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -15,12 +15,13 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account; package io.bitsquare.gui.view;
import io.bitsquare.gui.CachedCodeBehind; import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.CodeBehind; import io.bitsquare.gui.CodeBehind;
import io.bitsquare.gui.MainController; import io.bitsquare.gui.MainController;
import io.bitsquare.gui.NavigationItem; import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.pm.AccountPM;
import io.bitsquare.util.BSFXMLLoader; import io.bitsquare.util.BSFXMLLoader;
import java.io.IOException; import java.io.IOException;
@ -58,6 +59,7 @@ public class AccountCB extends CachedCodeBehind<AccountPM> {
// Lifecycle // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override @Override
public void initialize(URL url, ResourceBundle rb) { public void initialize(URL url, ResourceBundle rb) {
super.initialize(url, rb); super.initialize(url, rb);
@ -79,11 +81,13 @@ public class AccountCB extends CachedCodeBehind<AccountPM> {
} }
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void deactivate() { public void deactivate() {
super.deactivate(); super.deactivate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void terminate() { public void terminate() {
super.terminate(); super.terminate();

View file

@ -19,7 +19,7 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<TabPane fx:id="root" fx:controller="io.bitsquare.gui.account.AccountCB" <TabPane fx:id="root" fx:controller="io.bitsquare.gui.view.AccountCB"
prefHeight="630.0" prefWidth="1000.0" prefHeight="630.0" prefWidth="1000.0"
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0" AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0" AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"

View file

@ -15,12 +15,13 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.settings; package io.bitsquare.gui.view.account;
import io.bitsquare.gui.CachedCodeBehind; import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.CodeBehind; import io.bitsquare.gui.CodeBehind;
import io.bitsquare.gui.NavigationItem; import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.pm.account.AccountSettingsPM;
import io.bitsquare.util.BSFXMLLoader; import io.bitsquare.util.BSFXMLLoader;
import java.io.IOException; import java.io.IOException;
@ -87,16 +88,19 @@ public class AccountSettingsCB extends CachedCodeBehind<AccountSettingsPM> {
seedWords.fire(); seedWords.fire();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void activate() { public void activate() {
super.activate(); super.activate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void deactivate() { public void deactivate() {
super.deactivate(); super.deactivate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void terminate() { public void terminate() {
super.terminate(); super.terminate();

View file

@ -19,7 +19,7 @@
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.account.settings.AccountSettingsCB" <AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.AccountSettingsCB"
prefHeight="660.0" prefWidth="1000.0" prefHeight="660.0" prefWidth="1000.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">

View file

@ -15,19 +15,20 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.setup; package io.bitsquare.gui.view.account;
import io.bitsquare.gui.CachedCodeBehind; import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.CodeBehind; import io.bitsquare.gui.CodeBehind;
import io.bitsquare.gui.NavigationItem; import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.account.AccountCB; import io.bitsquare.gui.pm.account.AccountSetupPM;
import io.bitsquare.gui.account.addpassword.PasswordCB;
import io.bitsquare.gui.account.fiataccount.FiatAccountCB;
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 io.bitsquare.gui.util.ImageUtil;
import io.bitsquare.gui.view.AccountCB;
import io.bitsquare.gui.view.account.content.FiatAccountCB;
import io.bitsquare.gui.view.account.content.PasswordCB;
import io.bitsquare.gui.view.account.content.RegistrationCB;
import io.bitsquare.gui.view.account.content.RestrictionsCB;
import io.bitsquare.gui.view.account.content.SeedWordsCB;
import io.bitsquare.util.BSFXMLLoader; import io.bitsquare.util.BSFXMLLoader;
import java.io.IOException; import java.io.IOException;
@ -47,9 +48,9 @@ import javafx.scene.layout.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class SetupCB extends CachedCodeBehind<SetupPM> { public class AccountSetupCB extends CachedCodeBehind<AccountSetupPM> {
private static final Logger log = LoggerFactory.getLogger(SetupCB.class); private static final Logger log = LoggerFactory.getLogger(AccountSetupCB.class);
public VBox leftVBox; public VBox leftVBox;
public AnchorPane content; public AnchorPane content;
private WizardItem seedWords, password, fiatAccount, restrictions, registration; private WizardItem seedWords, password, fiatAccount, restrictions, registration;
@ -59,7 +60,7 @@ public class SetupCB extends CachedCodeBehind<SetupPM> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
private SetupCB(SetupPM presentationModel) { private AccountSetupCB(AccountSetupPM presentationModel) {
super(presentationModel); super(presentationModel);
} }
@ -91,16 +92,19 @@ public class SetupCB extends CachedCodeBehind<SetupPM> {
childController = seedWords.show(); childController = seedWords.show();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void activate() { public void activate() {
super.activate(); super.activate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void deactivate() { public void deactivate() {
super.deactivate(); super.deactivate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void terminate() { public void terminate() {
super.terminate(); super.terminate();
@ -159,14 +163,14 @@ class WizardItem extends HBox {
private final ImageView imageView; private final ImageView imageView;
private final Label titleLabel; private final Label titleLabel;
private final Label subTitleLabel; private final Label subTitleLabel;
private final SetupCB parentCB; private final AccountSetupCB parentCB;
private final Parent content; private final Parent content;
private final NavigationItem navigationItem; private final NavigationItem navigationItem;
private CodeBehind<? extends PresentationModel> childController; private CodeBehind<? extends PresentationModel> childController;
WizardItem(SetupCB parentCB, Parent content, String title, String subTitle, NavigationItem navigationItem) { WizardItem(AccountSetupCB parentCB, Parent content, String title, String subTitle, NavigationItem navigationItem) {
this.parentCB = parentCB; this.parentCB = parentCB;
this.content = content; this.content = content;
this.navigationItem = navigationItem; this.navigationItem = navigationItem;

View file

@ -19,7 +19,7 @@
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.account.setup.SetupCB" <AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.AccountSetupCB"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<VBox fx:id="leftVBox" spacing="5" prefWidth="300" AnchorPane.bottomAnchor="20" AnchorPane.leftAnchor="20" <VBox fx:id="leftVBox" spacing="5" prefWidth="300" AnchorPane.bottomAnchor="20" AnchorPane.leftAnchor="20"

View file

@ -15,13 +15,14 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.changepassword; package io.bitsquare.gui.view.account.content;
import io.bitsquare.gui.CachedCodeBehind; import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.account.settings.AccountSettingsCB;
import io.bitsquare.gui.account.setup.SetupCB;
import io.bitsquare.gui.help.Help; import io.bitsquare.gui.help.Help;
import io.bitsquare.gui.help.HelpId; import io.bitsquare.gui.help.HelpId;
import io.bitsquare.gui.pm.account.content.ChangePasswordPM;
import io.bitsquare.gui.view.account.AccountSettingsCB;
import io.bitsquare.gui.view.account.AccountSetupCB;
import java.net.URL; import java.net.URL;
@ -37,9 +38,9 @@ import javafx.scene.layout.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class PasswordCB extends CachedCodeBehind<PasswordPM> { public class ChangePasswordCB extends CachedCodeBehind<ChangePasswordPM> {
private static final Logger log = LoggerFactory.getLogger(PasswordCB.class); private static final Logger log = LoggerFactory.getLogger(ChangePasswordCB.class);
@FXML private HBox buttonsHBox; @FXML private HBox buttonsHBox;
@FXML private Button saveButton, skipButton; @FXML private Button saveButton, skipButton;
@ -51,7 +52,7 @@ class PasswordCB extends CachedCodeBehind<PasswordPM> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
private PasswordCB(PasswordPM presentationModel) { private ChangePasswordCB(ChangePasswordPM presentationModel) {
super(presentationModel); super(presentationModel);
} }
@ -70,21 +71,25 @@ class PasswordCB extends CachedCodeBehind<PasswordPM> {
saveButton.disableProperty().bind(presentationModel.saveButtonDisabled); saveButton.disableProperty().bind(presentationModel.saveButtonDisabled);
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void activate() { public void activate() {
super.activate(); super.activate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void deactivate() { public void deactivate() {
super.deactivate(); super.deactivate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void terminate() { public void terminate() {
super.terminate(); super.terminate();
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Override from CodeBehind // Override from CodeBehind
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -105,11 +110,11 @@ class PasswordCB extends CachedCodeBehind<PasswordPM> {
private void onSaved() { private void onSaved() {
boolean result = presentationModel.savePassword(); boolean result = presentationModel.savePassword();
if (result) { if (result) {
if (parentController instanceof SetupCB) if (parentController instanceof AccountSetupCB)
((SetupCB) parentController).onCompleted(this); ((AccountSetupCB) parentController).onCompleted(this);
} }
else { else {
log.debug(presentationModel.errorMessage); // TODO use validating TF log.debug(presentationModel.getErrorMessage()); // TODO use validating TF
} }
} }
@ -118,15 +123,11 @@ class PasswordCB extends CachedCodeBehind<PasswordPM> {
Help.openWindow(HelpId.SETUP_PASSWORD); Help.openWindow(HelpId.SETUP_PASSWORD);
} }
public void onSkipped() { @FXML
if (parentController instanceof SetupCB) private void onSkipped() {
((SetupCB) parentController).onCompleted(this); if (parentController instanceof AccountSetupCB)
((AccountSetupCB) parentController).onCompleted(this);
} }
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
} }

View file

@ -21,7 +21,7 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.addpassword.PasswordCB" hgap="5.0" vgap="5.0" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.ChangePasswordCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">

View file

@ -15,18 +15,19 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.fiataccount; package io.bitsquare.gui.view.account.content;
import io.bitsquare.bank.BankAccount; import io.bitsquare.bank.BankAccount;
import io.bitsquare.bank.BankAccountType; import io.bitsquare.bank.BankAccountType;
import io.bitsquare.gui.CachedCodeBehind; import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.account.settings.AccountSettingsCB;
import io.bitsquare.gui.account.setup.SetupCB;
import io.bitsquare.gui.components.InputTextField; import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.components.Popups; import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.help.Help; import io.bitsquare.gui.help.Help;
import io.bitsquare.gui.help.HelpId; import io.bitsquare.gui.help.HelpId;
import io.bitsquare.gui.pm.account.content.FiatAccountPm;
import io.bitsquare.gui.util.validation.InputValidator; import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.gui.view.account.AccountSettingsCB;
import io.bitsquare.gui.view.account.AccountSetupCB;
import io.bitsquare.locale.Country; import io.bitsquare.locale.Country;
import io.bitsquare.locale.Region; import io.bitsquare.locale.Region;
@ -87,6 +88,7 @@ public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> {
typesComboBox.setItems(presentationModel.getAllTypes()); typesComboBox.setItems(presentationModel.getAllTypes());
typesComboBox.setConverter(presentationModel.getTypesConverter()); typesComboBox.setConverter(presentationModel.getTypesConverter());
selectionComboBox.setItems(presentationModel.getAllBankAccounts());
selectionComboBox.setConverter(presentationModel.getSelectionConverter()); selectionComboBox.setConverter(presentationModel.getSelectionConverter());
currencyComboBox.setItems(presentationModel.getAllCurrencies()); currencyComboBox.setItems(presentationModel.getAllCurrencies());
currencyComboBox.setConverter(presentationModel.getCurrencyConverter()); currencyComboBox.setConverter(presentationModel.getCurrencyConverter());
@ -106,15 +108,15 @@ public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> {
setupListeners(); setupListeners();
setupBindings(); setupBindings();
selectionComboBox.setItems(presentationModel.getAllBankAccounts());
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void deactivate() { public void deactivate() {
super.deactivate(); super.deactivate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void terminate() { public void terminate() {
super.terminate(); super.terminate();
@ -179,7 +181,7 @@ public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> {
@FXML @FXML
private void onCompleted() { private void onCompleted() {
if (parentController != null) if (parentController != null)
((SetupCB) parentController).onCompleted(this); ((AccountSetupCB) parentController).onCompleted(this);
} }
@FXML @FXML

View file

@ -23,7 +23,7 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.fiataccount.FiatAccountCB" hgap="5.0" vgap="5.0" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.FiatAccountCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">

View file

@ -15,13 +15,14 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.addpassword; package io.bitsquare.gui.view.account.content;
import io.bitsquare.gui.CachedCodeBehind; import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.account.settings.AccountSettingsCB;
import io.bitsquare.gui.account.setup.SetupCB;
import io.bitsquare.gui.help.Help; import io.bitsquare.gui.help.Help;
import io.bitsquare.gui.help.HelpId; import io.bitsquare.gui.help.HelpId;
import io.bitsquare.gui.pm.account.content.PasswordPM;
import io.bitsquare.gui.view.account.AccountSettingsCB;
import io.bitsquare.gui.view.account.AccountSetupCB;
import java.net.URL; import java.net.URL;
@ -70,21 +71,25 @@ public class PasswordCB extends CachedCodeBehind<PasswordPM> {
saveButton.disableProperty().bind(presentationModel.saveButtonDisabled); saveButton.disableProperty().bind(presentationModel.saveButtonDisabled);
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void activate() { public void activate() {
super.activate(); super.activate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void deactivate() { public void deactivate() {
super.deactivate(); super.deactivate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void terminate() { public void terminate() {
super.terminate(); super.terminate();
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Override from CodeBehind // Override from CodeBehind
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -106,25 +111,24 @@ public class PasswordCB extends CachedCodeBehind<PasswordPM> {
private void onSaved() { private void onSaved() {
boolean result = presentationModel.savePassword(); boolean result = presentationModel.savePassword();
if (result) { if (result) {
if (parentController instanceof SetupCB) if (parentController instanceof AccountSetupCB)
((SetupCB) parentController).onCompleted(this); ((AccountSetupCB) parentController).onCompleted(this);
} }
else { else {
log.debug(presentationModel.errorMessage); // TODO use validating TF // TODO use validating passwordTF
log.debug(presentationModel.getErrorMessage());
} }
} }
@FXML @FXML
private void onSkipped() { private void onSkipped() {
if (parentController instanceof SetupCB) if (parentController instanceof AccountSetupCB)
((SetupCB) parentController).onCompleted(this); ((AccountSetupCB) parentController).onCompleted(this);
} }
@FXML @FXML
private void onOpenHelp() { private void onOpenHelp() {
Help.openWindow(HelpId.SETUP_PASSWORD); Help.openWindow(HelpId.SETUP_PASSWORD);
} }
} }

View file

@ -21,7 +21,7 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.addpassword.PasswordCB" hgap="5.0" vgap="5.0" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.PasswordCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">

View file

@ -15,17 +15,18 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.registration; package io.bitsquare.gui.view.account.content;
import io.bitsquare.gui.CachedCodeBehind; import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.MainController; import io.bitsquare.gui.MainController;
import io.bitsquare.gui.account.settings.AccountSettingsCB;
import io.bitsquare.gui.account.setup.SetupCB;
import io.bitsquare.gui.components.Popups; import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.components.btc.AddressTextField; import io.bitsquare.gui.components.btc.AddressTextField;
import io.bitsquare.gui.components.btc.BalanceTextField; import io.bitsquare.gui.components.btc.BalanceTextField;
import io.bitsquare.gui.help.Help; import io.bitsquare.gui.help.Help;
import io.bitsquare.gui.help.HelpId; import io.bitsquare.gui.help.HelpId;
import io.bitsquare.gui.pm.account.content.RegistrationPM;
import io.bitsquare.gui.view.account.AccountSettingsCB;
import io.bitsquare.gui.view.account.AccountSetupCB;
import io.bitsquare.locale.BSResources; import io.bitsquare.locale.BSResources;
import java.net.URL; import java.net.URL;
@ -112,8 +113,8 @@ public class RegistrationCB extends CachedCodeBehind<RegistrationPM> {
@Override @Override
public void handle(ActionEvent actionEvent) { public void handle(ActionEvent actionEvent) {
try { try {
if (parentController instanceof SetupCB) if (parentController instanceof AccountSetupCB)
((SetupCB) parentController).onCompleted(RegistrationCB.this); ((AccountSetupCB) parentController).onCompleted(RegistrationCB.this);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -131,17 +132,20 @@ public class RegistrationCB extends CachedCodeBehind<RegistrationPM> {
}); });
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void activate() { public void activate() {
super.activate(); super.activate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void deactivate() { public void deactivate() {
super.deactivate(); super.deactivate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void terminate() { public void terminate() {
super.terminate(); super.terminate();

View file

@ -23,7 +23,7 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.registration.RegistrationCB" hgap="5.0" vgap="5.0" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.RegistrationCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">

View file

@ -15,17 +15,18 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.restrictions; package io.bitsquare.gui.view.account.content;
import io.bitsquare.BitSquare; import io.bitsquare.BitSquare;
import io.bitsquare.arbitrator.Arbitrator; import io.bitsquare.arbitrator.Arbitrator;
import io.bitsquare.gui.CachedCodeBehind; import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.NavigationItem; import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.account.settings.AccountSettingsCB;
import io.bitsquare.gui.account.setup.SetupCB;
import io.bitsquare.gui.help.Help; import io.bitsquare.gui.help.Help;
import io.bitsquare.gui.help.HelpId; import io.bitsquare.gui.help.HelpId;
import io.bitsquare.gui.pm.account.content.RestrictionsPM;
import io.bitsquare.gui.util.ImageUtil; import io.bitsquare.gui.util.ImageUtil;
import io.bitsquare.gui.view.account.AccountSettingsCB;
import io.bitsquare.gui.view.account.AccountSetupCB;
import io.bitsquare.locale.Country; import io.bitsquare.locale.Country;
import io.bitsquare.locale.Region; import io.bitsquare.locale.Region;
import io.bitsquare.util.BSFXMLLoader; import io.bitsquare.util.BSFXMLLoader;
@ -98,11 +99,13 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> {
arbitratorsListView.setItems(presentationModel.getArbitratorList()); arbitratorsListView.setItems(presentationModel.getArbitratorList());
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void deactivate() { public void deactivate() {
super.deactivate(); super.deactivate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void terminate() { public void terminate() {
super.terminate(); super.terminate();
@ -160,8 +163,8 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> {
@FXML @FXML
private void onCompleted() { private void onCompleted() {
if (parentController instanceof SetupCB) if (parentController instanceof AccountSetupCB)
((SetupCB) parentController).onCompleted(this); ((AccountSetupCB) parentController).onCompleted(this);
} }
@FXML @FXML

View file

@ -20,7 +20,7 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.restrictions.RestrictionsCB" hgap="5.0" vgap="5.0" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.RestrictionsCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">

View file

@ -15,13 +15,14 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.account.seedwords; package io.bitsquare.gui.view.account.content;
import io.bitsquare.gui.CachedCodeBehind; import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.account.settings.AccountSettingsCB;
import io.bitsquare.gui.account.setup.SetupCB;
import io.bitsquare.gui.help.Help; import io.bitsquare.gui.help.Help;
import io.bitsquare.gui.help.HelpId; import io.bitsquare.gui.help.HelpId;
import io.bitsquare.gui.pm.account.content.SeedWordsPM;
import io.bitsquare.gui.view.account.AccountSettingsCB;
import io.bitsquare.gui.view.account.AccountSetupCB;
import java.net.URL; import java.net.URL;
@ -66,16 +67,19 @@ public class SeedWordsCB extends CachedCodeBehind<SeedWordsPM> {
seedWordsTextArea.setText(presentationModel.seedWords.get()); seedWordsTextArea.setText(presentationModel.seedWords.get());
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void activate() { public void activate() {
super.activate(); super.activate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void deactivate() { public void deactivate() {
super.deactivate(); super.deactivate();
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void terminate() { public void terminate() {
super.terminate(); super.terminate();
@ -101,8 +105,8 @@ public class SeedWordsCB extends CachedCodeBehind<SeedWordsPM> {
@FXML @FXML
private void onCompleted() { private void onCompleted() {
if (parentController instanceof SetupCB) if (parentController instanceof AccountSetupCB)
((SetupCB) parentController).onCompleted(this); ((AccountSetupCB) parentController).onCompleted(this);
} }
@FXML @FXML

View file

@ -22,7 +22,7 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?> <?import javafx.scene.text.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.seedwords.SeedWordsCB" hgap="5.0" vgap="5.0" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.view.account.content.SeedWordsCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">

View file

@ -49,7 +49,7 @@ public class BSResources {
return BSResources.getResourceBundle().getString(key); return BSResources.getResourceBundle().getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
log.error("MissingResourceException for key: " + key); log.error("MissingResourceException for key: " + key);
return "# " + key; return key;
} }
} }

View file

@ -68,7 +68,7 @@ public class AccountSettingsUITestRunner extends Application {
log.debug("re load"); log.debug("re load");
pane.getChildren().removeAll(); pane.getChildren().removeAll();
BSFXMLLoader loader = new BSFXMLLoader( BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/settings/AccountSettingsView.fxml"), false); getUrl("/io/bitsquare/gui/view/account/AccountSettingsView.fxml"), false);
try { try {
view = loader.load(); view = loader.load();
pane.getChildren().setAll(view); pane.getChildren().setAll(view);

View file

@ -68,7 +68,7 @@ public class AccountUITestRunner extends Application {
log.debug("re load"); log.debug("re load");
pane.getChildren().removeAll(); pane.getChildren().removeAll();
BSFXMLLoader loader = new BSFXMLLoader( BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/AccountView.fxml"), false); getUrl("/io/bitsquare/gui/view/AccountView.fxml"), false);
try { try {
view = loader.load(); view = loader.load();
pane.getChildren().setAll(view); pane.getChildren().setAll(view);

View file

@ -68,7 +68,7 @@ public class RegistrationUITestRunner extends Application {
log.debug("re load"); log.debug("re load");
pane.getChildren().removeAll(); pane.getChildren().removeAll();
BSFXMLLoader loader = new BSFXMLLoader( BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/registration/RegistrationView.fxml"), false); getUrl("/io/bitsquare/gui/view/account/content/RegistrationView.fxml"), false);
try { try {
view = loader.load(); view = loader.load();
pane.getChildren().setAll(view); pane.getChildren().setAll(view);

View file

@ -68,7 +68,7 @@ public class FiatAccountUITestRunner extends Application {
log.debug("re load"); log.debug("re load");
pane.getChildren().removeAll(); pane.getChildren().removeAll();
BSFXMLLoader loader = new BSFXMLLoader( BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/fiataccount/FiatAccountView.fxml"), false); getUrl("/io/bitsquare/gui/view/account/content/FiatAccountView.fxml"), false);
try { try {
view = loader.load(); view = loader.load();
pane.getChildren().setAll(view); pane.getChildren().setAll(view);

View file

@ -68,7 +68,7 @@ public class PasswordUITestRunner extends Application {
log.debug("re load"); log.debug("re load");
pane.getChildren().removeAll(); pane.getChildren().removeAll();
BSFXMLLoader loader = new BSFXMLLoader( BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/addpassword/PasswordView.fxml"), false); getUrl("/io/bitsquare/gui/view/account/content/PasswordView.fxml"), false);
try { try {
view = loader.load(); view = loader.load();
pane.getChildren().setAll(view); pane.getChildren().setAll(view);

View file

@ -68,7 +68,7 @@ public class RegistrationUITestRunner extends Application {
log.debug("re load"); log.debug("re load");
pane.getChildren().removeAll(); pane.getChildren().removeAll();
BSFXMLLoader loader = new BSFXMLLoader( BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/registration/RegistrationView.fxml"), false); getUrl("/io/bitsquare/gui/view/account/content/RegistrationView.fxml"), false);
try { try {
view = loader.load(); view = loader.load();
pane.getChildren().setAll(view); pane.getChildren().setAll(view);

View file

@ -68,7 +68,7 @@ public class RestrictionsUITestRunner extends Application {
log.debug("re load"); log.debug("re load");
pane.getChildren().removeAll(); pane.getChildren().removeAll();
BSFXMLLoader loader = new BSFXMLLoader( BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/restrictions/RestrictionsView.fxml"), false); getUrl("/io/bitsquare/gui/view/account/content/RestrictionsView.fxml"), false);
try { try {
view = loader.load(); view = loader.load();
pane.getChildren().setAll(view); pane.getChildren().setAll(view);

View file

@ -68,7 +68,7 @@ public class SeedWordsUITestRunner extends Application {
log.debug("re load"); log.debug("re load");
pane.getChildren().removeAll(); pane.getChildren().removeAll();
BSFXMLLoader loader = new BSFXMLLoader( BSFXMLLoader loader = new BSFXMLLoader(
getUrl("/io/bitsquare/gui/account/seedwords/SeedWordsView.fxml"), false); getUrl("/io/bitsquare/gui/view/account/content/SeedWordsView.fxml"), false);
try { try {
view = loader.load(); view = loader.load();
pane.getChildren().setAll(view); pane.getChildren().setAll(view);