From 11cff6dcdb93c404ef42fac8aa27aa2e97ea91bc Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 9 Sep 2014 10:51:06 +0200 Subject: [PATCH] Cleanup account UIs --- .../io/bitsquare/gui/model/AccountModel.java | 37 ++++++--- .../model/account/AccountSettingsModel.java | 39 ++++----- .../gui/model/account/AccountSetupModel.java | 40 +++++----- .../account/content/ChangePasswordModel.java | 1 - .../account/content/FiatAccountModel.java | 1 + .../model/account/content/PasswordModel.java | 1 + .../account/content/RegistrationModel.java | 21 +++-- .../account/content/RestrictionsModel.java | 2 +- .../model/account/content/SeedWordsModel.java | 38 ++++++++- .../gui/model/trade/CreateOfferModel.java | 6 +- .../java/io/bitsquare/gui/pm/AccountPM.java | 37 +++++---- .../gui/pm/account/AccountSettingsPM.java | 39 ++++----- .../gui/pm/account/AccountSetupPM.java | 39 ++++----- .../pm/account/content/ChangePasswordPM.java | 4 +- .../gui/pm/account/content/FiatAccountPm.java | 17 ++-- .../gui/pm/account/content/PasswordPM.java | 4 +- .../pm/account/content/RegistrationPM.java | 16 ++-- .../pm/account/content/RestrictionsPM.java | 79 ++++++++++--------- .../gui/pm/account/content/SeedWordsPM.java | 22 +++++- .../bitsquare/gui/pm/trade/CreateOfferPM.java | 8 +- .../java/io/bitsquare/gui/view/AccountCB.java | 21 +++-- .../gui/view/account/AccountSettingsCB.java | 20 ++--- .../gui/view/account/AccountSetupCB.java | 68 +++++++--------- .../account/content/ChangePasswordCB.java | 2 +- .../view/account/content/FiatAccountCB.java | 2 +- .../gui/view/account/content/PasswordCB.java | 2 +- .../view/account/content/RestrictionsCB.java | 6 +- .../gui/view/trade/CreateOfferCB.java | 9 ++- 28 files changed, 336 insertions(+), 245 deletions(-) diff --git a/src/main/java/io/bitsquare/gui/model/AccountModel.java b/src/main/java/io/bitsquare/gui/model/AccountModel.java index b8351f39ed..5bc42cfbcd 100644 --- a/src/main/java/io/bitsquare/gui/model/AccountModel.java +++ b/src/main/java/io/bitsquare/gui/model/AccountModel.java @@ -27,27 +27,46 @@ import org.slf4j.LoggerFactory; public class AccountModel extends UIModel { private static final Logger log = LoggerFactory.getLogger(AccountModel.class); + private final User user; + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////////// @Inject private AccountModel(User user) { - this.user = user; } /////////////////////////////////////////////////////////////////////////////////////////// - // Public methods + // Lifecycle /////////////////////////////////////////////////////////////////////////////////////////// + @SuppressWarnings("EmptyMethod") + @Override + public void initialized() { + super.initialized(); + } - /////////////////////////////////////////////////////////////////////////////////////////// - // Interface implementation: Initializable - /////////////////////////////////////////////////////////////////////////////////////////// + @Override + 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; } - /////////////////////////////////////////////////////////////////////////////////////////// - // Setters - /////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Private methods - /////////////////////////////////////////////////////////////////////////////////////////// } diff --git a/src/main/java/io/bitsquare/gui/model/account/AccountSettingsModel.java b/src/main/java/io/bitsquare/gui/model/account/AccountSettingsModel.java index 0a92b4d454..879f93e38f 100644 --- a/src/main/java/io/bitsquare/gui/model/account/AccountSettingsModel.java +++ b/src/main/java/io/bitsquare/gui/model/account/AccountSettingsModel.java @@ -27,39 +27,42 @@ import org.slf4j.LoggerFactory; public class AccountSettingsModel extends UIModel { private static final Logger log = LoggerFactory.getLogger(AccountSettingsModel.class); + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////////// @Inject private AccountSettingsModel() { - } /////////////////////////////////////////////////////////////////////////////////////////// - // Public methods + // Lifecycle /////////////////////////////////////////////////////////////////////////////////////////// + @SuppressWarnings("EmptyMethod") + @Override + public void initialized() { + super.initialized(); + } - /////////////////////////////////////////////////////////////////////////////////////////// - // Interface implementation: Initializable - /////////////////////////////////////////////////////////////////////////////////////////// + @Override + public void activate() { + super.activate(); + } + @SuppressWarnings("EmptyMethod") + @Override + public void deactivate() { + super.deactivate(); + } - /////////////////////////////////////////////////////////////////////////////////////////// - // Getters - /////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Setters - /////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Private methods - /////////////////////////////////////////////////////////////////////////////////////////// + @SuppressWarnings("EmptyMethod") + @Override + public void terminate() { + super.terminate(); + } } diff --git a/src/main/java/io/bitsquare/gui/model/account/AccountSetupModel.java b/src/main/java/io/bitsquare/gui/model/account/AccountSetupModel.java index 8398dce6ed..6cdfa2ccab 100644 --- a/src/main/java/io/bitsquare/gui/model/account/AccountSetupModel.java +++ b/src/main/java/io/bitsquare/gui/model/account/AccountSetupModel.java @@ -27,39 +27,41 @@ import org.slf4j.LoggerFactory; public class AccountSetupModel extends UIModel { private static final Logger log = LoggerFactory.getLogger(AccountSetupModel.class); + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////////// @Inject private AccountSetupModel() { - } /////////////////////////////////////////////////////////////////////////////////////////// - // Public methods + // Lifecycle /////////////////////////////////////////////////////////////////////////////////////////// + @SuppressWarnings("EmptyMethod") + @Override + public void initialized() { + super.initialized(); + } - /////////////////////////////////////////////////////////////////////////////////////////// - // Interface implementation: Initializable - /////////////////////////////////////////////////////////////////////////////////////////// + @Override + public void activate() { + super.activate(); + } + @SuppressWarnings("EmptyMethod") + @Override + public void deactivate() { + super.deactivate(); + } - /////////////////////////////////////////////////////////////////////////////////////////// - // Getters - /////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Setters - /////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Private methods - /////////////////////////////////////////////////////////////////////////////////////////// - + @SuppressWarnings("EmptyMethod") + @Override + public void terminate() { + super.terminate(); + } } diff --git a/src/main/java/io/bitsquare/gui/model/account/content/ChangePasswordModel.java b/src/main/java/io/bitsquare/gui/model/account/content/ChangePasswordModel.java index b09eb191f2..a08ee94652 100644 --- a/src/main/java/io/bitsquare/gui/model/account/content/ChangePasswordModel.java +++ b/src/main/java/io/bitsquare/gui/model/account/content/ChangePasswordModel.java @@ -33,7 +33,6 @@ public class ChangePasswordModel extends UIModel { @Inject private ChangePasswordModel() { - } diff --git a/src/main/java/io/bitsquare/gui/model/account/content/FiatAccountModel.java b/src/main/java/io/bitsquare/gui/model/account/content/FiatAccountModel.java index ca27772d44..2301d21cbf 100644 --- a/src/main/java/io/bitsquare/gui/model/account/content/FiatAccountModel.java +++ b/src/main/java/io/bitsquare/gui/model/account/content/FiatAccountModel.java @@ -62,6 +62,7 @@ public class FiatAccountModel extends UIModel { public final ObjectProperty country = new SimpleObjectProperty<>(); public final ObjectProperty currency = new SimpleObjectProperty<>(); public final ObjectProperty currentBankAccount = new SimpleObjectProperty<>(); + public final ObservableList allTypes = FXCollections.observableArrayList(BankAccountType .getAllBankAccountTypes()); public final ObservableList allBankAccounts = FXCollections.observableArrayList(); diff --git a/src/main/java/io/bitsquare/gui/model/account/content/PasswordModel.java b/src/main/java/io/bitsquare/gui/model/account/content/PasswordModel.java index d479201626..efb28605c5 100644 --- a/src/main/java/io/bitsquare/gui/model/account/content/PasswordModel.java +++ b/src/main/java/io/bitsquare/gui/model/account/content/PasswordModel.java @@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory; public class PasswordModel extends UIModel { private static final Logger log = LoggerFactory.getLogger(PasswordModel.class); + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/io/bitsquare/gui/model/account/content/RegistrationModel.java b/src/main/java/io/bitsquare/gui/model/account/content/RegistrationModel.java index fddfadc0f0..41400df9d8 100644 --- a/src/main/java/io/bitsquare/gui/model/account/content/RegistrationModel.java +++ b/src/main/java/io/bitsquare/gui/model/account/content/RegistrationModel.java @@ -51,12 +51,15 @@ public class RegistrationModel extends UIModel { private final WalletFacade walletFacade; private final User user; private final Persistence persistence; - public AddressEntry addressEntry; + + private String transactionId; + private AddressEntry addressEntry; + public final BooleanProperty isWalletFunded = new SimpleBooleanProperty(); public final BooleanProperty payFeeSuccess = new SimpleBooleanProperty(); - private String transactionId; public final StringProperty payFeeErrorMessage = new SimpleStringProperty(); + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////////// @@ -80,13 +83,13 @@ public class RegistrationModel extends UIModel { if (walletFacade != null && walletFacade.getWallet() != null) { addressEntry = walletFacade.getRegistrationAddressEntry(); - walletFacade.addBalanceListener(new BalanceListener(addressEntry.getAddress()) { + walletFacade.addBalanceListener(new BalanceListener(getAddressEntry().getAddress()) { @Override public void onBalanceChanged(@NotNull Coin 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(); log.info("payRegistrationFee onSuccess tx id:" + transaction.getHashAsString()); - if (addressEntry != null) - user.setAccountID(addressEntry.toString()); + if (getAddressEntry() != null) + user.setAccountID(getAddressEntry().toString()); persistence.write(user.getClass().getName(), user); payFeeSuccess.set(true); @@ -160,6 +163,11 @@ public class RegistrationModel extends UIModel { return transactionId; } + public AddressEntry getAddressEntry() { + return addressEntry; + } + + /////////////////////////////////////////////////////////////////////////////////////////// // Private /////////////////////////////////////////////////////////////////////////////////////////// @@ -167,4 +175,5 @@ public class RegistrationModel extends UIModel { private void updateBalance(@NotNull Coin balance) { isWalletFunded.set(balance.compareTo(getFeeAsCoin()) >= 0); } + } diff --git a/src/main/java/io/bitsquare/gui/model/account/content/RestrictionsModel.java b/src/main/java/io/bitsquare/gui/model/account/content/RestrictionsModel.java index 96a40f1d70..9cbe7ffbda 100644 --- a/src/main/java/io/bitsquare/gui/model/account/content/RestrictionsModel.java +++ b/src/main/java/io/bitsquare/gui/model/account/content/RestrictionsModel.java @@ -56,7 +56,6 @@ public class RestrictionsModel extends UIModel { public final ObservableList languageList = FXCollections.observableArrayList(); public final ObservableList countryList = FXCollections.observableArrayList(); public final ObservableList arbitratorList = FXCollections.observableArrayList(); - public final ObservableList allLanguages = FXCollections.observableArrayList(LanguageUtil .getAllLanguageLocales()); public final ObservableList allRegions = FXCollections.observableArrayList(CountryUtil.getAllRegions()); @@ -185,6 +184,7 @@ public class RestrictionsModel extends UIModel { persistence.write(settings); } + // TODO Remove mock later private void addMockArbitrator() { if (settings.getAcceptedArbitrators().isEmpty() && user.getMessageKeyPair() != null) { String pubKeyAsHex = Utils.HEX.encode(new ECKey().getPubKey()); diff --git a/src/main/java/io/bitsquare/gui/model/account/content/SeedWordsModel.java b/src/main/java/io/bitsquare/gui/model/account/content/SeedWordsModel.java index f052600592..031046affd 100644 --- a/src/main/java/io/bitsquare/gui/model/account/content/SeedWordsModel.java +++ b/src/main/java/io/bitsquare/gui/model/account/content/SeedWordsModel.java @@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory; public class SeedWordsModel extends UIModel { private static final Logger log = LoggerFactory.getLogger(SeedWordsModel.class); - public List mnemonicCode; + private List mnemonicCode; /////////////////////////////////////////////////////////////////////////////////////////// @@ -43,4 +43,40 @@ public class SeedWordsModel extends UIModel { 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 getMnemonicCode() { + return mnemonicCode; + } } diff --git a/src/main/java/io/bitsquare/gui/model/trade/CreateOfferModel.java b/src/main/java/io/bitsquare/gui/model/trade/CreateOfferModel.java index 1b7364f8d4..74a9139aab 100644 --- a/src/main/java/io/bitsquare/gui/model/trade/CreateOfferModel.java +++ b/src/main/java/io/bitsquare/gui/model/trade/CreateOfferModel.java @@ -74,6 +74,9 @@ public class CreateOfferModel extends UIModel { private final String offerId; + @Nullable private Direction direction = null; + private AddressEntry addressEntry; + public final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty(); public final StringProperty transactionId = new SimpleStringProperty(); public final StringProperty bankAccountCurrency = new SimpleStringProperty(); @@ -101,9 +104,6 @@ public class CreateOfferModel extends UIModel { public final ObservableList acceptedLanguages = FXCollections.observableArrayList(); public final ObservableList acceptedArbitrators = FXCollections.observableArrayList(); - @Nullable private Direction direction = null; - private AddressEntry addressEntry; - /////////////////////////////////////////////////////////////////////////////////////////// // Constructor diff --git a/src/main/java/io/bitsquare/gui/pm/AccountPM.java b/src/main/java/io/bitsquare/gui/pm/AccountPM.java index 9baf3f381b..bd4d745add 100644 --- a/src/main/java/io/bitsquare/gui/pm/AccountPM.java +++ b/src/main/java/io/bitsquare/gui/pm/AccountPM.java @@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory; public class AccountPM extends PresentationModel { private static final Logger log = LoggerFactory.getLogger(AccountPM.class); + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////////// @@ -39,13 +40,31 @@ public class AccountPM extends PresentationModel { /////////////////////////////////////////////////////////////////////////////////////////// - // Public methods + // Lifecycle /////////////////////////////////////////////////////////////////////////////////////////// + @SuppressWarnings("EmptyMethod") + @Override + public void initialized() { + super.initialized(); + } - /////////////////////////////////////////////////////////////////////////////////////////// - // Interface implementation: Initializable - /////////////////////////////////////////////////////////////////////////////////////////// + @Override + 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 { return model.getNeedRegistration(); } - /////////////////////////////////////////////////////////////////////////////////////////// - // Setters - /////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Private methods - /////////////////////////////////////////////////////////////////////////////////////////// - - } diff --git a/src/main/java/io/bitsquare/gui/pm/account/AccountSettingsPM.java b/src/main/java/io/bitsquare/gui/pm/account/AccountSettingsPM.java index 8725cf5294..2d1144f097 100644 --- a/src/main/java/io/bitsquare/gui/pm/account/AccountSettingsPM.java +++ b/src/main/java/io/bitsquare/gui/pm/account/AccountSettingsPM.java @@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory; public class AccountSettingsPM extends PresentationModel { private static final Logger log = LoggerFactory.getLogger(AccountSettingsPM.class); + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////////// @@ -39,28 +40,30 @@ public class AccountSettingsPM extends PresentationModel { /////////////////////////////////////////////////////////////////////////////////////////// - // Public methods + // Lifecycle /////////////////////////////////////////////////////////////////////////////////////////// + @SuppressWarnings("EmptyMethod") + @Override + public void initialized() { + super.initialized(); + } - /////////////////////////////////////////////////////////////////////////////////////////// - // Interface implementation: Initializable - /////////////////////////////////////////////////////////////////////////////////////////// + @Override + public void activate() { + super.activate(); + } + @SuppressWarnings("EmptyMethod") + @Override + public void deactivate() { + super.deactivate(); + } - /////////////////////////////////////////////////////////////////////////////////////////// - // Getters - /////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Setters - /////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Private methods - /////////////////////////////////////////////////////////////////////////////////////////// - + @SuppressWarnings("EmptyMethod") + @Override + public void terminate() { + super.terminate(); + } } diff --git a/src/main/java/io/bitsquare/gui/pm/account/AccountSetupPM.java b/src/main/java/io/bitsquare/gui/pm/account/AccountSetupPM.java index 0915a504b3..146d9d58ba 100644 --- a/src/main/java/io/bitsquare/gui/pm/account/AccountSetupPM.java +++ b/src/main/java/io/bitsquare/gui/pm/account/AccountSetupPM.java @@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory; public class AccountSetupPM extends PresentationModel { private static final Logger log = LoggerFactory.getLogger(AccountSetupPM.class); + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////////// @@ -39,28 +40,30 @@ public class AccountSetupPM extends PresentationModel { /////////////////////////////////////////////////////////////////////////////////////////// - // Public methods + // Lifecycle /////////////////////////////////////////////////////////////////////////////////////////// + @SuppressWarnings("EmptyMethod") + @Override + public void initialized() { + super.initialized(); + } - /////////////////////////////////////////////////////////////////////////////////////////// - // Interface implementation: Initializable - /////////////////////////////////////////////////////////////////////////////////////////// + @Override + public void activate() { + super.activate(); + } + @SuppressWarnings("EmptyMethod") + @Override + public void deactivate() { + super.deactivate(); + } - /////////////////////////////////////////////////////////////////////////////////////////// - // Getters - /////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Setters - /////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Private methods - /////////////////////////////////////////////////////////////////////////////////////////// - + @SuppressWarnings("EmptyMethod") + @Override + public void terminate() { + super.terminate(); + } } diff --git a/src/main/java/io/bitsquare/gui/pm/account/content/ChangePasswordPM.java b/src/main/java/io/bitsquare/gui/pm/account/content/ChangePasswordPM.java index 167ce80648..1579f23404 100644 --- a/src/main/java/io/bitsquare/gui/pm/account/content/ChangePasswordPM.java +++ b/src/main/java/io/bitsquare/gui/pm/account/content/ChangePasswordPM.java @@ -38,10 +38,12 @@ public class ChangePasswordPM extends PresentationModel { private final PasswordValidator passwordValidator = new PasswordValidator(); private String errorMessage; + public final StringProperty passwordField = new SimpleStringProperty(); public final StringProperty repeatedPasswordField = new SimpleStringProperty(); public final BooleanProperty saveButtonDisabled = new SimpleBooleanProperty(true); + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////////// @@ -87,7 +89,7 @@ public class ChangePasswordPM extends PresentationModel { // Public /////////////////////////////////////////////////////////////////////////////////////////// - public boolean savePassword() { + public boolean requestSavePassword() { if (validate()) { model.savePassword(passwordField.get()); return true; diff --git a/src/main/java/io/bitsquare/gui/pm/account/content/FiatAccountPm.java b/src/main/java/io/bitsquare/gui/pm/account/content/FiatAccountPm.java index 092cbabd6d..7833bd4306 100644 --- a/src/main/java/io/bitsquare/gui/pm/account/content/FiatAccountPm.java +++ b/src/main/java/io/bitsquare/gui/pm/account/content/FiatAccountPm.java @@ -58,7 +58,6 @@ public class FiatAccountPm extends PresentationModel { public final StringProperty selectionPrompt = new SimpleStringProperty(); public final BooleanProperty selectionDisable = new SimpleBooleanProperty(); public final BooleanProperty saveButtonDisable = new SimpleBooleanProperty(true); - public final ObjectProperty type = new SimpleObjectProperty<>(); public final ObjectProperty country = new SimpleObjectProperty<>(); public final ObjectProperty currency = new SimpleObjectProperty<>(); @@ -136,7 +135,7 @@ public class FiatAccountPm extends PresentationModel { // Public /////////////////////////////////////////////////////////////////////////////////////////// - public InputValidator.ValidationResult saveBankAccount() { + public InputValidator.ValidationResult requestSaveBankAccount() { InputValidator.ValidationResult result = validateInput(); if (result.isValid) { model.saveBankAccount(); @@ -258,12 +257,16 @@ public class FiatAccountPm extends PresentationModel { return model.allRegions; } + public BooleanProperty getCountryNotInAcceptedCountriesList() { + return model.countryNotInAcceptedCountriesList; + } + public ObservableList getAllCountriesFor(Region selectedRegion) { return model.getAllCountriesFor(selectedRegion); } - public BooleanProperty getCountryNotInAcceptedCountriesList() { - return model.countryNotInAcceptedCountriesList; + public BankAccountNumberValidator getValidator() { + return validator; } @@ -322,10 +325,4 @@ public class FiatAccountPm extends PresentationModel { return result; } - - public InputValidator getValidator() { - return validator; - } - - } diff --git a/src/main/java/io/bitsquare/gui/pm/account/content/PasswordPM.java b/src/main/java/io/bitsquare/gui/pm/account/content/PasswordPM.java index a4a3660ab3..2f8b5f0acd 100644 --- a/src/main/java/io/bitsquare/gui/pm/account/content/PasswordPM.java +++ b/src/main/java/io/bitsquare/gui/pm/account/content/PasswordPM.java @@ -38,10 +38,12 @@ public class PasswordPM extends PresentationModel { private final PasswordValidator passwordValidator = new PasswordValidator(); private String errorMessage; + public final StringProperty passwordField = new SimpleStringProperty(); public final StringProperty repeatedPasswordField = new SimpleStringProperty(); public final BooleanProperty saveButtonDisabled = new SimpleBooleanProperty(true); + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////////// @@ -87,7 +89,7 @@ public class PasswordPM extends PresentationModel { // Public /////////////////////////////////////////////////////////////////////////////////////////// - public boolean savePassword() { + public boolean requestSavePassword() { if (validate()) { model.savePassword(passwordField.get()); return true; diff --git a/src/main/java/io/bitsquare/gui/pm/account/content/RegistrationPM.java b/src/main/java/io/bitsquare/gui/pm/account/content/RegistrationPM.java index 9e22dbf081..db4fe4164f 100644 --- a/src/main/java/io/bitsquare/gui/pm/account/content/RegistrationPM.java +++ b/src/main/java/io/bitsquare/gui/pm/account/content/RegistrationPM.java @@ -42,12 +42,13 @@ import static io.bitsquare.gui.util.BSFormatter.formatCoinWithCode; public class RegistrationPM extends PresentationModel { private static final Logger log = LoggerFactory.getLogger(RegistrationPM.class); - // Those are needed for the addressTextField - public final ObjectProperty
address = new SimpleObjectProperty<>(); public final BooleanProperty isPayButtonDisabled = new SimpleBooleanProperty(true); public final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty(); public final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty(); + // That is needed for the addressTextField + public final ObjectProperty
address = new SimpleObjectProperty<>(); + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor @@ -67,8 +68,8 @@ public class RegistrationPM extends PresentationModel { public void initialized() { super.initialized(); - if (model.addressEntry != null) { - address.set(model.addressEntry.getAddress()); + if (model.getAddressEntry() != null) { + address.set(model.getAddressEntry().getAddress()); } model.isWalletFunded.addListener((ov, oldValue, newValue) -> { @@ -103,7 +104,7 @@ public class RegistrationPM extends PresentationModel { /////////////////////////////////////////////////////////////////////////////////////////// - // UI actions (called by CB) + // UI actions /////////////////////////////////////////////////////////////////////////////////////////// public void payFee() { @@ -117,7 +118,7 @@ public class RegistrationPM extends PresentationModel { /////////////////////////////////////////////////////////////////////////////////////////// - // Getters (called by CB) + // Getters /////////////////////////////////////////////////////////////////////////////////////////// public WalletFacade getWalletFacade() { @@ -129,7 +130,7 @@ public class RegistrationPM extends PresentationModel { } public String getAddressAsString() { - return model.addressEntry != null ? model.addressEntry.getAddress().toString() : ""; + return model.getAddressEntry() != null ? model.getAddressEntry().getAddress().toString() : ""; } public String getPaymentLabel() { @@ -144,6 +145,7 @@ public class RegistrationPM extends PresentationModel { return model.getTransactionId(); } + /////////////////////////////////////////////////////////////////////////////////////////// // Private /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/io/bitsquare/gui/pm/account/content/RestrictionsPM.java b/src/main/java/io/bitsquare/gui/pm/account/content/RestrictionsPM.java index 5fb43e70a9..cf950bd5c2 100644 --- a/src/main/java/io/bitsquare/gui/pm/account/content/RestrictionsPM.java +++ b/src/main/java/io/bitsquare/gui/pm/account/content/RestrictionsPM.java @@ -37,8 +37,7 @@ import org.slf4j.LoggerFactory; public class RestrictionsPM extends PresentationModel { private static final Logger log = LoggerFactory.getLogger(RestrictionsPM.class); - - public final BooleanProperty doneButtonDisabled = new SimpleBooleanProperty(true); + public final BooleanProperty doneButtonDisable = new SimpleBooleanProperty(true); /////////////////////////////////////////////////////////////////////////////////////////// @@ -66,7 +65,7 @@ public class RestrictionsPM extends PresentationModel { public void activate() { super.activate(); - updateDoneButtonDisabled(); + updateDoneButtonDisableState(); } @SuppressWarnings("EmptyMethod") @@ -80,76 +79,80 @@ public class RestrictionsPM extends PresentationModel { // Public /////////////////////////////////////////////////////////////////////////////////////////// - public void onAddLanguage(Locale locale) { + public void addLanguage(Locale locale) { model.addLanguage(locale); - updateDoneButtonDisabled(); - } - - public ObservableList getLanguageList() { - updateDoneButtonDisabled(); - return model.languageList; - } - - public ObservableList getAllLanguages() { - updateDoneButtonDisabled(); - return model.allLanguages; + updateDoneButtonDisableState(); } public void removeLanguage(Locale locale) { model.removeLanguage(locale); - updateDoneButtonDisabled(); + updateDoneButtonDisableState(); } - public void onAddCountry(Country country) { + public void addCountry(Country 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 getListWithAllEuroCountries() { - ObservableList result = model.getListWithAllEuroCountries(); - updateDoneButtonDisabled(); - return result; + return model.getListWithAllEuroCountries(); } public ObservableList getAllCountriesFor(Region selectedRegion) { return model.getAllCountriesFor(selectedRegion); } + public ObservableList getLanguageList() { + return model.languageList; + } + public ObservableList getAllRegions() { return model.allRegions; } + public ObservableList getAllLanguages() { + return model.allLanguages; + } + public ObservableList getCountryList() { - updateDoneButtonDisabled(); return model.countryList; } - public void removeCountry(Country country) { - model.removeCountry(country); - updateDoneButtonDisabled(); - } - public ObservableList getArbitratorList() { - updateDoneButtonDisabled(); return model.arbitratorList; } - public void removeArbitrator(Arbitrator arbitrator) { - model.removeArbitrator(arbitrator); - updateDoneButtonDisabled(); - } - public void updateArbitratorList() { - model.updateArbitratorList(); - updateDoneButtonDisabled(); - } + /////////////////////////////////////////////////////////////////////////////////////////// + // Private + /////////////////////////////////////////////////////////////////////////////////////////// //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 && model.countryList != null && model.countryList.size() > 0 && model.arbitratorList != null && model.arbitratorList.size() > -1; - doneButtonDisabled.set(!isValid); + doneButtonDisable.set(!isValid); } } diff --git a/src/main/java/io/bitsquare/gui/pm/account/content/SeedWordsPM.java b/src/main/java/io/bitsquare/gui/pm/account/content/SeedWordsPM.java index 7aa9f5e238..adf7d3e336 100644 --- a/src/main/java/io/bitsquare/gui/pm/account/content/SeedWordsPM.java +++ b/src/main/java/io/bitsquare/gui/pm/account/content/SeedWordsPM.java @@ -49,12 +49,30 @@ public class SeedWordsPM extends PresentationModel { // Lifecycle /////////////////////////////////////////////////////////////////////////////////////////// + @SuppressWarnings("EmptyMethod") @Override public void initialized() { super.initialized(); - if (model.mnemonicCode != null) - seedWords.set(BSFormatter.mnemonicCodeToString(model.mnemonicCode)); + if (model.getMnemonicCode() != null) + 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(); } } diff --git a/src/main/java/io/bitsquare/gui/pm/trade/CreateOfferPM.java b/src/main/java/io/bitsquare/gui/pm/trade/CreateOfferPM.java index 5a361fc77e..22ec87409d 100644 --- a/src/main/java/io/bitsquare/gui/pm/trade/CreateOfferPM.java +++ b/src/main/java/io/bitsquare/gui/pm/trade/CreateOfferPM.java @@ -148,7 +148,7 @@ public class CreateOfferPM extends PresentationModel { /////////////////////////////////////////////////////////////////////////////////////////// - // Public API methods (called by CB) + // Public API methods /////////////////////////////////////////////////////////////////////////////////////////// // setOrderBookFilter is a one time call @@ -171,7 +171,7 @@ public class CreateOfferPM extends PresentationModel { /////////////////////////////////////////////////////////////////////////////////////////// - // UI actions (called by CB) + // UI actions /////////////////////////////////////////////////////////////////////////////////////////// public void onPlaceOffer() { @@ -185,7 +185,7 @@ public class CreateOfferPM extends PresentationModel { /////////////////////////////////////////////////////////////////////////////////////////// - // UI events (called by CB) + // UI events /////////////////////////////////////////////////////////////////////////////////////////// public void onShowPayFundsScreen() { @@ -278,7 +278,7 @@ public class CreateOfferPM extends PresentationModel { /////////////////////////////////////////////////////////////////////////////////////////// - // Getters (called by CB) + // Getters /////////////////////////////////////////////////////////////////////////////////////////// public WalletFacade getWalletFacade() { diff --git a/src/main/java/io/bitsquare/gui/view/AccountCB.java b/src/main/java/io/bitsquare/gui/view/AccountCB.java index a10000ac36..50aa9fe75e 100644 --- a/src/main/java/io/bitsquare/gui/view/AccountCB.java +++ b/src/main/java/io/bitsquare/gui/view/AccountCB.java @@ -22,6 +22,7 @@ import io.bitsquare.gui.CodeBehind; import io.bitsquare.gui.MainController; import io.bitsquare.gui.NavigationItem; import io.bitsquare.gui.pm.AccountPM; +import io.bitsquare.gui.view.account.AccountSetupCB; import io.bitsquare.util.BSFXMLLoader; import java.io.IOException; @@ -42,6 +43,7 @@ import org.slf4j.LoggerFactory; public class AccountCB extends CachedCodeBehind { private static final Logger log = LoggerFactory.getLogger(AccountCB.class); + public Tab tab; @@ -108,6 +110,13 @@ public class AccountCB extends CachedCodeBehind { tab.setContent(view); Initializable childController = loader.getController(); ((CodeBehind) childController).setParentController(this); + + if (childController instanceof AccountSetupCB) + ((AccountSetupCB) childController).setRemoveCallBack(() -> { + removeSetup(); + return null; + }); + } catch (IOException e) { log.error("Loading view failed. FxmlUrl = " + NavigationItem.ACCOUNT_SETUP.getFxmlUrl()); e.getStackTrace(); @@ -115,7 +124,12 @@ public class AccountCB extends CachedCodeBehind { return childController; } - public void removeSetup() { + + /////////////////////////////////////////////////////////////////////////////////////////// + // Private + /////////////////////////////////////////////////////////////////////////////////////////// + + private void removeSetup() { childController = null; NavigationItem previousItem = MainController.GET_INSTANCE().getPreviousNavigationItem(); @@ -125,10 +139,5 @@ public class AccountCB extends CachedCodeBehind { MainController.GET_INSTANCE().loadViewAndGetChildController(previousItem); } - - /////////////////////////////////////////////////////////////////////////////////////////// - // Private methods - /////////////////////////////////////////////////////////////////////////////////////////// - } diff --git a/src/main/java/io/bitsquare/gui/view/account/AccountSettingsCB.java b/src/main/java/io/bitsquare/gui/view/account/AccountSettingsCB.java index 0870b7fa71..d6ccfc33c6 100644 --- a/src/main/java/io/bitsquare/gui/view/account/AccountSettingsCB.java +++ b/src/main/java/io/bitsquare/gui/view/account/AccountSettingsCB.java @@ -129,11 +129,10 @@ public class AccountSettingsCB extends CachedCodeBehind { } class MenuItem extends ToggleButton { - private static final Logger log = LoggerFactory.getLogger(MenuItem.class); - private CodeBehind childController; + private final AccountSettingsCB parentCB; private final Parent content; private final NavigationItem navigationItem; @@ -144,15 +143,13 @@ class MenuItem extends ToggleButton { this.content = content; this.navigationItem = navigationItem; + setToggleGroup(toggleGroup); + setText(title); + setId("account-settings-item-background-active"); setPrefHeight(40); setPrefWidth(200); setAlignment(Pos.CENTER_LEFT); - setToggleGroup(toggleGroup); - - setText(title); - setId("account-settings-item-background-active"); - Label icon = new Label(); icon.setTextFill(Paint.valueOf("#999")); if (navigationItem.equals(NavigationItem.SEED_WORDS)) @@ -162,10 +159,10 @@ class MenuItem extends ToggleButton { else AwesomeDude.setIcon(icon, AwesomeIcon.EDIT_SIGN); - setGraphic(icon); setOnAction((event) -> show()); + selectedProperty().addListener((ov, oldValue, newValue) -> { if (newValue) { setId("account-settings-item-background-selected"); @@ -180,7 +177,7 @@ class MenuItem extends ToggleButton { disableProperty().addListener((ov, oldValue, newValue) -> { if (newValue) { setId("account-settings-item-background-disabled"); - //icon.setTextFill(Paint.valueOf("#ccc")); + icon.setTextFill(Paint.valueOf("#ccc")); } else { setId("account-settings-item-background-active"); @@ -202,10 +199,5 @@ class MenuItem extends ToggleButton { e.getStackTrace(); } } - - - CodeBehind getChildController() { - return childController; - } } diff --git a/src/main/java/io/bitsquare/gui/view/account/AccountSetupCB.java b/src/main/java/io/bitsquare/gui/view/account/AccountSetupCB.java index 2ea302cc99..4e497f7dcd 100644 --- a/src/main/java/io/bitsquare/gui/view/account/AccountSetupCB.java +++ b/src/main/java/io/bitsquare/gui/view/account/AccountSetupCB.java @@ -23,7 +23,6 @@ import io.bitsquare.gui.NavigationItem; import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.pm.account.AccountSetupPM; 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.FiatAccountCB; import io.bitsquare.gui.view.account.content.PasswordCB; @@ -37,9 +36,11 @@ import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; +import java.util.concurrent.Callable; import javax.inject.Inject; +import javafx.fxml.FXML; import javafx.geometry.Insets; import javafx.scene.*; import javafx.scene.control.*; @@ -52,9 +53,13 @@ import org.slf4j.LoggerFactory; public class AccountSetupCB extends CachedCodeBehind { private static final Logger log = LoggerFactory.getLogger(AccountSetupCB.class); - public VBox leftVBox; - public AnchorPane content; + private WizardItem seedWords, password, fiatAccount, restrictions, registration; + private Callable requestCloseCallable; + + @FXML private VBox leftVBox; + @FXML private AnchorPane content; + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor @@ -137,7 +142,13 @@ public class AccountSetupCB extends CachedCodeBehind { registration.onCompleted(); 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 { // Public Methods /////////////////////////////////////////////////////////////////////////////////////////// + public void setRemoveCallBack(Callable requestCloseCallable) { - /////////////////////////////////////////////////////////////////////////////////////////// - // UI handlers - /////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Private methods - /////////////////////////////////////////////////////////////////////////////////////////// + this.requestCloseCallable = requestCloseCallable; + } } class WizardItem extends HBox { - private static final Logger log = LoggerFactory.getLogger(WizardItem.class); + private CodeBehind childController; + private final ImageView imageView; private final Label titleLabel; private final Label subTitleLabel; @@ -168,15 +175,12 @@ class WizardItem extends HBox { private final Parent content; private final NavigationItem navigationItem; - - private CodeBehind childController; - WizardItem(AccountSetupCB parentCB, Parent content, String title, String subTitle, NavigationItem navigationItem) { this.parentCB = parentCB; this.content = content; this.navigationItem = navigationItem; + setId("wizard-item-background-deactivated"); - layout(); setSpacing(5); setPrefWidth(200); @@ -187,11 +191,6 @@ class WizardItem extends HBox { imageView.setMouseTransparent(true); HBox.setMargin(imageView, new Insets(8, 0, 0, 8)); - final VBox vBox = new VBox(); - vBox.setSpacing(1); - HBox.setMargin(vBox, new Insets(5, 0, 8, 0)); - vBox.setMouseTransparent(true); - titleLabel = new Label(title); titleLabel.setId("wizard-title-deactivated"); titleLabel.setLayoutX(7); @@ -205,11 +204,16 @@ class WizardItem extends HBox { subTitleLabel.setWrapText(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); + getChildren().addAll(imageView, vBox); } - public CodeBehind show() { + CodeBehind show() { loadView(navigationItem); setId("wizard-item-background-active"); imageView.setImage(ImageUtil.getIconImage(ImageUtil.ARROW_BLUE)); @@ -218,29 +222,13 @@ class WizardItem extends HBox { return childController; } - public void onCompleted() { + void onCompleted() { setId("wizard-item-background-completed"); imageView.setImage(ImageUtil.getIconImage(ImageUtil.TICK)); titleLabel.setId("wizard-title-completed"); subTitleLabel.setId("wizard-sub-title-completed"); } - public CodeBehind getChildController() { - return childController; - } - - public ImageView getImageView() { - return imageView; - } - - public Label getTitleLabel() { - return titleLabel; - } - - public Label getSubTitleLabel() { - return subTitleLabel; - } - private void loadView(NavigationItem navigationItem) { final BSFXMLLoader loader = new BSFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl())); try { diff --git a/src/main/java/io/bitsquare/gui/view/account/content/ChangePasswordCB.java b/src/main/java/io/bitsquare/gui/view/account/content/ChangePasswordCB.java index 99b7ec6f51..0810837ba7 100644 --- a/src/main/java/io/bitsquare/gui/view/account/content/ChangePasswordCB.java +++ b/src/main/java/io/bitsquare/gui/view/account/content/ChangePasswordCB.java @@ -105,7 +105,7 @@ public class ChangePasswordCB extends CachedCodeBehind impleme @FXML private void onSaved() { - boolean result = presentationModel.savePassword(); + boolean result = presentationModel.requestSavePassword(); if (result) { if (parentController instanceof AccountSetupCB) ((AccountSetupCB) parentController).onCompleted(this); diff --git a/src/main/java/io/bitsquare/gui/view/account/content/FiatAccountCB.java b/src/main/java/io/bitsquare/gui/view/account/content/FiatAccountCB.java index 9ac3fcecc5..f6e3ba043b 100644 --- a/src/main/java/io/bitsquare/gui/view/account/content/FiatAccountCB.java +++ b/src/main/java/io/bitsquare/gui/view/account/content/FiatAccountCB.java @@ -166,7 +166,7 @@ public class FiatAccountCB extends CachedCodeBehind implements Ad @FXML private void onSave() { - InputValidator.ValidationResult result = presentationModel.saveBankAccount(); + InputValidator.ValidationResult result = presentationModel.requestSaveBankAccount(); if (result.isValid) { selectionComboBox.getSelectionModel().select(null); Popups.openInfo("You can add more accounts or continue to the next step.", diff --git a/src/main/java/io/bitsquare/gui/view/account/content/PasswordCB.java b/src/main/java/io/bitsquare/gui/view/account/content/PasswordCB.java index 635cfb5409..bdadadc6a0 100644 --- a/src/main/java/io/bitsquare/gui/view/account/content/PasswordCB.java +++ b/src/main/java/io/bitsquare/gui/view/account/content/PasswordCB.java @@ -105,7 +105,7 @@ public class PasswordCB extends CachedCodeBehind implements Adjustab @FXML private void onSaved() { - boolean result = presentationModel.savePassword(); + boolean result = presentationModel.requestSavePassword(); if (result) { if (parentController instanceof AccountSetupCB) ((AccountSetupCB) parentController).onCompleted(this); diff --git a/src/main/java/io/bitsquare/gui/view/account/content/RestrictionsCB.java b/src/main/java/io/bitsquare/gui/view/account/content/RestrictionsCB.java index 4415269e1e..af7993bc7d 100644 --- a/src/main/java/io/bitsquare/gui/view/account/content/RestrictionsCB.java +++ b/src/main/java/io/bitsquare/gui/view/account/content/RestrictionsCB.java @@ -86,7 +86,7 @@ public class RestrictionsCB extends CachedCodeBehind implements initCountry(); initArbitrators(); - completedButton.disableProperty().bind(presentationModel.doneButtonDisabled); + completedButton.disableProperty().bind(presentationModel.doneButtonDisable); } @Override @@ -128,7 +128,7 @@ public class RestrictionsCB extends CachedCodeBehind implements @FXML private void onAddLanguage() { - presentationModel.onAddLanguage(languageComboBox.getSelectionModel().getSelectedItem()); + presentationModel.addLanguage(languageComboBox.getSelectionModel().getSelectedItem()); languageComboBox.getSelectionModel().clearSelection(); } @@ -143,7 +143,7 @@ public class RestrictionsCB extends CachedCodeBehind implements @FXML private void onAddCountry() { - presentationModel.onAddCountry(countryComboBox.getSelectionModel().getSelectedItem()); + presentationModel.addCountry(countryComboBox.getSelectionModel().getSelectedItem()); countryComboBox.getSelectionModel().clearSelection(); } diff --git a/src/main/java/io/bitsquare/gui/view/trade/CreateOfferCB.java b/src/main/java/io/bitsquare/gui/view/trade/CreateOfferCB.java index 4df3306d39..26bbeda425 100644 --- a/src/main/java/io/bitsquare/gui/view/trade/CreateOfferCB.java +++ b/src/main/java/io/bitsquare/gui/view/trade/CreateOfferCB.java @@ -75,6 +75,7 @@ public class CreateOfferCB extends CachedCodeBehind { private boolean detailsVisible; private boolean advancedScreenInited; + private Callable onCloseCallable; private ImageView expand; private ImageView collapse; @@ -97,7 +98,6 @@ public class CreateOfferCB extends CachedCodeBehind { acceptedLanguagesTextField; @FXML private AddressTextField addressTextField; @FXML private BalanceTextField balanceTextField; - private Callable onCloseCallBack; /////////////////////////////////////////////////////////////////////////////////////////// @@ -140,13 +140,14 @@ public class CreateOfferCB extends CachedCodeBehind { // Inform parent that we gor removed. // Needed to reset disable state of createOfferButton in OrderBookController - if (onCloseCallBack != null) + if (onCloseCallable != null) { try { - onCloseCallBack.call(); + onCloseCallable.call(); } catch (Exception e) { e.printStackTrace(); log.error(e.getMessage()); } + } } @@ -522,7 +523,7 @@ public class CreateOfferCB extends CachedCodeBehind { } public void setOnClose(Callable onCloseCallBack) { - this.onCloseCallBack = onCloseCallBack; + this.onCloseCallable = onCloseCallBack; } }