mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-20 12:54:37 -04:00
Fix missing CachingViewLoader
This commit is contained in:
parent
3f5d82f8b0
commit
ea98a15406
8 changed files with 30 additions and 16 deletions
|
@ -28,8 +28,8 @@ import javax.inject.Inject;
|
||||||
import viewfx.view.FxmlView;
|
import viewfx.view.FxmlView;
|
||||||
import viewfx.view.View;
|
import viewfx.view.View;
|
||||||
import viewfx.view.ViewLoader;
|
import viewfx.view.ViewLoader;
|
||||||
import viewfx.view.ViewPath;
|
|
||||||
import viewfx.view.support.ActivatableView;
|
import viewfx.view.support.ActivatableView;
|
||||||
|
import viewfx.view.support.CachingViewLoader;
|
||||||
|
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
@ -45,9 +45,11 @@ public class AccountView extends ActivatableView<TabPane, AccountViewModel> {
|
||||||
|
|
||||||
private final ViewLoader viewLoader;
|
private final ViewLoader viewLoader;
|
||||||
private final Navigation navigation;
|
private final Navigation navigation;
|
||||||
|
private View accountSetupWizardView;
|
||||||
|
private Tab tab;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private AccountView(AccountViewModel model, ViewLoader viewLoader, Navigation navigation) {
|
private AccountView(AccountViewModel model, CachingViewLoader viewLoader, Navigation navigation) {
|
||||||
super(model);
|
super(model);
|
||||||
this.viewLoader = viewLoader;
|
this.viewLoader = viewLoader;
|
||||||
this.navigation = navigation;
|
this.navigation = navigation;
|
||||||
|
@ -73,8 +75,7 @@ public class AccountView extends ActivatableView<TabPane, AccountViewModel> {
|
||||||
navigation.addListener(navigationListener);
|
navigation.addListener(navigationListener);
|
||||||
root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
||||||
|
|
||||||
if (navigation.getCurrentPath().size() == 2 &&
|
if (navigation.getCurrentPath().size() == 2 && navigation.getCurrentPath().get(1) == AccountView.class) {
|
||||||
navigation.getCurrentPath().get(1) == AccountView.class) {
|
|
||||||
if (model.getNeedRegistration()) {
|
if (model.getNeedRegistration()) {
|
||||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSetupWizard.class);
|
navigation.navigateTo(MainView.class, AccountView.class, AccountSetupWizard.class);
|
||||||
}
|
}
|
||||||
|
@ -91,10 +92,12 @@ public class AccountView extends ActivatableView<TabPane, AccountViewModel> {
|
||||||
public void deactivate() {
|
public void deactivate() {
|
||||||
navigation.removeListener(navigationListener);
|
navigation.removeListener(navigationListener);
|
||||||
root.getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
|
root.getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
|
||||||
|
|
||||||
|
if (accountSetupWizardView != null)
|
||||||
|
tab.setContent(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadView(Class<? extends View> viewClass) {
|
private void loadView(Class<? extends View> viewClass) {
|
||||||
Tab tab;
|
|
||||||
View view = viewLoader.load(viewClass);
|
View view = viewLoader.load(viewClass);
|
||||||
|
|
||||||
if (view instanceof AccountSettingsView) {
|
if (view instanceof AccountSettingsView) {
|
||||||
|
@ -106,6 +109,7 @@ public class AccountView extends ActivatableView<TabPane, AccountViewModel> {
|
||||||
tab = accountSettingsTab;
|
tab = accountSettingsTab;
|
||||||
tab.setText("Account setup");
|
tab.setText("Account setup");
|
||||||
arbitratorSettingsTab.setDisable(true);
|
arbitratorSettingsTab.setDisable(true);
|
||||||
|
accountSetupWizardView = view;
|
||||||
}
|
}
|
||||||
else if (view instanceof ArbitratorSettingsView) {
|
else if (view instanceof ArbitratorSettingsView) {
|
||||||
tab = arbitratorSettingsTab;
|
tab = arbitratorSettingsTab;
|
||||||
|
|
|
@ -34,6 +34,7 @@ import viewfx.view.FxmlView;
|
||||||
import viewfx.view.View;
|
import viewfx.view.View;
|
||||||
import viewfx.view.ViewLoader;
|
import viewfx.view.ViewLoader;
|
||||||
import viewfx.view.support.ActivatableView;
|
import viewfx.view.support.ActivatableView;
|
||||||
|
import viewfx.view.support.CachingViewLoader;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
@ -58,7 +59,7 @@ public class ArbitratorBrowserView extends ActivatableView<Pane, Void> implement
|
||||||
private final MessageService messageService;
|
private final MessageService messageService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ArbitratorBrowserView(ViewLoader viewLoader, AccountSettings accountSettings, Persistence persistence,
|
public ArbitratorBrowserView(CachingViewLoader viewLoader, AccountSettings accountSettings, Persistence persistence,
|
||||||
MessageService messageService) {
|
MessageService messageService) {
|
||||||
this.viewLoader = viewLoader;
|
this.viewLoader = viewLoader;
|
||||||
this.accountSettings = accountSettings;
|
this.accountSettings = accountSettings;
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class ChangePasswordView extends InitializableView<GridPane, ChangePasswo
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void onSaved() {
|
private void onSaved() {
|
||||||
if (model.requestSavePassword())
|
if (wizard != null && model.requestSavePassword())
|
||||||
wizard.nextStep(this);
|
wizard.nextStep(this);
|
||||||
else
|
else
|
||||||
log.debug(model.getErrorMessage()); // TODO use validating TF
|
log.debug(model.getErrorMessage()); // TODO use validating TF
|
||||||
|
@ -77,6 +77,7 @@ public class ChangePasswordView extends InitializableView<GridPane, ChangePasswo
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void onSkipped() {
|
private void onSkipped() {
|
||||||
|
if (wizard != null)
|
||||||
wizard.nextStep(this);
|
wizard.nextStep(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import viewfx.view.ViewLoader;
|
||||||
import viewfx.view.ViewPath;
|
import viewfx.view.ViewPath;
|
||||||
import viewfx.view.Wizard;
|
import viewfx.view.Wizard;
|
||||||
import viewfx.view.support.ActivatableViewAndModel;
|
import viewfx.view.support.ActivatableViewAndModel;
|
||||||
|
import viewfx.view.support.CachingViewLoader;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
|
@ -59,7 +60,7 @@ public class AccountSettingsView extends ActivatableViewAndModel {
|
||||||
@FXML private AnchorPane content;
|
@FXML private AnchorPane content;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private AccountSettingsView(ViewLoader viewLoader, Navigation navigation) {
|
private AccountSettingsView(CachingViewLoader viewLoader, Navigation navigation) {
|
||||||
this.viewLoader = viewLoader;
|
this.viewLoader = viewLoader;
|
||||||
this.navigation = navigation;
|
this.navigation = navigation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import viewfx.view.View;
|
||||||
import viewfx.view.ViewLoader;
|
import viewfx.view.ViewLoader;
|
||||||
import viewfx.view.Wizard;
|
import viewfx.view.Wizard;
|
||||||
import viewfx.view.support.ActivatableView;
|
import viewfx.view.support.ActivatableView;
|
||||||
|
import viewfx.view.support.CachingViewLoader;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
|
@ -53,7 +54,7 @@ public class AccountSetupWizard extends ActivatableView implements Wizard {
|
||||||
private final Navigation navigation;
|
private final Navigation navigation;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private AccountSetupWizard(ViewLoader viewLoader, Navigation navigation) {
|
private AccountSetupWizard(CachingViewLoader viewLoader, Navigation navigation) {
|
||||||
this.viewLoader = viewLoader;
|
this.viewLoader = viewLoader;
|
||||||
this.navigation = navigation;
|
this.navigation = navigation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import viewfx.view.FxmlView;
|
||||||
import viewfx.view.View;
|
import viewfx.view.View;
|
||||||
import viewfx.view.ViewLoader;
|
import viewfx.view.ViewLoader;
|
||||||
import viewfx.view.support.ActivatableViewAndModel;
|
import viewfx.view.support.ActivatableViewAndModel;
|
||||||
|
import viewfx.view.support.CachingViewLoader;
|
||||||
|
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
@ -47,7 +48,7 @@ public class FundsView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||||
private final Navigation navigation;
|
private final Navigation navigation;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public FundsView(ViewLoader viewLoader, Navigation navigation) {
|
public FundsView(CachingViewLoader viewLoader, Navigation navigation) {
|
||||||
this.viewLoader = viewLoader;
|
this.viewLoader = viewLoader;
|
||||||
this.navigation = navigation;
|
this.navigation = navigation;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +83,7 @@ public class FundsView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||||
public void doDeactivate() {
|
public void doDeactivate() {
|
||||||
root.getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
|
root.getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
|
||||||
navigation.removeListener(navigationListener);
|
navigation.removeListener(navigationListener);
|
||||||
|
currentTab = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadView(Class<? extends View> viewClass) {
|
private void loadView(Class<? extends View> viewClass) {
|
||||||
|
@ -91,8 +93,10 @@ public class FundsView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||||
|
|
||||||
View view = viewLoader.load(viewClass);
|
View view = viewLoader.load(viewClass);
|
||||||
|
|
||||||
if (view instanceof WithdrawalView) currentTab = withdrawalTab;
|
if (view instanceof WithdrawalView)
|
||||||
else if (view instanceof TransactionsView) currentTab = transactionsTab;
|
currentTab = withdrawalTab;
|
||||||
|
else if (view instanceof TransactionsView)
|
||||||
|
currentTab = transactionsTab;
|
||||||
|
|
||||||
currentTab.setContent(view.getRoot());
|
currentTab.setContent(view.getRoot());
|
||||||
root.getSelectionModel().select(currentTab);
|
root.getSelectionModel().select(currentTab);
|
||||||
|
|
|
@ -31,6 +31,7 @@ import viewfx.view.FxmlView;
|
||||||
import viewfx.view.View;
|
import viewfx.view.View;
|
||||||
import viewfx.view.ViewLoader;
|
import viewfx.view.ViewLoader;
|
||||||
import viewfx.view.support.ActivatableViewAndModel;
|
import viewfx.view.support.ActivatableViewAndModel;
|
||||||
|
import viewfx.view.support.CachingViewLoader;
|
||||||
|
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
@ -50,7 +51,7 @@ public class PortfolioView extends ActivatableViewAndModel<TabPane, Activatable>
|
||||||
private final TradeManager tradeManager;
|
private final TradeManager tradeManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public PortfolioView(ViewLoader viewLoader, Navigation navigation, TradeManager tradeManager) {
|
public PortfolioView(CachingViewLoader viewLoader, Navigation navigation, TradeManager tradeManager) {
|
||||||
this.viewLoader = viewLoader;
|
this.viewLoader = viewLoader;
|
||||||
this.navigation = navigation;
|
this.navigation = navigation;
|
||||||
this.tradeManager = tradeManager;
|
this.tradeManager = tradeManager;
|
||||||
|
|
|
@ -30,6 +30,7 @@ import viewfx.view.FxmlView;
|
||||||
import viewfx.view.View;
|
import viewfx.view.View;
|
||||||
import viewfx.view.ViewLoader;
|
import viewfx.view.ViewLoader;
|
||||||
import viewfx.view.support.ActivatableViewAndModel;
|
import viewfx.view.support.ActivatableViewAndModel;
|
||||||
|
import viewfx.view.support.CachingViewLoader;
|
||||||
|
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
@ -48,7 +49,7 @@ public class SettingsView extends ActivatableViewAndModel<TabPane, Activatable>
|
||||||
private final Navigation navigation;
|
private final Navigation navigation;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public SettingsView(ViewLoader viewLoader, Navigation navigation, Preferences preferences) {
|
public SettingsView(CachingViewLoader viewLoader, Navigation navigation, Preferences preferences) {
|
||||||
this.viewLoader = viewLoader;
|
this.viewLoader = viewLoader;
|
||||||
this.navigation = navigation;
|
this.navigation = navigation;
|
||||||
this.preferences = preferences;
|
this.preferences = preferences;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue