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