mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-25 07:27:18 +01:00
Remove notion of 'childController' from View hierarchy
This commit is contained in:
parent
02bf6f673d
commit
d02ddd6946
9 changed files with 21 additions and 33 deletions
|
@ -33,7 +33,6 @@ public class View<M> {
|
|||
protected final M model;
|
||||
protected @FXML Parent root;
|
||||
|
||||
protected View childController;
|
||||
protected Initializable parent;
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import javax.inject.Inject;
|
|||
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
|
|
@ -25,7 +25,6 @@ import io.bitsquare.gui.main.account.arbitrator.registration.ArbitratorRegistrat
|
|||
import javax.inject.Inject;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.*;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
|
|
|
@ -35,7 +35,6 @@ import java.util.List;
|
|||
import javax.inject.Inject;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.stage.Stage;
|
||||
|
|
|
@ -27,7 +27,6 @@ import io.bitsquare.gui.util.Colors;
|
|||
import javax.inject.Inject;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.*;
|
||||
|
@ -132,10 +131,11 @@ public class AccountSettingsView extends ActivatableViewAndModel {
|
|||
protected View loadView(Navigation.Item navigationItem) {
|
||||
ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl());
|
||||
content.getChildren().setAll(loaded.view);
|
||||
childController = (View) loaded.controller;
|
||||
childController.setParent(this);
|
||||
((ContextAware) childController).useSettingsContext(true);
|
||||
return childController;
|
||||
View child = (View) loaded.controller;
|
||||
child.setParent(this);
|
||||
if (child instanceof ContextAware)
|
||||
((ContextAware) child).useSettingsContext(true);
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ import io.bitsquare.gui.main.account.content.seedwords.SeedWordsView;
|
|||
import javax.inject.Inject;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.image.*;
|
||||
|
@ -82,29 +81,29 @@ public class AccountSetupView extends ActivatableView implements MultiStepNaviga
|
|||
|
||||
switch (navigationItems[3]) {
|
||||
case SEED_WORDS:
|
||||
childController = seedWords.show();
|
||||
seedWords.show();
|
||||
break;
|
||||
case ADD_PASSWORD:
|
||||
seedWords.onCompleted();
|
||||
childController = password.show();
|
||||
password.show();
|
||||
break;
|
||||
case RESTRICTIONS:
|
||||
seedWords.onCompleted();
|
||||
password.onCompleted();
|
||||
childController = restrictions.show();
|
||||
restrictions.show();
|
||||
break;
|
||||
case FIAT_ACCOUNT:
|
||||
seedWords.onCompleted();
|
||||
password.onCompleted();
|
||||
restrictions.onCompleted();
|
||||
childController = fiatAccount.show();
|
||||
fiatAccount.show();
|
||||
break;
|
||||
case REGISTRATION:
|
||||
seedWords.onCompleted();
|
||||
password.onCompleted();
|
||||
restrictions.onCompleted();
|
||||
fiatAccount.onCompleted();
|
||||
childController = registration.show();
|
||||
registration.show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +134,7 @@ public class AccountSetupView extends ActivatableView implements MultiStepNaviga
|
|||
@Override
|
||||
public void activate() {
|
||||
navigation.addListener(listener);
|
||||
childController = fiatAccount.show();
|
||||
fiatAccount.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -152,23 +151,22 @@ public class AccountSetupView extends ActivatableView implements MultiStepNaviga
|
|||
public void nextStep(View childView) {
|
||||
if (childView instanceof SeedWordsView) {
|
||||
seedWords.onCompleted();
|
||||
childController = password.show();
|
||||
password.show();
|
||||
}
|
||||
else if (childView instanceof PasswordView) {
|
||||
password.onCompleted();
|
||||
childController = restrictions.show();
|
||||
restrictions.show();
|
||||
}
|
||||
else if (childView instanceof RestrictionsView) {
|
||||
restrictions.onCompleted();
|
||||
childController = fiatAccount.show();
|
||||
fiatAccount.show();
|
||||
}
|
||||
else if (childView instanceof IrcAccountView) {
|
||||
fiatAccount.onCompleted();
|
||||
childController = registration.show();
|
||||
registration.show();
|
||||
}
|
||||
else if (childView instanceof RegistrationView) {
|
||||
registration.onCompleted();
|
||||
childController = null;
|
||||
|
||||
if (navigation.getItemsForReturning() != null)
|
||||
navigation.navigationTo(navigation.getItemsForReturning());
|
||||
|
@ -186,18 +184,17 @@ public class AccountSetupView extends ActivatableView implements MultiStepNaviga
|
|||
protected View loadView(Navigation.Item navigationItem) {
|
||||
ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl());
|
||||
content.getChildren().setAll(loaded.view);
|
||||
childController = (View) loaded.controller;
|
||||
childController.setParent(this);
|
||||
((ContextAware) childController).useSettingsContext(false);
|
||||
return childController;
|
||||
View child = (View) loaded.controller;
|
||||
child.setParent(this);
|
||||
if (child instanceof ContextAware)
|
||||
((ContextAware) child).useSettingsContext(false);
|
||||
return child;
|
||||
}
|
||||
}
|
||||
|
||||
class WizardItem extends HBox {
|
||||
private static final Logger log = LoggerFactory.getLogger(WizardItem.class);
|
||||
|
||||
private View childController;
|
||||
|
||||
private final ImageView imageView;
|
||||
private final Label titleLabel;
|
||||
private final Label subTitleLabel;
|
||||
|
@ -243,7 +240,7 @@ class WizardItem extends HBox {
|
|||
getChildren().addAll(imageView, vBox);
|
||||
}
|
||||
|
||||
View show() {
|
||||
void show() {
|
||||
host.loadView(navigationItem);
|
||||
/* navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ACCOUNT, Navigation
|
||||
.Item.ACCOUNT_SETUP,
|
||||
|
@ -253,8 +250,6 @@ class WizardItem extends HBox {
|
|||
imageView.setId("image-arrow-blue");
|
||||
titleLabel.setId("wizard-title-active");
|
||||
subTitleLabel.setId("wizard-sub-title-active");
|
||||
|
||||
return childController;
|
||||
}
|
||||
|
||||
void onCompleted() {
|
||||
|
|
|
@ -26,7 +26,6 @@ import javax.inject.Inject;
|
|||
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
|
||||
public class FundsView extends ActivatableViewAndModel {
|
||||
|
|
|
@ -27,7 +27,6 @@ import javax.inject.Inject;
|
|||
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
|
||||
public class PortfolioView extends ActivatableViewAndModel {
|
||||
|
|
|
@ -27,7 +27,6 @@ import javax.inject.Inject;
|
|||
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
|
||||
public class SettingsView extends ActivatableViewAndModel {
|
||||
|
|
Loading…
Add table
Reference in a new issue