Use tabs instead of toggle group in account section

This commit is contained in:
Christoph Atteneder 2018-10-23 15:59:50 +02:00
parent 3dad02e485
commit 4974cefb38
No known key found for this signature in database
GPG Key ID: CD5DC1C529CDFD3B
16 changed files with 115 additions and 311 deletions

View File

@ -18,6 +18,7 @@
-->
<?import com.jfoenix.controls.JFXTabPane?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.layout.AnchorPane?>
<JFXTabPane fx:id="root" fx:controller="bisq.desktop.main.account.AccountView"
@ -25,6 +26,15 @@
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
xmlns:fx="http://javafx.com/fxml">
<Tab fx:id="accountSettingsTab" closable="false"/>
<Tab fx:id="fiatAccountsTab" closable="false"/>
<Tab fx:id="altcoinAccountsTab" closable="false"/>
<Tab fx:id="notificationTab" closable="false">
<ScrollPane fitToWidth="true" hbarPolicy="NEVER"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"/>
</Tab>
<Tab fx:id="passwordTab" closable="false"/>
<Tab fx:id="seedwordsTab" closable="false"/>
<Tab fx:id="backupTab" closable="false"/>
</JFXTabPane>

View File

@ -25,8 +25,12 @@ import bisq.desktop.common.view.View;
import bisq.desktop.common.view.ViewLoader;
import bisq.desktop.main.MainView;
import bisq.desktop.main.account.arbitratorregistration.ArbitratorRegistrationView;
import bisq.desktop.main.account.content.altcoinaccounts.AltCoinAccountsView;
import bisq.desktop.main.account.content.backup.BackupView;
import bisq.desktop.main.account.content.fiataccounts.FiatAccountsView;
import bisq.desktop.main.account.settings.AccountSettingsView;
import bisq.desktop.main.account.content.notifications.MobileNotificationsView;
import bisq.desktop.main.account.content.password.PasswordView;
import bisq.desktop.main.account.content.seedwords.SeedWordsView;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.core.locale.Res;
@ -39,6 +43,7 @@ import javax.inject.Inject;
import javafx.fxml.FXML;
import javafx.scene.Scene;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.input.KeyCode;
@ -52,7 +57,8 @@ import javafx.event.EventHandler;
public class AccountView extends ActivatableView<TabPane, Void> {
@FXML
Tab accountSettingsTab;
Tab fiatAccountsTab, altcoinAccountsTab, notificationTab,
passwordTab, seedwordsTab, backupTab;
private Navigation.Listener navigationListener;
private ChangeListener<Tab> tabChangeListener;
@ -62,7 +68,6 @@ public class AccountView extends ActivatableView<TabPane, Void> {
private Tab selectedTab;
private Tab arbitratorRegistrationTab;
private ArbitratorRegistrationView arbitratorRegistrationView;
private AccountSettingsView accountSettingsView;
private Scene scene;
private EventHandler<KeyEvent> keyEventEventHandler;
@ -74,10 +79,18 @@ public class AccountView extends ActivatableView<TabPane, Void> {
@Override
public void initialize() {
fiatAccountsTab.setText(Res.get("account.menu.paymentAccount").toUpperCase());
altcoinAccountsTab.setText(Res.get("account.menu.altCoinsAccountView").toUpperCase());
notificationTab.setText(Res.get("account.menu.notifications").toUpperCase());
passwordTab.setText(Res.get("account.menu.password").toUpperCase());
seedwordsTab.setText(Res.get("account.menu.seedWords").toUpperCase());
backupTab.setText(Res.get("account.menu.backup").toUpperCase());
navigationListener = viewPath -> {
if (viewPath.size() == 3 && viewPath.indexOf(AccountView.class) == 1) {
if (arbitratorRegistrationTab == null && viewPath.get(2).equals(ArbitratorRegistrationView.class))
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
else
loadView(viewPath.tip());
}
@ -93,16 +106,22 @@ public class AccountView extends ActivatableView<TabPane, Void> {
};
tabChangeListener = (ov, oldValue, newValue) -> {
if (newValue == accountSettingsTab) {
Class<? extends View> selectedViewClass = accountSettingsView.getSelectedViewClass();
if (selectedViewClass == null)
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, FiatAccountsView.class);
else
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, selectedViewClass);
} else if (arbitratorRegistrationTab != null) {
if (arbitratorRegistrationTab != null) {
navigation.navigateTo(MainView.class, AccountView.class, ArbitratorRegistrationView.class);
} else if (newValue == fiatAccountsTab) {
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
} else if (newValue == altcoinAccountsTab) {
navigation.navigateTo(MainView.class, AccountView.class, AltCoinAccountsView.class);
} else if (newValue == notificationTab) {
navigation.navigateTo(MainView.class, AccountView.class, MobileNotificationsView.class);
} else if (newValue == passwordTab) {
navigation.navigateTo(MainView.class, AccountView.class, PasswordView.class);
} else if (newValue == seedwordsTab) {
navigation.navigateTo(MainView.class, AccountView.class, SeedWordsView.class);
} else if (newValue == backupTab) {
navigation.navigateTo(MainView.class, AccountView.class, BackupView.class);
} else {
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class);
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
}
};
}
@ -117,12 +136,22 @@ public class AccountView extends ActivatableView<TabPane, Void> {
scene.addEventHandler(KeyEvent.KEY_RELEASED, keyEventEventHandler);
if (navigation.getCurrentPath().size() == 2 && navigation.getCurrentPath().get(1) == AccountView.class) {
if (root.getSelectionModel().getSelectedItem() == accountSettingsTab)
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class);
else if (arbitratorRegistrationTab != null)
if (arbitratorRegistrationTab != null)
navigation.navigateTo(MainView.class, AccountView.class, ArbitratorRegistrationView.class);
else if (root.getSelectionModel().getSelectedItem() == fiatAccountsTab)
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
else if (root.getSelectionModel().getSelectedItem() == altcoinAccountsTab)
navigation.navigateTo(MainView.class, AccountView.class, AltCoinAccountsView.class);
else if (root.getSelectionModel().getSelectedItem() == notificationTab)
navigation.navigateTo(MainView.class, AccountView.class, MobileNotificationsView.class);
else if (root.getSelectionModel().getSelectedItem() == passwordTab)
navigation.navigateTo(MainView.class, AccountView.class, PasswordView.class);
else if (root.getSelectionModel().getSelectedItem() == seedwordsTab)
navigation.navigateTo(MainView.class, AccountView.class, SeedWordsView.class);
else if (root.getSelectionModel().getSelectedItem() == backupTab)
navigation.navigateTo(MainView.class, AccountView.class, BackupView.class);
else
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class);
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
}
//noinspection UnusedAssignment
@ -147,26 +176,33 @@ public class AccountView extends ActivatableView<TabPane, Void> {
private void loadView(Class<? extends View> viewClass) {
View view = viewLoader.load(viewClass);
if (view instanceof AccountSettingsView) {
selectedTab = accountSettingsTab;
accountSettingsView = (AccountSettingsView) view;
selectedTab.setText(Res.get("account.tab.account").toUpperCase());
if (arbitratorRegistrationTab != null) {
arbitratorRegistrationTab.setDisable(false);
if (arbitratorRegistrationView != null)
arbitratorRegistrationView.onTabSelection(false);
}
} else if (view instanceof ArbitratorRegistrationView) {
if (view instanceof ArbitratorRegistrationView) {
if (arbitratorRegistrationTab != null) {
selectedTab = arbitratorRegistrationTab;
arbitratorRegistrationView = (ArbitratorRegistrationView) view;
arbitratorRegistrationView.onTabSelection(true);
}
} else if (view instanceof FiatAccountsView) {
selectedTab = fiatAccountsTab;
} else if (view instanceof AltCoinAccountsView) {
selectedTab = altcoinAccountsTab;
} else if (view instanceof MobileNotificationsView) {
selectedTab = notificationTab;
} else if (view instanceof PasswordView) {
selectedTab = passwordTab;
} else if (view instanceof SeedWordsView) {
selectedTab = seedwordsTab;
} else if (view instanceof BackupView) {
selectedTab = backupTab;
} else {
throw new IllegalArgumentException("View not supported: " + view);
}
selectedTab.setContent(view.getRoot());
if (selectedTab.getContent() != null && selectedTab.getContent() instanceof ScrollPane) {
((ScrollPane) selectedTab.getContent()).setContent(view.getRoot());
} else {
selectedTab.setContent(view.getRoot());
}
root.getSelectionModel().select(selectedTab);
}
}

View File

@ -21,11 +21,15 @@
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.geometry.Insets?>
<GridPane fx:id="root" fx:controller="bisq.desktop.main.account.content.altcoinaccounts.AltCoinAccountsView"
hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="20.0"
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml">
<padding>
<Insets bottom="10.0" left="25.0" top="30.0" right="25"/>
</padding>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>

View File

@ -20,12 +20,15 @@
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.geometry.Insets?>
<GridPane fx:id="root" fx:controller="bisq.desktop.main.account.content.backup.BackupView"
hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="20.0"
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml">
<padding>
<Insets bottom="10.0" left="25.0" top="30.0" right="25"/>
</padding>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="140.0"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>

View File

@ -21,11 +21,15 @@
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.geometry.Insets?>
<GridPane fx:id="root" fx:controller="bisq.desktop.main.account.content.fiataccounts.FiatAccountsView"
hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="20.0"
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml">
<padding>
<Insets bottom="10.0" left="25.0" top="30.0" right="25"/>
</padding>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>

View File

@ -109,8 +109,6 @@ import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextAlignment;
import javafx.geometry.VPos;
import javafx.beans.value.ChangeListener;
import javafx.collections.FXCollections;
@ -341,7 +339,6 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
addTitledGroupBg(root, gridRow, 1, Res.get("shared.manageAccounts"));
Tuple3<Label, ListView<PaymentAccount>, VBox> tuple = FormBuilder.addTopLabelListView(root, gridRow, Res.get("account.fiat.yourFiatAccounts"), Layout.FIRST_ROW_DISTANCE);
GridPane.setValignment(tuple.first, VPos.TOP);
tuple.first.setTextAlignment(TextAlignment.RIGHT);
paymentAccountsListView = tuple.second;
paymentAccountsListView.setPrefHeight(2 * Layout.LIST_ROW_HEIGHT + 14);

View File

@ -20,15 +20,17 @@
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.geometry.Insets?>
<GridPane fx:id="root" fx:controller="bisq.desktop.main.account.content.notifications.MobileNotificationsView"
hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="20.0"
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml">
<padding>
<Insets bottom="10.0" left="25.0" top="30.0" right="25"/>
</padding>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="140.0"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints>
</GridPane>

View File

@ -133,6 +133,7 @@ public class MobileNotificationsView extends ActivatableView<GridPane, Void> {
@Override
public void initialize() {
root.setGridLinesVisible(true);
createSetupFields();
createSettingsFields();
createMarketAlertFields();

View File

@ -20,12 +20,15 @@
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.geometry.Insets?>
<GridPane fx:id="root" fx:controller="bisq.desktop.main.account.content.password.PasswordView"
hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="20.0"
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml">
<padding>
<Insets bottom="10.0" left="25.0" top="30.0" right="25"/>
</padding>
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints>

View File

@ -27,7 +27,6 @@ import bisq.desktop.components.TitledGroupBg;
import bisq.desktop.main.MainView;
import bisq.desktop.main.account.AccountView;
import bisq.desktop.main.account.content.seedwords.SeedWordsView;
import bisq.desktop.main.account.settings.AccountSettingsView;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.util.FormBuilder;
import bisq.desktop.util.Layout;
@ -113,7 +112,7 @@ public class PasswordView extends ActivatableView<GridPane, Void> {
.actionButtonTextWithGoTo("navigation.account.walletSeed")
.onAction(() -> {
navigation.setReturnPath(navigation.getCurrentPath());
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, SeedWordsView.class);
navigation.navigateTo(MainView.class, AccountView.class, SeedWordsView.class);
})
.show();
} else {

View File

@ -20,12 +20,15 @@
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.geometry.Insets?>
<GridPane fx:id="root" fx:controller="bisq.desktop.main.account.content.seedwords.SeedWordsView"
hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="20.0"
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml">
<padding>
<Insets bottom="10.0" left="25.0" top="30.0" right="25"/>
</padding>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="140.0"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ This file is part of Bisq.
~
~ Bisq is free software: you can redistribute it and/or modify it
~ under the terms of the GNU Affero General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or (at
~ your option) any later version.
~
~ Bisq is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
~ License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with Bisq. If not, see <http://www.gnu.org/licenses/>.
-->
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.VBox?>
<AnchorPane fx:id="root" prefHeight="660.0" prefWidth="1000.0" xmlns="http://javafx.com/javafx/8"
xmlns:fx="http://javafx.com/fxml"
fx:controller="bisq.desktop.main.account.settings.AccountSettingsView">
<VBox fx:id="leftVBox" prefWidth="240" spacing="5" AnchorPane.bottomAnchor="20" AnchorPane.leftAnchor="15"
AnchorPane.topAnchor="20"/>
<ScrollPane fx:id="scrollPane"
fitToWidth="true" hbarPolicy="NEVER"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="270.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<AnchorPane fx:id="content" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"/>
</ScrollPane>
</AnchorPane>

View File

@ -1,218 +0,0 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.desktop.main.account.settings;
import bisq.desktop.Navigation;
import bisq.desktop.common.view.ActivatableViewAndModel;
import bisq.desktop.common.view.CachingViewLoader;
import bisq.desktop.common.view.FxmlView;
import bisq.desktop.common.view.View;
import bisq.desktop.common.view.ViewLoader;
import bisq.desktop.common.view.ViewPath;
import bisq.desktop.components.AutoTooltipToggleButton;
import bisq.desktop.main.MainView;
import bisq.desktop.main.account.AccountView;
import bisq.desktop.main.account.content.altcoinaccounts.AltCoinAccountsView;
import bisq.desktop.main.account.content.backup.BackupView;
import bisq.desktop.main.account.content.fiataccounts.FiatAccountsView;
import bisq.desktop.main.account.content.notifications.MobileNotificationsView;
import bisq.desktop.main.account.content.password.PasswordView;
import bisq.desktop.main.account.content.seedwords.SeedWordsView;
import bisq.desktop.util.Colors;
import bisq.core.locale.Res;
import javax.inject.Inject;
import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Paint;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.beans.value.ChangeListener;
@FxmlView
public class AccountSettingsView extends ActivatableViewAndModel {
private final ViewLoader viewLoader;
private final Navigation navigation;
private MenuItem paymentAccount, altCoinsAccountView, notifications, password, seedWords, backup;
private Navigation.Listener listener;
@FXML
private ScrollPane scrollPane;
@FXML
private VBox leftVBox;
@FXML
private AnchorPane content;
private Class<? extends View> selectedViewClass;
@Inject
private AccountSettingsView(CachingViewLoader viewLoader, Navigation navigation) {
this.viewLoader = viewLoader;
this.navigation = navigation;
}
@Override
public void initialize() {
listener = viewPath -> {
if (viewPath.size() != 4 || viewPath.indexOf(AccountSettingsView.class) != 2)
return;
selectedViewClass = viewPath.tip();
loadView(selectedViewClass);
};
ToggleGroup toggleGroup = new ToggleGroup();
paymentAccount = new MenuItem(navigation, toggleGroup, Res.get("account.menu.paymentAccount"), FiatAccountsView.class, AwesomeIcon.MONEY);
altCoinsAccountView = new MenuItem(navigation, toggleGroup, Res.get("account.menu.altCoinsAccountView"), AltCoinAccountsView.class, AwesomeIcon.LINK);
notifications = new MenuItem(navigation, toggleGroup, Res.get("account.menu.notifications"), MobileNotificationsView.class, AwesomeIcon.BELL);
password = new MenuItem(navigation, toggleGroup, Res.get("account.menu.password"), PasswordView.class, AwesomeIcon.UNLOCK_ALT);
seedWords = new MenuItem(navigation, toggleGroup, Res.get("account.menu.seedWords"), SeedWordsView.class, AwesomeIcon.KEY);
backup = new MenuItem(navigation, toggleGroup, Res.get("account.menu.backup"), BackupView.class, AwesomeIcon.CLOUD_DOWNLOAD);
leftVBox.getChildren().addAll(paymentAccount, altCoinsAccountView, notifications, password, seedWords, backup);
}
@Override
protected void activate() {
paymentAccount.activate();
altCoinsAccountView.activate();
notifications.activate();
password.activate();
seedWords.activate();
backup.activate();
navigation.addListener(listener);
ViewPath viewPath = navigation.getCurrentPath();
if (viewPath.size() == 3 && viewPath.indexOf(AccountSettingsView.class) == 2 ||
viewPath.size() == 2 && viewPath.indexOf(AccountView.class) == 1) {
if (selectedViewClass == null)
selectedViewClass = FiatAccountsView.class;
loadView(selectedViewClass);
} else if (viewPath.size() == 4 && viewPath.indexOf(AccountSettingsView.class) == 2) {
selectedViewClass = viewPath.get(3);
loadView(selectedViewClass);
}
}
@Override
protected void deactivate() {
navigation.removeListener(listener);
paymentAccount.deactivate();
altCoinsAccountView.deactivate();
notifications.deactivate();
password.deactivate();
seedWords.deactivate();
backup.deactivate();
}
private void loadView(Class<? extends View> viewClass) {
View view = viewLoader.load(viewClass);
content.getChildren().setAll(view.getRoot());
if (view instanceof FiatAccountsView) paymentAccount.setSelected(true);
else if (view instanceof AltCoinAccountsView) altCoinsAccountView.setSelected(true);
else if (view instanceof MobileNotificationsView) notifications.setSelected(true);
else if (view instanceof PasswordView) password.setSelected(true);
else if (view instanceof SeedWordsView) seedWords.setSelected(true);
else if (view instanceof BackupView) backup.setSelected(true);
}
public Class<? extends View> getSelectedViewClass() {
return selectedViewClass;
}
}
class MenuItem extends AutoTooltipToggleButton {
private final ChangeListener<Boolean> selectedPropertyChangeListener;
private final ChangeListener<Boolean> disablePropertyChangeListener;
private final Navigation navigation;
private final Class<? extends View> viewClass;
MenuItem(Navigation navigation, ToggleGroup toggleGroup, String title, Class<? extends View> viewClass, AwesomeIcon awesomeIcon) {
this.navigation = navigation;
this.viewClass = viewClass;
setToggleGroup(toggleGroup);
setText(title);
setId("account-settings-item-background-active");
setPrefHeight(40);
setPrefWidth(240);
setAlignment(Pos.CENTER_LEFT);
Label icon = new Label();
AwesomeDude.setIcon(icon, awesomeIcon);
icon.setTextFill(Paint.valueOf("#333"));
icon.setPadding(new Insets(0, 5, 0, 0));
icon.setAlignment(Pos.CENTER);
icon.setMinWidth(25);
icon.setMaxWidth(25);
setGraphic(icon);
selectedPropertyChangeListener = (ov, oldValue, newValue) -> {
if (newValue) {
setId("account-settings-item-background-selected");
icon.setTextFill(Colors.BLUE);
} else {
setId("account-settings-item-background-active");
icon.setTextFill(Paint.valueOf("#333"));
}
};
disablePropertyChangeListener = (ov, oldValue, newValue) -> {
if (newValue) {
setId("account-settings-item-background-disabled");
icon.setTextFill(Paint.valueOf("#ccc"));
} else {
setId("account-settings-item-background-active");
icon.setTextFill(Paint.valueOf("#333"));
}
};
}
public void activate() {
setOnAction((event) -> navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, viewClass));
selectedProperty().addListener(selectedPropertyChangeListener);
disableProperty().addListener(disablePropertyChangeListener);
}
public void deactivate() {
setOnAction(null);
selectedProperty().removeListener(selectedPropertyChangeListener);
disableProperty().removeListener(disablePropertyChangeListener);
}
}

View File

@ -30,7 +30,6 @@ import bisq.desktop.components.TitledGroupBg;
import bisq.desktop.main.MainView;
import bisq.desktop.main.account.AccountView;
import bisq.desktop.main.account.content.fiataccounts.FiatAccountsView;
import bisq.desktop.main.account.settings.AccountSettingsView;
import bisq.desktop.main.dao.DaoView;
import bisq.desktop.main.dao.wallet.BsqWalletView;
import bisq.desktop.main.dao.wallet.receive.BsqReceiveView;
@ -292,7 +291,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
.actionButtonTextWithGoTo("navigation.account")
.onAction(() -> {
navigation.setReturnPath(navigation.getCurrentPath());
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
}).show();
}

View File

@ -30,7 +30,6 @@ import bisq.desktop.components.PeerInfoIcon;
import bisq.desktop.main.MainView;
import bisq.desktop.main.account.AccountView;
import bisq.desktop.main.account.content.fiataccounts.FiatAccountsView;
import bisq.desktop.main.account.settings.AccountSettingsView;
import bisq.desktop.main.funds.FundsView;
import bisq.desktop.main.funds.withdrawal.WithdrawalView;
import bisq.desktop.main.offer.OfferView;
@ -403,7 +402,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
.closeButtonText(Res.get("offerbook.setupNewAccount"))
.onClose(() -> {
navigation.setReturnPath(navigation.getCurrentPath());
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
})
.show();
} else if (!model.hasAcceptedArbitrators()) {
@ -513,7 +512,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
.actionButtonTextWithGoTo(targetAsString)
.onAction(() -> {
navigation.setReturnPath(navigation.getCurrentPath());
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, target);
navigation.navigateTo(MainView.class, AccountView.class, target);
}).show();
}