Cleanup account UIs

This commit is contained in:
Manfred Karrer 2014-09-09 10:51:06 +02:00
parent a51aafbdbd
commit 11cff6dcdb
28 changed files with 336 additions and 245 deletions

View file

@ -27,27 +27,46 @@ import org.slf4j.LoggerFactory;
public 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;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
private AccountModel(User user) { private AccountModel(User user) {
this.user = user; this.user = user;
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Public methods // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override
public void initialized() {
super.initialized();
}
/////////////////////////////////////////////////////////////////////////////////////////// @Override
// Interface implementation: Initializable public void activate() {
/////////////////////////////////////////////////////////////////////////////////////////// super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void terminate() {
super.terminate();
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -58,14 +77,6 @@ public class AccountModel extends UIModel {
return user.getAccountId() == null; return user.getAccountId() == null;
} }
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
} }

View file

@ -27,39 +27,42 @@ import org.slf4j.LoggerFactory;
public 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);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
private AccountSettingsModel() { private AccountSettingsModel() {
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Public methods // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override
public void initialized() {
super.initialized();
}
/////////////////////////////////////////////////////////////////////////////////////////// @Override
// Interface implementation: Initializable public void activate() {
/////////////////////////////////////////////////////////////////////////////////////////// super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
/////////////////////////////////////////////////////////////////////////////////////////// @SuppressWarnings("EmptyMethod")
// Getters @Override
/////////////////////////////////////////////////////////////////////////////////////////// public void terminate() {
super.terminate();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
} }

View file

@ -27,39 +27,41 @@ import org.slf4j.LoggerFactory;
public class AccountSetupModel extends UIModel { public class AccountSetupModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(AccountSetupModel.class); private static final Logger log = LoggerFactory.getLogger(AccountSetupModel.class);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
private AccountSetupModel() { private AccountSetupModel() {
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Public methods // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override
public void initialized() {
super.initialized();
}
/////////////////////////////////////////////////////////////////////////////////////////// @Override
// Interface implementation: Initializable public void activate() {
/////////////////////////////////////////////////////////////////////////////////////////// super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
/////////////////////////////////////////////////////////////////////////////////////////// @SuppressWarnings("EmptyMethod")
// Getters @Override
/////////////////////////////////////////////////////////////////////////////////////////// public void terminate() {
super.terminate();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
} }

View file

@ -33,7 +33,6 @@ public class ChangePasswordModel extends UIModel {
@Inject @Inject
private ChangePasswordModel() { private ChangePasswordModel() {
} }

View file

@ -62,6 +62,7 @@ public class FiatAccountModel extends UIModel {
public final ObjectProperty<Country> country = new SimpleObjectProperty<>(); public final ObjectProperty<Country> country = new SimpleObjectProperty<>();
public final ObjectProperty<Currency> currency = new SimpleObjectProperty<>(); public final ObjectProperty<Currency> currency = new SimpleObjectProperty<>();
public final ObjectProperty<BankAccount> currentBankAccount = new SimpleObjectProperty<>(); public final ObjectProperty<BankAccount> currentBankAccount = new SimpleObjectProperty<>();
public final ObservableList<BankAccountType> allTypes = FXCollections.observableArrayList(BankAccountType public final ObservableList<BankAccountType> allTypes = FXCollections.observableArrayList(BankAccountType
.getAllBankAccountTypes()); .getAllBankAccountTypes());
public final ObservableList<BankAccount> allBankAccounts = FXCollections.observableArrayList(); public final ObservableList<BankAccount> allBankAccounts = FXCollections.observableArrayList();

View file

@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory;
public 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);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -51,12 +51,15 @@ public class RegistrationModel extends UIModel {
private final WalletFacade walletFacade; private final WalletFacade walletFacade;
private final User user; private final User user;
private final Persistence persistence; private final Persistence persistence;
public AddressEntry addressEntry;
private String transactionId;
private AddressEntry addressEntry;
public final BooleanProperty isWalletFunded = new SimpleBooleanProperty(); public final BooleanProperty isWalletFunded = new SimpleBooleanProperty();
public final BooleanProperty payFeeSuccess = new SimpleBooleanProperty(); public final BooleanProperty payFeeSuccess = new SimpleBooleanProperty();
private String transactionId;
public final StringProperty payFeeErrorMessage = new SimpleStringProperty(); public final StringProperty payFeeErrorMessage = new SimpleStringProperty();
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -80,13 +83,13 @@ public class RegistrationModel extends UIModel {
if (walletFacade != null && walletFacade.getWallet() != null) { if (walletFacade != null && walletFacade.getWallet() != null) {
addressEntry = walletFacade.getRegistrationAddressEntry(); addressEntry = walletFacade.getRegistrationAddressEntry();
walletFacade.addBalanceListener(new BalanceListener(addressEntry.getAddress()) { walletFacade.addBalanceListener(new BalanceListener(getAddressEntry().getAddress()) {
@Override @Override
public void onBalanceChanged(@NotNull Coin balance) { public void onBalanceChanged(@NotNull Coin balance) {
updateBalance(balance); updateBalance(balance);
} }
}); });
updateBalance(walletFacade.getBalanceForAddress(addressEntry.getAddress())); updateBalance(walletFacade.getBalanceForAddress(getAddressEntry().getAddress()));
} }
} }
@ -122,8 +125,8 @@ public class RegistrationModel extends UIModel {
transactionId = transaction.getHashAsString(); transactionId = transaction.getHashAsString();
log.info("payRegistrationFee onSuccess tx id:" + transaction.getHashAsString()); log.info("payRegistrationFee onSuccess tx id:" + transaction.getHashAsString());
if (addressEntry != null) if (getAddressEntry() != null)
user.setAccountID(addressEntry.toString()); user.setAccountID(getAddressEntry().toString());
persistence.write(user.getClass().getName(), user); persistence.write(user.getClass().getName(), user);
payFeeSuccess.set(true); payFeeSuccess.set(true);
@ -160,6 +163,11 @@ public class RegistrationModel extends UIModel {
return transactionId; return transactionId;
} }
public AddressEntry getAddressEntry() {
return addressEntry;
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Private // Private
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -167,4 +175,5 @@ public class RegistrationModel extends UIModel {
private void updateBalance(@NotNull Coin balance) { private void updateBalance(@NotNull Coin balance) {
isWalletFunded.set(balance.compareTo(getFeeAsCoin()) >= 0); isWalletFunded.set(balance.compareTo(getFeeAsCoin()) >= 0);
} }
} }

View file

@ -56,7 +56,6 @@ public class RestrictionsModel extends UIModel {
public final ObservableList<Locale> languageList = FXCollections.observableArrayList(); public final ObservableList<Locale> languageList = FXCollections.observableArrayList();
public final ObservableList<Country> countryList = FXCollections.observableArrayList(); public final ObservableList<Country> countryList = FXCollections.observableArrayList();
public final ObservableList<Arbitrator> arbitratorList = FXCollections.observableArrayList(); public final ObservableList<Arbitrator> arbitratorList = FXCollections.observableArrayList();
public final ObservableList<Locale> allLanguages = FXCollections.observableArrayList(LanguageUtil public final ObservableList<Locale> allLanguages = FXCollections.observableArrayList(LanguageUtil
.getAllLanguageLocales()); .getAllLanguageLocales());
public final ObservableList<Region> allRegions = FXCollections.observableArrayList(CountryUtil.getAllRegions()); public final ObservableList<Region> allRegions = FXCollections.observableArrayList(CountryUtil.getAllRegions());
@ -185,6 +184,7 @@ public class RestrictionsModel extends UIModel {
persistence.write(settings); persistence.write(settings);
} }
// TODO Remove mock later
private void addMockArbitrator() { private void addMockArbitrator() {
if (settings.getAcceptedArbitrators().isEmpty() && user.getMessageKeyPair() != null) { if (settings.getAcceptedArbitrators().isEmpty() && user.getMessageKeyPair() != null) {
String pubKeyAsHex = Utils.HEX.encode(new ECKey().getPubKey()); String pubKeyAsHex = Utils.HEX.encode(new ECKey().getPubKey());

View file

@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
public 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);
public List<String> mnemonicCode; private List<String> mnemonicCode;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -43,4 +43,40 @@ public class SeedWordsModel extends UIModel {
mnemonicCode = walletFacade.getWallet().getKeyChainSeed().getMnemonicCode(); mnemonicCode = walletFacade.getWallet().getKeyChainSeed().getMnemonicCode();
} }
///////////////////////////////////////////////////////////////////////////////////////////
// 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();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Getter
///////////////////////////////////////////////////////////////////////////////////////////
public List<String> getMnemonicCode() {
return mnemonicCode;
}
} }

View file

@ -74,6 +74,9 @@ public class CreateOfferModel extends UIModel {
private final String offerId; private final String offerId;
@Nullable private Direction direction = null;
private AddressEntry addressEntry;
public final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty(); public final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty();
public final StringProperty transactionId = new SimpleStringProperty(); public final StringProperty transactionId = new SimpleStringProperty();
public final StringProperty bankAccountCurrency = new SimpleStringProperty(); public final StringProperty bankAccountCurrency = new SimpleStringProperty();
@ -101,9 +104,6 @@ public class CreateOfferModel extends UIModel {
public final ObservableList<Locale> acceptedLanguages = FXCollections.observableArrayList(); public final ObservableList<Locale> acceptedLanguages = FXCollections.observableArrayList();
public final ObservableList<Arbitrator> acceptedArbitrators = FXCollections.observableArrayList(); public final ObservableList<Arbitrator> acceptedArbitrators = FXCollections.observableArrayList();
@Nullable private Direction direction = null;
private AddressEntry addressEntry;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor

View file

@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory;
public 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);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -39,13 +40,31 @@ public class AccountPM extends PresentationModel<AccountModel> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Public methods // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override
public void initialized() {
super.initialized();
}
/////////////////////////////////////////////////////////////////////////////////////////// @Override
// Interface implementation: Initializable public void activate() {
/////////////////////////////////////////////////////////////////////////////////////////// super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void terminate() {
super.terminate();
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -56,14 +75,4 @@ public class AccountPM extends PresentationModel<AccountModel> {
return model.getNeedRegistration(); return model.getNeedRegistration();
} }
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
} }

View file

@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory;
public 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);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -39,28 +40,30 @@ public class AccountSettingsPM extends PresentationModel<AccountSettingsModel> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Public methods // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override
public void initialized() {
super.initialized();
}
/////////////////////////////////////////////////////////////////////////////////////////// @Override
// Interface implementation: Initializable public void activate() {
/////////////////////////////////////////////////////////////////////////////////////////// super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
/////////////////////////////////////////////////////////////////////////////////////////// @SuppressWarnings("EmptyMethod")
// Getters @Override
/////////////////////////////////////////////////////////////////////////////////////////// public void terminate() {
super.terminate();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
} }

View file

@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory;
public class AccountSetupPM extends PresentationModel<AccountSetupModel> { public class AccountSetupPM extends PresentationModel<AccountSetupModel> {
private static final Logger log = LoggerFactory.getLogger(AccountSetupPM.class); private static final Logger log = LoggerFactory.getLogger(AccountSetupPM.class);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -39,28 +40,30 @@ public class AccountSetupPM extends PresentationModel<AccountSetupModel> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Public methods // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override
public void initialized() {
super.initialized();
}
/////////////////////////////////////////////////////////////////////////////////////////// @Override
// Interface implementation: Initializable public void activate() {
/////////////////////////////////////////////////////////////////////////////////////////// super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
/////////////////////////////////////////////////////////////////////////////////////////// @SuppressWarnings("EmptyMethod")
// Getters @Override
/////////////////////////////////////////////////////////////////////////////////////////// public void terminate() {
super.terminate();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
} }

View file

@ -38,10 +38,12 @@ public class ChangePasswordPM extends PresentationModel<ChangePasswordModel> {
private final PasswordValidator passwordValidator = new PasswordValidator(); private final PasswordValidator passwordValidator = new PasswordValidator();
private String errorMessage; private String errorMessage;
public final StringProperty passwordField = new SimpleStringProperty(); public final StringProperty passwordField = new SimpleStringProperty();
public final StringProperty repeatedPasswordField = new SimpleStringProperty(); public final StringProperty repeatedPasswordField = new SimpleStringProperty();
public final BooleanProperty saveButtonDisabled = new SimpleBooleanProperty(true); public final BooleanProperty saveButtonDisabled = new SimpleBooleanProperty(true);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -87,7 +89,7 @@ public class ChangePasswordPM extends PresentationModel<ChangePasswordModel> {
// Public // Public
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public boolean savePassword() { public boolean requestSavePassword() {
if (validate()) { if (validate()) {
model.savePassword(passwordField.get()); model.savePassword(passwordField.get());
return true; return true;

View file

@ -58,7 +58,6 @@ public class FiatAccountPm extends PresentationModel<FiatAccountModel> {
public final StringProperty selectionPrompt = new SimpleStringProperty(); public final StringProperty selectionPrompt = new SimpleStringProperty();
public final BooleanProperty selectionDisable = new SimpleBooleanProperty(); public final BooleanProperty selectionDisable = new SimpleBooleanProperty();
public final BooleanProperty saveButtonDisable = new SimpleBooleanProperty(true); public final BooleanProperty saveButtonDisable = new SimpleBooleanProperty(true);
public final ObjectProperty<BankAccountType> type = new SimpleObjectProperty<>(); public final ObjectProperty<BankAccountType> type = new SimpleObjectProperty<>();
public final ObjectProperty<Country> country = new SimpleObjectProperty<>(); public final ObjectProperty<Country> country = new SimpleObjectProperty<>();
public final ObjectProperty<Currency> currency = new SimpleObjectProperty<>(); public final ObjectProperty<Currency> currency = new SimpleObjectProperty<>();
@ -136,7 +135,7 @@ public class FiatAccountPm extends PresentationModel<FiatAccountModel> {
// Public // Public
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public InputValidator.ValidationResult saveBankAccount() { public InputValidator.ValidationResult requestSaveBankAccount() {
InputValidator.ValidationResult result = validateInput(); InputValidator.ValidationResult result = validateInput();
if (result.isValid) { if (result.isValid) {
model.saveBankAccount(); model.saveBankAccount();
@ -258,12 +257,16 @@ public class FiatAccountPm extends PresentationModel<FiatAccountModel> {
return model.allRegions; return model.allRegions;
} }
public BooleanProperty getCountryNotInAcceptedCountriesList() {
return model.countryNotInAcceptedCountriesList;
}
public ObservableList<Country> getAllCountriesFor(Region selectedRegion) { public ObservableList<Country> getAllCountriesFor(Region selectedRegion) {
return model.getAllCountriesFor(selectedRegion); return model.getAllCountriesFor(selectedRegion);
} }
public BooleanProperty getCountryNotInAcceptedCountriesList() { public BankAccountNumberValidator getValidator() {
return model.countryNotInAcceptedCountriesList; return validator;
} }
@ -322,10 +325,4 @@ public class FiatAccountPm extends PresentationModel<FiatAccountModel> {
return result; return result;
} }
public InputValidator getValidator() {
return validator;
}
} }

View file

@ -38,10 +38,12 @@ public class PasswordPM extends PresentationModel<PasswordModel> {
private final PasswordValidator passwordValidator = new PasswordValidator(); private final PasswordValidator passwordValidator = new PasswordValidator();
private String errorMessage; private String errorMessage;
public final StringProperty passwordField = new SimpleStringProperty(); public final StringProperty passwordField = new SimpleStringProperty();
public final StringProperty repeatedPasswordField = new SimpleStringProperty(); public final StringProperty repeatedPasswordField = new SimpleStringProperty();
public final BooleanProperty saveButtonDisabled = new SimpleBooleanProperty(true); public final BooleanProperty saveButtonDisabled = new SimpleBooleanProperty(true);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -87,7 +89,7 @@ public class PasswordPM extends PresentationModel<PasswordModel> {
// Public // Public
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public boolean savePassword() { public boolean requestSavePassword() {
if (validate()) { if (validate()) {
model.savePassword(passwordField.get()); model.savePassword(passwordField.get());
return true; return true;

View file

@ -42,12 +42,13 @@ import static io.bitsquare.gui.util.BSFormatter.formatCoinWithCode;
public 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
public final ObjectProperty<Address> address = new SimpleObjectProperty<>();
public final BooleanProperty isPayButtonDisabled = new SimpleBooleanProperty(true); public final BooleanProperty isPayButtonDisabled = new SimpleBooleanProperty(true);
public final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty(); public final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty();
public final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty(); public final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty();
// That is needed for the addressTextField
public final ObjectProperty<Address> address = new SimpleObjectProperty<>();
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
@ -67,8 +68,8 @@ public class RegistrationPM extends PresentationModel<RegistrationModel> {
public void initialized() { public void initialized() {
super.initialized(); super.initialized();
if (model.addressEntry != null) { if (model.getAddressEntry() != null) {
address.set(model.addressEntry.getAddress()); address.set(model.getAddressEntry().getAddress());
} }
model.isWalletFunded.addListener((ov, oldValue, newValue) -> { model.isWalletFunded.addListener((ov, oldValue, newValue) -> {
@ -103,7 +104,7 @@ public class RegistrationPM extends PresentationModel<RegistrationModel> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// UI actions (called by CB) // UI actions
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public void payFee() { public void payFee() {
@ -117,7 +118,7 @@ public class RegistrationPM extends PresentationModel<RegistrationModel> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Getters (called by CB) // Getters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public WalletFacade getWalletFacade() { public WalletFacade getWalletFacade() {
@ -129,7 +130,7 @@ public class RegistrationPM extends PresentationModel<RegistrationModel> {
} }
public String getAddressAsString() { public String getAddressAsString() {
return model.addressEntry != null ? model.addressEntry.getAddress().toString() : ""; return model.getAddressEntry() != null ? model.getAddressEntry().getAddress().toString() : "";
} }
public String getPaymentLabel() { public String getPaymentLabel() {
@ -144,6 +145,7 @@ public class RegistrationPM extends PresentationModel<RegistrationModel> {
return model.getTransactionId(); return model.getTransactionId();
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Private // Private
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -37,8 +37,7 @@ import org.slf4j.LoggerFactory;
public 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);
public final BooleanProperty doneButtonDisable = new SimpleBooleanProperty(true);
public final BooleanProperty doneButtonDisabled = new SimpleBooleanProperty(true);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -66,7 +65,7 @@ public class RestrictionsPM extends PresentationModel<RestrictionsModel> {
public void activate() { public void activate() {
super.activate(); super.activate();
updateDoneButtonDisabled(); updateDoneButtonDisableState();
} }
@SuppressWarnings("EmptyMethod") @SuppressWarnings("EmptyMethod")
@ -80,76 +79,80 @@ public class RestrictionsPM extends PresentationModel<RestrictionsModel> {
// Public // Public
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public void onAddLanguage(Locale locale) { public void addLanguage(Locale locale) {
model.addLanguage(locale); model.addLanguage(locale);
updateDoneButtonDisabled(); updateDoneButtonDisableState();
}
public ObservableList<Locale> getLanguageList() {
updateDoneButtonDisabled();
return model.languageList;
}
public ObservableList<Locale> getAllLanguages() {
updateDoneButtonDisabled();
return model.allLanguages;
} }
public void removeLanguage(Locale locale) { public void removeLanguage(Locale locale) {
model.removeLanguage(locale); model.removeLanguage(locale);
updateDoneButtonDisabled(); updateDoneButtonDisableState();
} }
public void onAddCountry(Country country) { public void addCountry(Country country) {
model.addCountry(country); model.addCountry(country);
updateDoneButtonDisabled(); updateDoneButtonDisableState();
} }
public void removeCountry(Country country) {
model.removeCountry(country);
updateDoneButtonDisableState();
}
public void removeArbitrator(Arbitrator arbitrator) {
model.removeArbitrator(arbitrator);
updateDoneButtonDisableState();
}
public void updateArbitratorList() {
model.updateArbitratorList();
updateDoneButtonDisableState();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Getters
///////////////////////////////////////////////////////////////////////////////////////////
public ObservableList<Country> getListWithAllEuroCountries() { public ObservableList<Country> getListWithAllEuroCountries() {
ObservableList<Country> result = model.getListWithAllEuroCountries(); return model.getListWithAllEuroCountries();
updateDoneButtonDisabled();
return result;
} }
public ObservableList<Country> getAllCountriesFor(Region selectedRegion) { public ObservableList<Country> getAllCountriesFor(Region selectedRegion) {
return model.getAllCountriesFor(selectedRegion); return model.getAllCountriesFor(selectedRegion);
} }
public ObservableList<Locale> getLanguageList() {
return model.languageList;
}
public ObservableList<Region> getAllRegions() { public ObservableList<Region> getAllRegions() {
return model.allRegions; return model.allRegions;
} }
public ObservableList<Locale> getAllLanguages() {
return model.allLanguages;
}
public ObservableList<Country> getCountryList() { public ObservableList<Country> getCountryList() {
updateDoneButtonDisabled();
return model.countryList; return model.countryList;
} }
public void removeCountry(Country country) {
model.removeCountry(country);
updateDoneButtonDisabled();
}
public ObservableList<Arbitrator> getArbitratorList() { public ObservableList<Arbitrator> getArbitratorList() {
updateDoneButtonDisabled();
return model.arbitratorList; return model.arbitratorList;
} }
public void removeArbitrator(Arbitrator arbitrator) {
model.removeArbitrator(arbitrator);
updateDoneButtonDisabled();
}
public void updateArbitratorList() { ///////////////////////////////////////////////////////////////////////////////////////////
model.updateArbitratorList(); // Private
updateDoneButtonDisabled(); ///////////////////////////////////////////////////////////////////////////////////////////
}
//TODO Revert size() > -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
public void updateDoneButtonDisabled() { private void updateDoneButtonDisableState() {
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;
doneButtonDisabled.set(!isValid); doneButtonDisable.set(!isValid);
} }
} }

View file

@ -49,12 +49,30 @@ public class SeedWordsPM extends PresentationModel<SeedWordsModel> {
// Lifecycle // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("EmptyMethod")
@Override @Override
public void initialized() { public void initialized() {
super.initialized(); super.initialized();
if (model.mnemonicCode != null) if (model.getMnemonicCode() != null)
seedWords.set(BSFormatter.mnemonicCodeToString(model.mnemonicCode)); seedWords.set(BSFormatter.mnemonicCodeToString(model.getMnemonicCode()));
}
@Override
public void activate() {
super.activate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void deactivate() {
super.deactivate();
}
@SuppressWarnings("EmptyMethod")
@Override
public void terminate() {
super.terminate();
} }
} }

View file

@ -148,7 +148,7 @@ public class CreateOfferPM extends PresentationModel<CreateOfferModel> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Public API methods (called by CB) // Public API methods
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// setOrderBookFilter is a one time call // setOrderBookFilter is a one time call
@ -171,7 +171,7 @@ public class CreateOfferPM extends PresentationModel<CreateOfferModel> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// UI actions (called by CB) // UI actions
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public void onPlaceOffer() { public void onPlaceOffer() {
@ -185,7 +185,7 @@ public class CreateOfferPM extends PresentationModel<CreateOfferModel> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// UI events (called by CB) // UI events
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public void onShowPayFundsScreen() { public void onShowPayFundsScreen() {
@ -278,7 +278,7 @@ public class CreateOfferPM extends PresentationModel<CreateOfferModel> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Getters (called by CB) // Getters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public WalletFacade getWalletFacade() { public WalletFacade getWalletFacade() {

View file

@ -22,6 +22,7 @@ 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.gui.pm.AccountPM;
import io.bitsquare.gui.view.account.AccountSetupCB;
import io.bitsquare.util.BSFXMLLoader; import io.bitsquare.util.BSFXMLLoader;
import java.io.IOException; import java.io.IOException;
@ -42,6 +43,7 @@ import org.slf4j.LoggerFactory;
public class AccountCB extends CachedCodeBehind<AccountPM> { public class AccountCB extends CachedCodeBehind<AccountPM> {
private static final Logger log = LoggerFactory.getLogger(AccountCB.class); private static final Logger log = LoggerFactory.getLogger(AccountCB.class);
public Tab tab; public Tab tab;
@ -108,6 +110,13 @@ public class AccountCB extends CachedCodeBehind<AccountPM> {
tab.setContent(view); tab.setContent(view);
Initializable childController = loader.getController(); Initializable childController = loader.getController();
((CodeBehind) childController).setParentController(this); ((CodeBehind) childController).setParentController(this);
if (childController instanceof AccountSetupCB)
((AccountSetupCB) childController).setRemoveCallBack(() -> {
removeSetup();
return null;
});
} catch (IOException e) { } catch (IOException e) {
log.error("Loading view failed. FxmlUrl = " + NavigationItem.ACCOUNT_SETUP.getFxmlUrl()); log.error("Loading view failed. FxmlUrl = " + NavigationItem.ACCOUNT_SETUP.getFxmlUrl());
e.getStackTrace(); e.getStackTrace();
@ -115,7 +124,12 @@ public class AccountCB extends CachedCodeBehind<AccountPM> {
return childController; return childController;
} }
public void removeSetup() {
///////////////////////////////////////////////////////////////////////////////////////////
// Private
///////////////////////////////////////////////////////////////////////////////////////////
private void removeSetup() {
childController = null; childController = null;
NavigationItem previousItem = MainController.GET_INSTANCE().getPreviousNavigationItem(); NavigationItem previousItem = MainController.GET_INSTANCE().getPreviousNavigationItem();
@ -125,10 +139,5 @@ public class AccountCB extends CachedCodeBehind<AccountPM> {
MainController.GET_INSTANCE().loadViewAndGetChildController(previousItem); MainController.GET_INSTANCE().loadViewAndGetChildController(previousItem);
} }
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
} }

View file

@ -129,11 +129,10 @@ public class AccountSettingsCB extends CachedCodeBehind<AccountSettingsPM> {
} }
class MenuItem extends ToggleButton { class MenuItem extends ToggleButton {
private static final Logger log = LoggerFactory.getLogger(MenuItem.class); private static final Logger log = LoggerFactory.getLogger(MenuItem.class);
private CodeBehind<? extends PresentationModel> childController; private CodeBehind<? extends PresentationModel> childController;
private final AccountSettingsCB parentCB; private final AccountSettingsCB parentCB;
private final Parent content; private final Parent content;
private final NavigationItem navigationItem; private final NavigationItem navigationItem;
@ -144,15 +143,13 @@ class MenuItem extends ToggleButton {
this.content = content; this.content = content;
this.navigationItem = navigationItem; this.navigationItem = navigationItem;
setToggleGroup(toggleGroup);
setText(title);
setId("account-settings-item-background-active");
setPrefHeight(40); setPrefHeight(40);
setPrefWidth(200); setPrefWidth(200);
setAlignment(Pos.CENTER_LEFT); setAlignment(Pos.CENTER_LEFT);
setToggleGroup(toggleGroup);
setText(title);
setId("account-settings-item-background-active");
Label icon = new Label(); Label icon = new Label();
icon.setTextFill(Paint.valueOf("#999")); icon.setTextFill(Paint.valueOf("#999"));
if (navigationItem.equals(NavigationItem.SEED_WORDS)) if (navigationItem.equals(NavigationItem.SEED_WORDS))
@ -162,10 +159,10 @@ class MenuItem extends ToggleButton {
else else
AwesomeDude.setIcon(icon, AwesomeIcon.EDIT_SIGN); AwesomeDude.setIcon(icon, AwesomeIcon.EDIT_SIGN);
setGraphic(icon); setGraphic(icon);
setOnAction((event) -> show()); setOnAction((event) -> show());
selectedProperty().addListener((ov, oldValue, newValue) -> { selectedProperty().addListener((ov, oldValue, newValue) -> {
if (newValue) { if (newValue) {
setId("account-settings-item-background-selected"); setId("account-settings-item-background-selected");
@ -180,7 +177,7 @@ class MenuItem extends ToggleButton {
disableProperty().addListener((ov, oldValue, newValue) -> { disableProperty().addListener((ov, oldValue, newValue) -> {
if (newValue) { if (newValue) {
setId("account-settings-item-background-disabled"); setId("account-settings-item-background-disabled");
//icon.setTextFill(Paint.valueOf("#ccc")); icon.setTextFill(Paint.valueOf("#ccc"));
} }
else { else {
setId("account-settings-item-background-active"); setId("account-settings-item-background-active");
@ -202,10 +199,5 @@ class MenuItem extends ToggleButton {
e.getStackTrace(); e.getStackTrace();
} }
} }
CodeBehind<? extends PresentationModel> getChildController() {
return childController;
}
} }

View file

@ -23,7 +23,6 @@ import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.pm.account.AccountSetupPM; import io.bitsquare.gui.pm.account.AccountSetupPM;
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.AdjustableAccountContent; import io.bitsquare.gui.view.account.content.AdjustableAccountContent;
import io.bitsquare.gui.view.account.content.FiatAccountCB; import io.bitsquare.gui.view.account.content.FiatAccountCB;
import io.bitsquare.gui.view.account.content.PasswordCB; import io.bitsquare.gui.view.account.content.PasswordCB;
@ -37,9 +36,11 @@ import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.concurrent.Callable;
import javax.inject.Inject; import javax.inject.Inject;
import javafx.fxml.FXML;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.scene.*; import javafx.scene.*;
import javafx.scene.control.*; import javafx.scene.control.*;
@ -52,9 +53,13 @@ import org.slf4j.LoggerFactory;
public class AccountSetupCB extends CachedCodeBehind<AccountSetupPM> { public class AccountSetupCB extends CachedCodeBehind<AccountSetupPM> {
private static final Logger log = LoggerFactory.getLogger(AccountSetupCB.class); private static final Logger log = LoggerFactory.getLogger(AccountSetupCB.class);
public VBox leftVBox;
public AnchorPane content;
private WizardItem seedWords, password, fiatAccount, restrictions, registration; private WizardItem seedWords, password, fiatAccount, restrictions, registration;
private Callable<Void> requestCloseCallable;
@FXML private VBox leftVBox;
@FXML private AnchorPane content;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
@ -137,7 +142,13 @@ public class AccountSetupCB extends CachedCodeBehind<AccountSetupPM> {
registration.onCompleted(); registration.onCompleted();
childController = null; childController = null;
((AccountCB) parentController).removeSetup(); if (requestCloseCallable != null) {
try {
requestCloseCallable.call();
} catch (Exception e) {
e.printStackTrace();
}
}
} }
} }
@ -146,21 +157,17 @@ public class AccountSetupCB extends CachedCodeBehind<AccountSetupPM> {
// Public Methods // Public Methods
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public void setRemoveCallBack(Callable<Void> requestCloseCallable) {
/////////////////////////////////////////////////////////////////////////////////////////// this.requestCloseCallable = requestCloseCallable;
// UI handlers }
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
} }
class WizardItem extends HBox { class WizardItem extends HBox {
private static final Logger log = LoggerFactory.getLogger(WizardItem.class); private static final Logger log = LoggerFactory.getLogger(WizardItem.class);
private CodeBehind<? extends PresentationModel> childController;
private final ImageView imageView; private final ImageView imageView;
private final Label titleLabel; private final Label titleLabel;
private final Label subTitleLabel; private final Label subTitleLabel;
@ -168,15 +175,12 @@ class WizardItem extends HBox {
private final Parent content; private final Parent content;
private final NavigationItem navigationItem; private final NavigationItem navigationItem;
private CodeBehind<? extends PresentationModel> childController;
WizardItem(AccountSetupCB 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;
setId("wizard-item-background-deactivated"); setId("wizard-item-background-deactivated");
layout();
setSpacing(5); setSpacing(5);
setPrefWidth(200); setPrefWidth(200);
@ -187,11 +191,6 @@ class WizardItem extends HBox {
imageView.setMouseTransparent(true); imageView.setMouseTransparent(true);
HBox.setMargin(imageView, new Insets(8, 0, 0, 8)); HBox.setMargin(imageView, new Insets(8, 0, 0, 8));
final VBox vBox = new VBox();
vBox.setSpacing(1);
HBox.setMargin(vBox, new Insets(5, 0, 8, 0));
vBox.setMouseTransparent(true);
titleLabel = new Label(title); titleLabel = new Label(title);
titleLabel.setId("wizard-title-deactivated"); titleLabel.setId("wizard-title-deactivated");
titleLabel.setLayoutX(7); titleLabel.setLayoutX(7);
@ -205,11 +204,16 @@ class WizardItem extends HBox {
subTitleLabel.setWrapText(true); subTitleLabel.setWrapText(true);
subTitleLabel.setMouseTransparent(true); subTitleLabel.setMouseTransparent(true);
final VBox vBox = new VBox();
vBox.setSpacing(1);
HBox.setMargin(vBox, new Insets(5, 0, 8, 0));
vBox.setMouseTransparent(true);
vBox.getChildren().addAll(titleLabel, subTitleLabel); vBox.getChildren().addAll(titleLabel, subTitleLabel);
getChildren().addAll(imageView, vBox); getChildren().addAll(imageView, vBox);
} }
public CodeBehind<? extends PresentationModel> show() { CodeBehind<? extends PresentationModel> show() {
loadView(navigationItem); loadView(navigationItem);
setId("wizard-item-background-active"); setId("wizard-item-background-active");
imageView.setImage(ImageUtil.getIconImage(ImageUtil.ARROW_BLUE)); imageView.setImage(ImageUtil.getIconImage(ImageUtil.ARROW_BLUE));
@ -218,29 +222,13 @@ class WizardItem extends HBox {
return childController; return childController;
} }
public void onCompleted() { void onCompleted() {
setId("wizard-item-background-completed"); setId("wizard-item-background-completed");
imageView.setImage(ImageUtil.getIconImage(ImageUtil.TICK)); imageView.setImage(ImageUtil.getIconImage(ImageUtil.TICK));
titleLabel.setId("wizard-title-completed"); titleLabel.setId("wizard-title-completed");
subTitleLabel.setId("wizard-sub-title-completed"); subTitleLabel.setId("wizard-sub-title-completed");
} }
public CodeBehind<? extends PresentationModel> getChildController() {
return childController;
}
public ImageView getImageView() {
return imageView;
}
public Label getTitleLabel() {
return titleLabel;
}
public Label getSubTitleLabel() {
return subTitleLabel;
}
private void loadView(NavigationItem navigationItem) { private void loadView(NavigationItem navigationItem) {
final BSFXMLLoader loader = new BSFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl())); final BSFXMLLoader loader = new BSFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()));
try { try {

View file

@ -105,7 +105,7 @@ public class ChangePasswordCB extends CachedCodeBehind<ChangePasswordPM> impleme
@FXML @FXML
private void onSaved() { private void onSaved() {
boolean result = presentationModel.savePassword(); boolean result = presentationModel.requestSavePassword();
if (result) { if (result) {
if (parentController instanceof AccountSetupCB) if (parentController instanceof AccountSetupCB)
((AccountSetupCB) parentController).onCompleted(this); ((AccountSetupCB) parentController).onCompleted(this);

View file

@ -166,7 +166,7 @@ public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> implements Ad
@FXML @FXML
private void onSave() { private void onSave() {
InputValidator.ValidationResult result = presentationModel.saveBankAccount(); InputValidator.ValidationResult result = presentationModel.requestSaveBankAccount();
if (result.isValid) { if (result.isValid) {
selectionComboBox.getSelectionModel().select(null); selectionComboBox.getSelectionModel().select(null);
Popups.openInfo("You can add more accounts or continue to the next step.", Popups.openInfo("You can add more accounts or continue to the next step.",

View file

@ -105,7 +105,7 @@ public class PasswordCB extends CachedCodeBehind<PasswordPM> implements Adjustab
@FXML @FXML
private void onSaved() { private void onSaved() {
boolean result = presentationModel.savePassword(); boolean result = presentationModel.requestSavePassword();
if (result) { if (result) {
if (parentController instanceof AccountSetupCB) if (parentController instanceof AccountSetupCB)
((AccountSetupCB) parentController).onCompleted(this); ((AccountSetupCB) parentController).onCompleted(this);

View file

@ -86,7 +86,7 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> implements
initCountry(); initCountry();
initArbitrators(); initArbitrators();
completedButton.disableProperty().bind(presentationModel.doneButtonDisabled); completedButton.disableProperty().bind(presentationModel.doneButtonDisable);
} }
@Override @Override
@ -128,7 +128,7 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> implements
@FXML @FXML
private void onAddLanguage() { private void onAddLanguage() {
presentationModel.onAddLanguage(languageComboBox.getSelectionModel().getSelectedItem()); presentationModel.addLanguage(languageComboBox.getSelectionModel().getSelectedItem());
languageComboBox.getSelectionModel().clearSelection(); languageComboBox.getSelectionModel().clearSelection();
} }
@ -143,7 +143,7 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> implements
@FXML @FXML
private void onAddCountry() { private void onAddCountry() {
presentationModel.onAddCountry(countryComboBox.getSelectionModel().getSelectedItem()); presentationModel.addCountry(countryComboBox.getSelectionModel().getSelectedItem());
countryComboBox.getSelectionModel().clearSelection(); countryComboBox.getSelectionModel().clearSelection();
} }

View file

@ -75,6 +75,7 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
private boolean detailsVisible; private boolean detailsVisible;
private boolean advancedScreenInited; private boolean advancedScreenInited;
private Callable<Void> onCloseCallable;
private ImageView expand; private ImageView expand;
private ImageView collapse; private ImageView collapse;
@ -97,7 +98,6 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
acceptedLanguagesTextField; acceptedLanguagesTextField;
@FXML private AddressTextField addressTextField; @FXML private AddressTextField addressTextField;
@FXML private BalanceTextField balanceTextField; @FXML private BalanceTextField balanceTextField;
private Callable<Void> onCloseCallBack;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -140,13 +140,14 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
// Inform parent that we gor removed. // Inform parent that we gor removed.
// Needed to reset disable state of createOfferButton in OrderBookController // Needed to reset disable state of createOfferButton in OrderBookController
if (onCloseCallBack != null) if (onCloseCallable != null) {
try { try {
onCloseCallBack.call(); onCloseCallable.call();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error(e.getMessage()); log.error(e.getMessage());
} }
}
} }
@ -522,7 +523,7 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
} }
public void setOnClose(Callable<Void> onCloseCallBack) { public void setOnClose(Callable<Void> onCloseCallBack) {
this.onCloseCallBack = onCloseCallBack; this.onCloseCallable = onCloseCallBack;
} }
} }