Resolve cyclic package dependencies in account package

This commit is contained in:
Manfred Karrer 2014-09-11 01:50:31 +02:00
parent ffd7188534
commit 62338411d2
8 changed files with 49 additions and 23 deletions

View file

@ -0,0 +1,25 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.main.account;
import io.bitsquare.gui.CodeBehind;
import io.bitsquare.gui.PresentationModel;
public interface MultiStepNavigation {
void nextStep(CodeBehind<? extends PresentationModel> useSettingsContext);
}

View file

@ -18,8 +18,8 @@
package io.bitsquare.gui.main.account.content.changepassword;
import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.main.account.MultiStepNavigation;
import io.bitsquare.gui.main.account.content.ContextAware;
import io.bitsquare.gui.main.account.setup.AccountSetupViewCB;
import io.bitsquare.gui.main.help.Help;
import io.bitsquare.gui.main.help.HelpId;
@ -107,8 +107,8 @@ public class ChangePasswordViewCB extends CachedCodeBehind<ChangePasswordPM> imp
private void onSaved() {
boolean result = presentationModel.requestSavePassword();
if (result) {
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(this);
if (parentController instanceof MultiStepNavigation)
((MultiStepNavigation) parentController).nextStep(this);
}
else {
log.debug(presentationModel.getErrorMessage()); // TODO use validating TF
@ -122,8 +122,8 @@ public class ChangePasswordViewCB extends CachedCodeBehind<ChangePasswordPM> imp
@FXML
private void onSkipped() {
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(this);
if (parentController instanceof MultiStepNavigation)
((MultiStepNavigation) parentController).nextStep(this);
}
}

View file

@ -22,8 +22,8 @@ import io.bitsquare.bank.BankAccountType;
import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.main.account.MultiStepNavigation;
import io.bitsquare.gui.main.account.content.ContextAware;
import io.bitsquare.gui.main.account.setup.AccountSetupViewCB;
import io.bitsquare.gui.main.help.Help;
import io.bitsquare.gui.main.help.HelpId;
import io.bitsquare.gui.util.validation.InputValidator;
@ -177,7 +177,7 @@ public class FiatAccountViewCB extends CachedCodeBehind<FiatAccountPm> implement
@FXML
private void onCompleted() {
if (parentController != null)
((AccountSetupViewCB) parentController).onCompleted(this);
((MultiStepNavigation) parentController).nextStep(this);
}
@FXML

View file

@ -18,8 +18,8 @@
package io.bitsquare.gui.main.account.content.password;
import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.main.account.MultiStepNavigation;
import io.bitsquare.gui.main.account.content.ContextAware;
import io.bitsquare.gui.main.account.setup.AccountSetupViewCB;
import io.bitsquare.gui.main.help.Help;
import io.bitsquare.gui.main.help.HelpId;
@ -107,8 +107,8 @@ public class PasswordViewCB extends CachedCodeBehind<PasswordPM> implements Cont
private void onSaved() {
boolean result = presentationModel.requestSavePassword();
if (result) {
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(this);
if (parentController instanceof MultiStepNavigation)
((MultiStepNavigation) parentController).nextStep(this);
}
else {
// TODO use validating passwordTF
@ -118,8 +118,8 @@ public class PasswordViewCB extends CachedCodeBehind<PasswordPM> implements Cont
@FXML
private void onSkipped() {
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(this);
if (parentController instanceof MultiStepNavigation)
((MultiStepNavigation) parentController).nextStep(this);
}
@FXML

View file

@ -22,8 +22,8 @@ import io.bitsquare.gui.OverlayController;
import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.components.btc.AddressTextField;
import io.bitsquare.gui.components.btc.BalanceTextField;
import io.bitsquare.gui.main.account.MultiStepNavigation;
import io.bitsquare.gui.main.account.content.ContextAware;
import io.bitsquare.gui.main.account.setup.AccountSetupViewCB;
import io.bitsquare.gui.main.help.Help;
import io.bitsquare.gui.main.help.HelpId;
import io.bitsquare.locale.BSResources;
@ -117,8 +117,8 @@ public class RegistrationViewCB extends CachedCodeBehind<RegistrationPM> impleme
@Override
public void handle(ActionEvent actionEvent) {
try {
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(RegistrationViewCB.this);
if (parentController instanceof MultiStepNavigation)
((MultiStepNavigation) parentController).nextStep(RegistrationViewCB.this);
} catch (Exception e) {
e.printStackTrace();
}

View file

@ -21,8 +21,8 @@ import io.bitsquare.BitSquare;
import io.bitsquare.arbitrator.Arbitrator;
import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.main.account.MultiStepNavigation;
import io.bitsquare.gui.main.account.content.ContextAware;
import io.bitsquare.gui.main.account.setup.AccountSetupViewCB;
import io.bitsquare.gui.main.help.Help;
import io.bitsquare.gui.main.help.HelpId;
import io.bitsquare.gui.util.ImageUtil;
@ -160,8 +160,8 @@ public class RestrictionsViewCB extends CachedCodeBehind<RestrictionsPM> impleme
@FXML
private void onCompleted() {
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(this);
if (parentController instanceof MultiStepNavigation)
((MultiStepNavigation) parentController).nextStep(this);
}
@FXML

View file

@ -18,8 +18,8 @@
package io.bitsquare.gui.main.account.content.seedwords;
import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.main.account.MultiStepNavigation;
import io.bitsquare.gui.main.account.content.ContextAware;
import io.bitsquare.gui.main.account.setup.AccountSetupViewCB;
import io.bitsquare.gui.main.help.Help;
import io.bitsquare.gui.main.help.HelpId;
@ -101,8 +101,8 @@ public class SeedWordsViewCB extends CachedCodeBehind<SeedWordsPM> implements Co
@FXML
private void onCompleted() {
if (parentController instanceof AccountSetupViewCB)
((AccountSetupViewCB) parentController).onCompleted(this);
if (parentController instanceof MultiStepNavigation)
((MultiStepNavigation) parentController).nextStep(this);
}
@FXML

View file

@ -21,6 +21,7 @@ import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.CodeBehind;
import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.main.account.MultiStepNavigation;
import io.bitsquare.gui.main.account.content.ContextAware;
import io.bitsquare.gui.main.account.content.fiat.FiatAccountViewCB;
import io.bitsquare.gui.main.account.content.password.PasswordViewCB;
@ -50,7 +51,7 @@ import javafx.scene.layout.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AccountSetupViewCB extends CachedCodeBehind<AccountSetupPM> {
public class AccountSetupViewCB extends CachedCodeBehind<AccountSetupPM> implements MultiStepNavigation {
private static final Logger log = LoggerFactory.getLogger(AccountSetupViewCB.class);
@ -121,7 +122,7 @@ public class AccountSetupViewCB extends CachedCodeBehind<AccountSetupPM> {
// UI handlers
///////////////////////////////////////////////////////////////////////////////////////////
public void onCompleted(CodeBehind<? extends PresentationModel> childView) {
public void nextStep(CodeBehind<? extends PresentationModel> childView) {
if (childView instanceof SeedWordsViewCB) {
seedWords.onCompleted();
childController = password.show();