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:
Chris Beams 2014-11-22 11:52:20 +01:00
parent feb891b0dc
commit 100ee01fda
No known key found for this signature in database
GPG Key ID: 3D214F8F5BC5ED73
5 changed files with 12 additions and 21 deletions

View File

@ -29,15 +29,17 @@ import org.slf4j.LoggerFactory;
* active and awake it at reactivation.
* * @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);
protected final T presentationModel;
public CachedViewCB(T presentationModel) {
super(presentationModel);
this.presentationModel = presentationModel;
}
public CachedViewCB() {
super();
this(null);
}
/**

View File

@ -30,27 +30,17 @@ import org.slf4j.LoggerFactory;
/**
* 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);
public static final String TITLE_KEY = "view.title";
protected T presentationModel;
protected Initializable childController;
protected Initializable parent;
@FXML protected Parent root;
protected ViewCB(T presentationModel) {
this.presentationModel = presentationModel;
}
protected ViewCB() {
}
/**
* Get called form GUI framework when the UI is ready.
*

View File

@ -17,9 +17,8 @@
package io.bitsquare.gui.main.account;
import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.ViewCB;
public interface MultiStepNavigation {
void nextStep(ViewCB<? extends PresentationModel> useSettingsContext);
void nextStep(ViewCB useSettingsContext);
}

View File

@ -151,7 +151,7 @@ public class AccountSettingsViewCB extends CachedViewCB {
ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl());
content.getChildren().setAll(loaded.view);
childController = loaded.controller;
((ViewCB<? extends PresentationModel>) childController).setParent(this);
((ViewCB) childController).setParent(this);
((ContextAware) childController).useSettingsContext(true);
return childController;
}

View File

@ -154,7 +154,7 @@ public class AccountSetupViewCB extends ViewCB implements MultiStepNavigation {
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public void nextStep(ViewCB<? extends PresentationModel> childView) {
public void nextStep(ViewCB childView) {
if (childView instanceof SeedWordsViewCB) {
seedWords.onCompleted();
childController = password.show();
@ -192,7 +192,7 @@ public class AccountSetupViewCB extends ViewCB implements MultiStepNavigation {
ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl());
content.getChildren().setAll(loaded.view);
childController = loaded.controller;
((ViewCB<? extends PresentationModel>) childController).setParent(this);
((ViewCB) childController).setParent(this);
((ContextAware) childController).useSettingsContext(false);
return childController;
}
@ -201,7 +201,7 @@ public class AccountSetupViewCB extends ViewCB implements MultiStepNavigation {
class WizardItem extends HBox {
private static final Logger log = LoggerFactory.getLogger(WizardItem.class);
private ViewCB<? extends PresentationModel> childController;
private ViewCB childController;
private final ImageView imageView;
private final Label titleLabel;
@ -248,7 +248,7 @@ class WizardItem extends HBox {
getChildren().addAll(imageView, vBox);
}
ViewCB<? extends PresentationModel> show() {
ViewCB show() {
host.loadView(navigationItem);
/* navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ACCOUNT, Navigation
.Item.ACCOUNT_SETUP,