mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-04 04:34:26 -04:00
Specify view root node type with generic parameter
This commit is contained in:
parent
9d484e3f27
commit
604d1c128e
26 changed files with 69 additions and 62 deletions
|
@ -23,12 +23,12 @@ import javafx.scene.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public abstract class AbstractView<M> implements View {
|
public abstract class AbstractView<R extends Parent, M> implements View {
|
||||||
|
|
||||||
protected final Logger log = LoggerFactory.getLogger(this.getClass());
|
protected final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
|
protected @FXML R root;
|
||||||
protected final M model;
|
protected final M model;
|
||||||
protected @FXML Parent root;
|
|
||||||
|
|
||||||
public AbstractView(M model) {
|
public AbstractView(M model) {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
|
|
||||||
package io.bitsquare.gui;
|
package io.bitsquare.gui;
|
||||||
|
|
||||||
public abstract class ActivatableView<M> extends InitializableView<M> {
|
import javafx.scene.*;
|
||||||
|
|
||||||
|
public abstract class ActivatableView<R extends Parent, M> extends InitializableView<R, M> {
|
||||||
|
|
||||||
public ActivatableView(M model) {
|
public ActivatableView(M model) {
|
||||||
super(model);
|
super(model);
|
||||||
|
|
|
@ -17,9 +17,11 @@
|
||||||
|
|
||||||
package io.bitsquare.gui;
|
package io.bitsquare.gui;
|
||||||
|
|
||||||
|
import javafx.scene.*;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public abstract class ActivatableViewAndModel<M extends Activatable> extends ActivatableView<M> {
|
public abstract class ActivatableViewAndModel<R extends Parent, M extends Activatable> extends ActivatableView<R, M> {
|
||||||
|
|
||||||
public ActivatableViewAndModel(M model) {
|
public ActivatableViewAndModel(M model) {
|
||||||
super(checkNotNull(model, "Model must not be null"));
|
super(checkNotNull(model, "Model must not be null"));
|
||||||
|
|
|
@ -22,8 +22,9 @@ import java.net.URL;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.*;
|
||||||
|
|
||||||
public abstract class InitializableView<M> extends AbstractView<M> implements Initializable {
|
public abstract class InitializableView<R extends Parent, M> extends AbstractView<R, M> implements Initializable {
|
||||||
|
|
||||||
public InitializableView(M model) {
|
public InitializableView(M model) {
|
||||||
super(model);
|
super(model);
|
||||||
|
|
|
@ -44,7 +44,7 @@ import javafx.scene.text.*;
|
||||||
import static io.bitsquare.gui.Navigation.Item.*;
|
import static io.bitsquare.gui.Navigation.Item.*;
|
||||||
import static javafx.scene.layout.AnchorPane.*;
|
import static javafx.scene.layout.AnchorPane.*;
|
||||||
|
|
||||||
public class MainView extends ActivatableView<MainViewModel> {
|
public class MainView extends ActivatableView<StackPane, MainViewModel> {
|
||||||
|
|
||||||
public static final String TITLE_KEY = "view.title";
|
public static final String TITLE_KEY = "view.title";
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ public class MainView extends ActivatableView<MainViewModel> {
|
||||||
|
|
||||||
VBox splashScreen = createSplashScreen();
|
VBox splashScreen = createSplashScreen();
|
||||||
|
|
||||||
((StackPane) root).getChildren().addAll(baseApplicationContainer, splashScreen);
|
root.getChildren().addAll(baseApplicationContainer, splashScreen);
|
||||||
|
|
||||||
Platform.runLater(
|
Platform.runLater(
|
||||||
() -> model.initBackend().subscribe(
|
() -> model.initBackend().subscribe(
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.gui.main.account;
|
package io.bitsquare.gui.main.account;
|
||||||
|
|
||||||
import io.bitsquare.gui.ActivatableViewAndModel;
|
import io.bitsquare.gui.ActivatableView;
|
||||||
import io.bitsquare.gui.Navigation;
|
import io.bitsquare.gui.Navigation;
|
||||||
import io.bitsquare.gui.View;
|
import io.bitsquare.gui.View;
|
||||||
import io.bitsquare.gui.ViewLoader;
|
import io.bitsquare.gui.ViewLoader;
|
||||||
|
@ -28,21 +28,20 @@ import javafx.beans.value.ChangeListener;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
|
||||||
public class AccountView extends ActivatableViewAndModel {
|
public class AccountView extends ActivatableView<TabPane, AccountViewModel> {
|
||||||
|
|
||||||
private Navigation.Listener navigationListener;
|
private Navigation.Listener navigationListener;
|
||||||
private ChangeListener<Tab> tabChangeListener;
|
private ChangeListener<Tab> tabChangeListener;
|
||||||
|
|
||||||
@FXML Tab accountSettingsTab, arbitratorSettingsTab;
|
@FXML Tab accountSettingsTab, arbitratorSettingsTab;
|
||||||
|
|
||||||
private final AccountViewModel model;
|
|
||||||
private final ViewLoader viewLoader;
|
private final ViewLoader viewLoader;
|
||||||
private final Navigation navigation;
|
private final Navigation navigation;
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private AccountView(AccountViewModel model, ViewLoader viewLoader, Navigation navigation) {
|
private AccountView(AccountViewModel model, ViewLoader viewLoader, Navigation navigation) {
|
||||||
this.model = model;
|
super(model);
|
||||||
this.viewLoader = viewLoader;
|
this.viewLoader = viewLoader;
|
||||||
this.navigation = navigation;
|
this.navigation = navigation;
|
||||||
}
|
}
|
||||||
|
@ -69,9 +68,9 @@ public class AccountView extends ActivatableViewAndModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doActivate() {
|
public void activate() {
|
||||||
navigation.addListener(navigationListener);
|
navigation.addListener(navigationListener);
|
||||||
((TabPane) root).getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
||||||
|
|
||||||
if (navigation.getCurrentItems().length == 2 &&
|
if (navigation.getCurrentItems().length == 2 &&
|
||||||
navigation.getCurrentItems()[1] == Navigation.Item.ACCOUNT) {
|
navigation.getCurrentItems()[1] == Navigation.Item.ACCOUNT) {
|
||||||
|
@ -80,7 +79,7 @@ public class AccountView extends ActivatableViewAndModel {
|
||||||
Navigation.Item.ACCOUNT_SETUP);
|
Navigation.Item.ACCOUNT_SETUP);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (((TabPane) root).getSelectionModel().getSelectedItem() == accountSettingsTab)
|
if (root.getSelectionModel().getSelectedItem() == accountSettingsTab)
|
||||||
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ACCOUNT,
|
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ACCOUNT,
|
||||||
Navigation.Item.ACCOUNT_SETTINGS);
|
Navigation.Item.ACCOUNT_SETTINGS);
|
||||||
else
|
else
|
||||||
|
@ -91,9 +90,9 @@ public class AccountView extends ActivatableViewAndModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doDeactivate() {
|
public void deactivate() {
|
||||||
navigation.removeListener(navigationListener);
|
navigation.removeListener(navigationListener);
|
||||||
((TabPane) root).getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
|
root.getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,7 +122,7 @@ public class AccountView extends ActivatableViewAndModel {
|
||||||
arbitratorSettingsTab.setDisable(true);
|
arbitratorSettingsTab.setDisable(true);
|
||||||
|
|
||||||
tab.setContent(loaded.view);
|
tab.setContent(loaded.view);
|
||||||
((TabPane) root).getSelectionModel().select(tab);
|
root.getSelectionModel().select(tab);
|
||||||
return (View) loaded.controller;
|
return (View) loaded.controller;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ import javafx.scene.layout.*;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
// TODO Arbitration is very basic yet
|
// TODO Arbitration is very basic yet
|
||||||
public class ArbitratorBrowserView extends ActivatableView implements ArbitratorListener {
|
public class ArbitratorBrowserView extends ActivatableView<Pane, Void> implements ArbitratorListener {
|
||||||
|
|
||||||
private final ViewLoader viewLoader;
|
private final ViewLoader viewLoader;
|
||||||
private final AccountSettings accountSettings;
|
private final AccountSettings accountSettings;
|
||||||
|
@ -95,7 +95,7 @@ public class ArbitratorBrowserView extends ActivatableView implements Arbitrator
|
||||||
@Override
|
@Override
|
||||||
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());
|
||||||
((Pane) root).getChildren().set(0, loaded.view);
|
root.getChildren().set(0, loaded.view);
|
||||||
return arbitratorProfileView = (ArbitratorProfileView) loaded.controller;
|
return arbitratorProfileView = (ArbitratorProfileView) loaded.controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ import javax.inject.Inject;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
import javafx.scene.layout.*;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.util.StringConverter;
|
import javafx.util.StringConverter;
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ import de.jensd.fx.fontawesome.AwesomeDude;
|
||||||
import de.jensd.fx.fontawesome.AwesomeIcon;
|
import de.jensd.fx.fontawesome.AwesomeIcon;
|
||||||
|
|
||||||
// TODO Arbitration is very basic yet
|
// TODO Arbitration is very basic yet
|
||||||
public class ArbitratorRegistrationView extends ActivatableView {
|
public class ArbitratorRegistrationView extends ActivatableView<AnchorPane, Void> {
|
||||||
|
|
||||||
private final Persistence persistence;
|
private final Persistence persistence;
|
||||||
private final WalletService walletService;
|
private final WalletService walletService;
|
||||||
|
|
|
@ -31,7 +31,7 @@ import javafx.scene.layout.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class ChangePasswordView extends InitializableView<ChangePasswordViewModel> implements Wizard.Step {
|
public class ChangePasswordView extends InitializableView<GridPane, ChangePasswordViewModel> implements Wizard.Step {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(ChangePasswordView.class);
|
private static final Logger log = LoggerFactory.getLogger(ChangePasswordView.class);
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,9 @@ import io.bitsquare.bank.BankAccount;
|
||||||
import io.bitsquare.bank.BankAccountType;
|
import io.bitsquare.bank.BankAccountType;
|
||||||
import io.bitsquare.gui.ActivatableViewAndModel;
|
import io.bitsquare.gui.ActivatableViewAndModel;
|
||||||
import io.bitsquare.gui.OverlayManager;
|
import io.bitsquare.gui.OverlayManager;
|
||||||
|
import io.bitsquare.gui.Wizard;
|
||||||
import io.bitsquare.gui.components.InputTextField;
|
import io.bitsquare.gui.components.InputTextField;
|
||||||
import io.bitsquare.gui.components.Popups;
|
import io.bitsquare.gui.components.Popups;
|
||||||
import io.bitsquare.gui.Wizard;
|
|
||||||
import io.bitsquare.gui.main.help.Help;
|
import io.bitsquare.gui.main.help.Help;
|
||||||
import io.bitsquare.gui.main.help.HelpId;
|
import io.bitsquare.gui.main.help.HelpId;
|
||||||
import io.bitsquare.gui.util.validation.InputValidator;
|
import io.bitsquare.gui.util.validation.InputValidator;
|
||||||
|
@ -47,14 +47,9 @@ import org.controlsfx.control.action.AbstractAction;
|
||||||
import org.controlsfx.control.action.Action;
|
import org.controlsfx.control.action.Action;
|
||||||
import org.controlsfx.dialog.Dialog;
|
import org.controlsfx.dialog.Dialog;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import static javafx.beans.binding.Bindings.createBooleanBinding;
|
import static javafx.beans.binding.Bindings.createBooleanBinding;
|
||||||
|
|
||||||
public class FiatAccountView extends ActivatableViewAndModel<FiatAccountViewModel> implements Wizard.Step {
|
public class FiatAccountView extends ActivatableViewAndModel<GridPane, FiatAccountViewModel> implements Wizard.Step {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(FiatAccountView.class);
|
|
||||||
|
|
||||||
@FXML HBox buttonsHBox;
|
@FXML HBox buttonsHBox;
|
||||||
@FXML ComboBox<Region> regionComboBox;
|
@FXML ComboBox<Region> regionComboBox;
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
|
||||||
/*
|
/*
|
||||||
Just temporary for giving the user a possibility to test the app via simulating the bank transfer in a IRC chat.
|
Just temporary for giving the user a possibility to test the app via simulating the bank transfer in a IRC chat.
|
||||||
*/
|
*/
|
||||||
public class IrcAccountView extends ActivatableViewAndModel<IrcAccountViewModel> implements Wizard.Step {
|
public class IrcAccountView extends ActivatableViewAndModel<GridPane, IrcAccountViewModel> implements Wizard.Step {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(IrcAccountView.class);
|
private static final Logger log = LoggerFactory.getLogger(IrcAccountView.class);
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ import javafx.scene.layout.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class PasswordView extends InitializableView<PasswordViewModel> implements Wizard.Step {
|
public class PasswordView extends InitializableView<GridPane, PasswordViewModel> implements Wizard.Step {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(PasswordView.class);
|
private static final Logger log = LoggerFactory.getLogger(PasswordView.class);
|
||||||
|
|
||||||
|
|
|
@ -35,12 +35,13 @@ import javax.inject.Inject;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
import javafx.scene.layout.*;
|
||||||
|
|
||||||
import org.controlsfx.control.action.AbstractAction;
|
import org.controlsfx.control.action.AbstractAction;
|
||||||
import org.controlsfx.control.action.Action;
|
import org.controlsfx.control.action.Action;
|
||||||
import org.controlsfx.dialog.Dialog;
|
import org.controlsfx.dialog.Dialog;
|
||||||
|
|
||||||
public class RegistrationView extends InitializableView<RegistrationViewModel> implements Wizard.Step {
|
public class RegistrationView extends InitializableView<GridPane, RegistrationViewModel> implements Wizard.Step {
|
||||||
|
|
||||||
private final OverlayManager overlayManager;
|
private final OverlayManager overlayManager;
|
||||||
|
|
||||||
|
@ -110,8 +111,7 @@ public class RegistrationView extends InitializableView<RegistrationViewModel> i
|
||||||
public void handle(ActionEvent actionEvent) {
|
public void handle(ActionEvent actionEvent) {
|
||||||
getProperties().put("type", "CLOSE");
|
getProperties().put("type", "CLOSE");
|
||||||
try {
|
try {
|
||||||
if (parent instanceof Wizard)
|
parent.nextStep(RegistrationView.this);
|
||||||
((Wizard) parent).nextStep(RegistrationView.this);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ import javafx.stage.Stage;
|
||||||
import javafx.util.Callback;
|
import javafx.util.Callback;
|
||||||
import javafx.util.StringConverter;
|
import javafx.util.StringConverter;
|
||||||
|
|
||||||
public class RestrictionsView extends ActivatableViewAndModel<RestrictionsViewModel> implements Wizard.Step {
|
public class RestrictionsView extends ActivatableViewAndModel<GridPane, RestrictionsViewModel> implements Wizard.Step {
|
||||||
|
|
||||||
@FXML ListView<Locale> languagesListView;
|
@FXML ListView<Locale> languagesListView;
|
||||||
@FXML ListView<Country> countriesListView;
|
@FXML ListView<Country> countriesListView;
|
||||||
|
@ -93,7 +93,7 @@ public class RestrictionsView extends ActivatableViewAndModel<RestrictionsViewMo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hideWizardNavigation() {
|
public void hideWizardNavigation() {
|
||||||
((GridPane) root).getChildren().remove(completedButton);
|
root.getChildren().remove(completedButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
|
|
||||||
public class SeedWordsView extends InitializableView<SeedWordsViewModel> implements Wizard.Step {
|
public class SeedWordsView extends InitializableView<GridPane, SeedWordsViewModel> implements Wizard.Step {
|
||||||
|
|
||||||
private Wizard parent;
|
private Wizard parent;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class SeedWordsView extends InitializableView<SeedWordsViewModel> impleme
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hideWizardNavigation() {
|
public void hideWizardNavigation() {
|
||||||
((GridPane) root).getChildren().remove(completedButton);
|
root.getChildren().remove(completedButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.gui.main.funds;
|
package io.bitsquare.gui.main.funds;
|
||||||
|
|
||||||
|
import io.bitsquare.gui.Activatable;
|
||||||
import io.bitsquare.gui.ActivatableViewAndModel;
|
import io.bitsquare.gui.ActivatableViewAndModel;
|
||||||
import io.bitsquare.gui.Navigation;
|
import io.bitsquare.gui.Navigation;
|
||||||
import io.bitsquare.gui.View;
|
import io.bitsquare.gui.View;
|
||||||
|
@ -28,7 +29,7 @@ import javafx.beans.value.ChangeListener;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
|
||||||
public class FundsView extends ActivatableViewAndModel {
|
public class FundsView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||||
|
|
||||||
private Navigation.Listener navigationListener;
|
private Navigation.Listener navigationListener;
|
||||||
private ChangeListener<Tab> tabChangeListener;
|
private ChangeListener<Tab> tabChangeListener;
|
||||||
|
@ -67,10 +68,10 @@ public class FundsView extends ActivatableViewAndModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doActivate() {
|
public void doActivate() {
|
||||||
((TabPane) root).getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
||||||
navigation.addListener(navigationListener);
|
navigation.addListener(navigationListener);
|
||||||
|
|
||||||
if (((TabPane) root).getSelectionModel().getSelectedItem() == transactionsTab)
|
if (root.getSelectionModel().getSelectedItem() == transactionsTab)
|
||||||
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.FUNDS, Navigation.Item.TRANSACTIONS);
|
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.FUNDS, Navigation.Item.TRANSACTIONS);
|
||||||
else
|
else
|
||||||
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.FUNDS, Navigation.Item.WITHDRAWAL);
|
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.FUNDS, Navigation.Item.WITHDRAWAL);
|
||||||
|
@ -78,7 +79,7 @@ public class FundsView extends ActivatableViewAndModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doDeactivate() {
|
public void doDeactivate() {
|
||||||
((TabPane) root).getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
|
root.getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
|
||||||
navigation.removeListener(navigationListener);
|
navigation.removeListener(navigationListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +101,7 @@ public class FundsView extends ActivatableViewAndModel {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
currentTab.setContent(loaded.view);
|
currentTab.setContent(loaded.view);
|
||||||
((TabPane) root).getSelectionModel().select(currentTab);
|
root.getSelectionModel().select(currentTab);
|
||||||
return (View) loaded.controller;
|
return (View) loaded.controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.gui.main.portfolio;
|
package io.bitsquare.gui.main.portfolio;
|
||||||
|
|
||||||
|
import io.bitsquare.gui.Activatable;
|
||||||
import io.bitsquare.gui.ActivatableViewAndModel;
|
import io.bitsquare.gui.ActivatableViewAndModel;
|
||||||
import io.bitsquare.gui.Navigation;
|
import io.bitsquare.gui.Navigation;
|
||||||
import io.bitsquare.gui.View;
|
import io.bitsquare.gui.View;
|
||||||
|
@ -29,7 +30,7 @@ import javafx.beans.value.ChangeListener;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
|
||||||
public class PortfolioView extends ActivatableViewAndModel {
|
public class PortfolioView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||||
|
|
||||||
private Tab currentTab;
|
private Tab currentTab;
|
||||||
private Navigation.Listener navigationListener;
|
private Navigation.Listener navigationListener;
|
||||||
|
@ -73,7 +74,7 @@ public class PortfolioView extends ActivatableViewAndModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doActivate() {
|
public void doActivate() {
|
||||||
((TabPane) root).getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
||||||
navigation.addListener(navigationListener);
|
navigation.addListener(navigationListener);
|
||||||
|
|
||||||
if (tradeManager.getPendingTrades().size() == 0)
|
if (tradeManager.getPendingTrades().size() == 0)
|
||||||
|
@ -84,7 +85,7 @@ public class PortfolioView extends ActivatableViewAndModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doDeactivate() {
|
public void doDeactivate() {
|
||||||
((TabPane) root).getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
|
root.getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
|
||||||
navigation.removeListener(navigationListener);
|
navigation.removeListener(navigationListener);
|
||||||
currentTab = null;
|
currentTab = null;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +112,7 @@ public class PortfolioView extends ActivatableViewAndModel {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
currentTab.setContent(loaded.view);
|
currentTab.setContent(loaded.view);
|
||||||
((TabPane) root).getSelectionModel().select(currentTab);
|
root.getSelectionModel().select(currentTab);
|
||||||
return (View) loaded.controller;
|
return (View) loaded.controller;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,10 @@ import javax.inject.Inject;
|
||||||
import javafx.beans.property.ReadOnlyObjectWrapper;
|
import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
import javafx.scene.layout.*;
|
||||||
import javafx.util.Callback;
|
import javafx.util.Callback;
|
||||||
|
|
||||||
public class ClosedTradesView extends ActivatableViewAndModel<ClosedTradesViewModel> {
|
public class ClosedTradesView extends ActivatableViewAndModel<GridPane, ClosedTradesViewModel> {
|
||||||
|
|
||||||
@FXML TableColumn<ClosedTradesListItem, ClosedTradesListItem> priceColumn, amountColumn, volumeColumn,
|
@FXML TableColumn<ClosedTradesListItem, ClosedTradesListItem> priceColumn, amountColumn, volumeColumn,
|
||||||
directionColumn, dateColumn, tradeIdColumn;
|
directionColumn, dateColumn, tradeIdColumn;
|
||||||
|
|
|
@ -27,9 +27,10 @@ import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.image.*;
|
import javafx.scene.image.*;
|
||||||
|
import javafx.scene.layout.*;
|
||||||
import javafx.util.Callback;
|
import javafx.util.Callback;
|
||||||
|
|
||||||
public class OffersView extends ActivatableViewAndModel<OffersViewModel> {
|
public class OffersView extends ActivatableViewAndModel<GridPane, OffersViewModel> {
|
||||||
|
|
||||||
@FXML TableColumn<OfferListItem, OfferListItem> priceColumn, amountColumn, volumeColumn,
|
@FXML TableColumn<OfferListItem, OfferListItem> priceColumn, amountColumn, volumeColumn,
|
||||||
directionColumn, dateColumn, offerIdColumn, removeItemColumn;
|
directionColumn, dateColumn, offerIdColumn, removeItemColumn;
|
||||||
|
|
|
@ -52,7 +52,7 @@ import javafx.scene.layout.*;
|
||||||
import javafx.util.Callback;
|
import javafx.util.Callback;
|
||||||
import javafx.util.StringConverter;
|
import javafx.util.StringConverter;
|
||||||
|
|
||||||
public class PendingTradesView extends ActivatableViewAndModel<PendingTradesViewModel> {
|
public class PendingTradesView extends ActivatableViewAndModel<AnchorPane, PendingTradesViewModel> {
|
||||||
|
|
||||||
private ChangeListener<PendingTradesListItem> selectedItemChangeListener;
|
private ChangeListener<PendingTradesListItem> selectedItemChangeListener;
|
||||||
private ListChangeListener<PendingTradesListItem> listChangeListener;
|
private ListChangeListener<PendingTradesListItem> listChangeListener;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.gui.main.settings;
|
package io.bitsquare.gui.main.settings;
|
||||||
|
|
||||||
|
import io.bitsquare.gui.Activatable;
|
||||||
import io.bitsquare.gui.ActivatableViewAndModel;
|
import io.bitsquare.gui.ActivatableViewAndModel;
|
||||||
import io.bitsquare.gui.Navigation;
|
import io.bitsquare.gui.Navigation;
|
||||||
import io.bitsquare.gui.View;
|
import io.bitsquare.gui.View;
|
||||||
|
@ -29,7 +30,7 @@ import javafx.beans.value.ChangeListener;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
|
||||||
public class SettingsView extends ActivatableViewAndModel {
|
public class SettingsView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||||
|
|
||||||
private final ViewLoader viewLoader;
|
private final ViewLoader viewLoader;
|
||||||
private final Navigation navigation;
|
private final Navigation navigation;
|
||||||
|
@ -71,10 +72,10 @@ public class SettingsView extends ActivatableViewAndModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doActivate() {
|
public void doActivate() {
|
||||||
((TabPane) root).getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
||||||
navigation.addListener(navigationListener);
|
navigation.addListener(navigationListener);
|
||||||
|
|
||||||
if (((TabPane) root).getSelectionModel().getSelectedItem() == preferencesTab)
|
if (root.getSelectionModel().getSelectedItem() == preferencesTab)
|
||||||
navigation.navigationTo(Navigation.Item.MAIN,
|
navigation.navigationTo(Navigation.Item.MAIN,
|
||||||
Navigation.Item.SETTINGS,
|
Navigation.Item.SETTINGS,
|
||||||
Navigation.Item.PREFERENCES);
|
Navigation.Item.PREFERENCES);
|
||||||
|
@ -86,7 +87,7 @@ public class SettingsView extends ActivatableViewAndModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doDeactivate() {
|
public void doDeactivate() {
|
||||||
((TabPane) root).getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
|
root.getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
|
||||||
navigation.removeListener(navigationListener);
|
navigation.removeListener(navigationListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ public class SettingsView extends ActivatableViewAndModel {
|
||||||
throw new IllegalArgumentException("navigation item of type " + navigationItem + " is not allowed");
|
throw new IllegalArgumentException("navigation item of type " + navigationItem + " is not allowed");
|
||||||
}
|
}
|
||||||
tab.setContent(loaded.view);
|
tab.setContent(loaded.view);
|
||||||
((TabPane) root).getSelectionModel().select(tab);
|
root.getSelectionModel().select(tab);
|
||||||
return (View) loaded.controller;
|
return (View) loaded.controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,12 @@ import javax.inject.Inject;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
import javafx.scene.layout.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This UI is not cached as it is normally only needed once.
|
* This UI is not cached as it is normally only needed once.
|
||||||
*/
|
*/
|
||||||
public class PreferencesView extends ActivatableViewAndModel<PreferencesViewModel> {
|
public class PreferencesView extends ActivatableViewAndModel<GridPane, PreferencesViewModel> {
|
||||||
|
|
||||||
@FXML ComboBox<String> btcDenominationComboBox;
|
@FXML ComboBox<String> btcDenominationComboBox;
|
||||||
@FXML CheckBox useAnimationsCheckBox, useEffectsCheckBox;
|
@FXML CheckBox useAnimationsCheckBox, useEffectsCheckBox;
|
||||||
|
|
|
@ -38,7 +38,7 @@ import javafx.collections.ListChangeListener;
|
||||||
import javafx.scene.*;
|
import javafx.scene.*;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
|
||||||
public class TradeView extends ActivatableView {
|
public class TradeView extends ActivatableView<TabPane, Void> {
|
||||||
|
|
||||||
private OfferBookView offerBookView;
|
private OfferBookView offerBookView;
|
||||||
private CreateOfferView createOfferView;
|
private CreateOfferView createOfferView;
|
||||||
|
@ -81,7 +81,7 @@ public class TradeView extends ActivatableView {
|
||||||
// We need to remove open validation error popups
|
// We need to remove open validation error popups
|
||||||
// Platform.runLater needed as focus-out event is called after selectedIndexProperty changed
|
// Platform.runLater needed as focus-out event is called after selectedIndexProperty changed
|
||||||
// TODO Find a way to do that in the InputTextField directly, but a tab change does not trigger any event...
|
// TODO Find a way to do that in the InputTextField directly, but a tab change does not trigger any event...
|
||||||
TabPane tabPane = (TabPane) root;
|
TabPane tabPane = root;
|
||||||
tabPane.getSelectionModel().selectedIndexProperty()
|
tabPane.getSelectionModel().selectedIndexProperty()
|
||||||
.addListener((observableValue, oldValue, newValue) ->
|
.addListener((observableValue, oldValue, newValue) ->
|
||||||
Platform.runLater(InputTextField::hideErrorMessageDisplay));
|
Platform.runLater(InputTextField::hideErrorMessageDisplay));
|
||||||
|
@ -125,7 +125,7 @@ public class TradeView extends ActivatableView {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected View loadView(Navigation.Item navigationItem) {
|
protected View loadView(Navigation.Item navigationItem) {
|
||||||
TabPane tabPane = (TabPane) root;
|
TabPane tabPane = root;
|
||||||
if (navigationItem == Navigation.Item.OFFER_BOOK && offerBookView == null) {
|
if (navigationItem == Navigation.Item.OFFER_BOOK && offerBookView == null) {
|
||||||
// Offerbook must not be cached by ViewLoader as we use 2 instances for sell and buy screens.
|
// Offerbook must not be cached by ViewLoader as we use 2 instances for sell and buy screens.
|
||||||
ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl(), false);
|
ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl(), false);
|
||||||
|
|
|
@ -65,7 +65,7 @@ import static javafx.beans.binding.Bindings.createStringBinding;
|
||||||
|
|
||||||
// TODO Implement other positioning method in InoutTextField to display it over the field instead of right side
|
// TODO Implement other positioning method in InoutTextField to display it over the field instead of right side
|
||||||
// priceAmountHBox is too large after redesign as to be used as layoutReference.
|
// priceAmountHBox is too large after redesign as to be used as layoutReference.
|
||||||
public class CreateOfferView extends ActivatableViewAndModel<CreateOfferViewModel> {
|
public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateOfferViewModel> {
|
||||||
|
|
||||||
private final Navigation navigation;
|
private final Navigation navigation;
|
||||||
private final OverlayManager overlayManager;
|
private final OverlayManager overlayManager;
|
||||||
|
|
|
@ -57,7 +57,8 @@ import static javafx.beans.binding.Bindings.createStringBinding;
|
||||||
* TODO: The advanced filters are not impl. yet
|
* TODO: The advanced filters are not impl. yet
|
||||||
* The restrictions handling is open from the concept and is only implemented for countries yet.
|
* The restrictions handling is open from the concept and is only implemented for countries yet.
|
||||||
*/
|
*/
|
||||||
public class OfferBookView extends ActivatableViewAndModel<OfferBookViewModel> implements ChildView<TradeView> {
|
public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookViewModel> implements
|
||||||
|
ChildView<TradeView> {
|
||||||
|
|
||||||
private final Navigation navigation;
|
private final Navigation navigation;
|
||||||
private final OverlayManager overlayManager;
|
private final OverlayManager overlayManager;
|
||||||
|
@ -287,7 +288,7 @@ public class OfferBookView extends ActivatableViewAndModel<OfferBookViewModel> i
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toggleDetailsScreen(boolean visible) {
|
private void toggleDetailsScreen(boolean visible) {
|
||||||
((GridPane) root).setVgap(visible ? 5 : 0);
|
root.setVgap(visible ? 5 : 0);
|
||||||
|
|
||||||
extendedButton1Label.setVisible(visible);
|
extendedButton1Label.setVisible(visible);
|
||||||
extendedButton1Label.setManaged(visible);
|
extendedButton1Label.setManaged(visible);
|
||||||
|
|
|
@ -62,7 +62,7 @@ import org.controlsfx.control.action.AbstractAction;
|
||||||
import org.controlsfx.control.action.Action;
|
import org.controlsfx.control.action.Action;
|
||||||
import org.controlsfx.dialog.Dialog;
|
import org.controlsfx.dialog.Dialog;
|
||||||
|
|
||||||
public class TakeOfferView extends ActivatableViewAndModel<TakeOfferViewModel> {
|
public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOfferViewModel> {
|
||||||
|
|
||||||
private final Navigation navigation;
|
private final Navigation navigation;
|
||||||
private final OverlayManager overlayManager;
|
private final OverlayManager overlayManager;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue