mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-12 00:53:05 -04:00
Remove generic model parameter from ViewCB
Push the presentation model field down into CachedViewCB--that is the only place it is actually used from.
This commit is contained in:
parent
feb891b0dc
commit
100ee01fda
5 changed files with 12 additions and 21 deletions
|
@ -29,15 +29,17 @@ import org.slf4j.LoggerFactory;
|
||||||
* active and awake it at reactivation.
|
* active and awake it at reactivation.
|
||||||
* * @param <T> The PresentationModel used in that class
|
* * @param <T> The PresentationModel used in that class
|
||||||
*/
|
*/
|
||||||
public class CachedViewCB<T extends PresentationModel> extends ViewCB<T> {
|
public class CachedViewCB<T extends PresentationModel> extends ViewCB {
|
||||||
private static final Logger log = LoggerFactory.getLogger(CachedViewCB.class);
|
private static final Logger log = LoggerFactory.getLogger(CachedViewCB.class);
|
||||||
|
|
||||||
|
protected final T presentationModel;
|
||||||
|
|
||||||
public CachedViewCB(T presentationModel) {
|
public CachedViewCB(T presentationModel) {
|
||||||
super(presentationModel);
|
this.presentationModel = presentationModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CachedViewCB() {
|
public CachedViewCB() {
|
||||||
super();
|
this(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,27 +30,17 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Non caching version for code behind classes using the PM pattern
|
* Non caching version for code behind classes using the PM pattern
|
||||||
*
|
|
||||||
* @param <T> The PresentationModel used in that class
|
|
||||||
*/
|
*/
|
||||||
public class ViewCB<T extends PresentationModel> implements Initializable {
|
public class ViewCB implements Initializable {
|
||||||
private static final Logger log = LoggerFactory.getLogger(ViewCB.class);
|
private static final Logger log = LoggerFactory.getLogger(ViewCB.class);
|
||||||
|
|
||||||
public static final String TITLE_KEY = "view.title";
|
public static final String TITLE_KEY = "view.title";
|
||||||
|
|
||||||
protected T presentationModel;
|
|
||||||
protected Initializable childController;
|
protected Initializable childController;
|
||||||
protected Initializable parent;
|
protected Initializable parent;
|
||||||
|
|
||||||
@FXML protected Parent root;
|
@FXML protected Parent root;
|
||||||
|
|
||||||
protected ViewCB(T presentationModel) {
|
|
||||||
this.presentationModel = presentationModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ViewCB() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get called form GUI framework when the UI is ready.
|
* Get called form GUI framework when the UI is ready.
|
||||||
*
|
*
|
||||||
|
|
|
@ -17,9 +17,8 @@
|
||||||
|
|
||||||
package io.bitsquare.gui.main.account;
|
package io.bitsquare.gui.main.account;
|
||||||
|
|
||||||
import io.bitsquare.gui.PresentationModel;
|
|
||||||
import io.bitsquare.gui.ViewCB;
|
import io.bitsquare.gui.ViewCB;
|
||||||
|
|
||||||
public interface MultiStepNavigation {
|
public interface MultiStepNavigation {
|
||||||
void nextStep(ViewCB<? extends PresentationModel> useSettingsContext);
|
void nextStep(ViewCB useSettingsContext);
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class AccountSettingsViewCB extends CachedViewCB {
|
||||||
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 = loaded.controller;
|
childController = loaded.controller;
|
||||||
((ViewCB<? extends PresentationModel>) childController).setParent(this);
|
((ViewCB) childController).setParent(this);
|
||||||
((ContextAware) childController).useSettingsContext(true);
|
((ContextAware) childController).useSettingsContext(true);
|
||||||
return childController;
|
return childController;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class AccountSetupViewCB extends ViewCB implements MultiStepNavigation {
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void nextStep(ViewCB<? extends PresentationModel> childView) {
|
public void nextStep(ViewCB childView) {
|
||||||
if (childView instanceof SeedWordsViewCB) {
|
if (childView instanceof SeedWordsViewCB) {
|
||||||
seedWords.onCompleted();
|
seedWords.onCompleted();
|
||||||
childController = password.show();
|
childController = password.show();
|
||||||
|
@ -192,7 +192,7 @@ public class AccountSetupViewCB extends ViewCB implements MultiStepNavigation {
|
||||||
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 = loaded.controller;
|
childController = loaded.controller;
|
||||||
((ViewCB<? extends PresentationModel>) childController).setParent(this);
|
((ViewCB) childController).setParent(this);
|
||||||
((ContextAware) childController).useSettingsContext(false);
|
((ContextAware) childController).useSettingsContext(false);
|
||||||
return childController;
|
return childController;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ public class AccountSetupViewCB extends ViewCB implements MultiStepNavigation {
|
||||||
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 ViewCB<? extends PresentationModel> childController;
|
private ViewCB childController;
|
||||||
|
|
||||||
private final ImageView imageView;
|
private final ImageView imageView;
|
||||||
private final Label titleLabel;
|
private final Label titleLabel;
|
||||||
|
@ -248,7 +248,7 @@ class WizardItem extends HBox {
|
||||||
getChildren().addAll(imageView, vBox);
|
getChildren().addAll(imageView, vBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewCB<? extends PresentationModel> show() {
|
ViewCB 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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue