Search in sources :

Example 1 with View

use of bisq.desktop.common.view.View in project bisq-desktop by bisq-network.

the class FxmlViewLoaderTests method fxmlViewAnnotationShouldBeOptional.

@Test
public void fxmlViewAnnotationShouldBeOptional() {
    given(viewFactory.call(MissingFxmlViewAnnotation.class)).willReturn(new MissingFxmlViewAnnotation());
    View view = viewLoader.load(MissingFxmlViewAnnotation.class);
    assertThat(view, instanceOf(MissingFxmlViewAnnotation.class));
}
Also used : FxmlView(bisq.desktop.common.view.FxmlView) AbstractView(bisq.desktop.common.view.AbstractView) View(bisq.desktop.common.view.View) Test(org.junit.Test)

Example 2 with View

use of bisq.desktop.common.view.View in project bisq-desktop by bisq-network.

the class BisqApp method showDebugWindow.

// Used for debugging trade process
private void showDebugWindow() {
    ViewLoader viewLoader = injector.getInstance(ViewLoader.class);
    View debugView = viewLoader.load(DebugView.class);
    Parent parent = (Parent) debugView.getRoot();
    Stage stage = new Stage();
    stage.setScene(new Scene(parent));
    // Don't translate, just for dev
    stage.setTitle("Debug window");
    stage.initModality(Modality.NONE);
    stage.initStyle(StageStyle.UTILITY);
    stage.initOwner(scene.getWindow());
    stage.setX(primaryStage.getX() + primaryStage.getWidth() + 10);
    stage.setY(primaryStage.getY());
    stage.show();
}
Also used : Parent(javafx.scene.Parent) Stage(javafx.stage.Stage) ViewLoader(bisq.desktop.common.view.ViewLoader) CachingViewLoader(bisq.desktop.common.view.CachingViewLoader) Scene(javafx.scene.Scene) DebugView(bisq.desktop.main.debug.DebugView) View(bisq.desktop.common.view.View) MainView(bisq.desktop.main.MainView)

Example 3 with View

use of bisq.desktop.common.view.View in project bisq-desktop by bisq-network.

the class MainView method initialize.

@Override
protected void initialize() {
    MainView.rootContainer = root;
    ToggleButton marketButton = new NavButton(MarketView.class, Res.get("mainView.menu.market"));
    ToggleButton buyButton = new NavButton(BuyOfferView.class, Res.get("mainView.menu.buyBtc"));
    ToggleButton sellButton = new NavButton(SellOfferView.class, Res.get("mainView.menu.sellBtc"));
    ToggleButton portfolioButton = new NavButton(PortfolioView.class, Res.get("mainView.menu.portfolio"));
    ToggleButton fundsButton = new NavButton(FundsView.class, Res.get("mainView.menu.funds"));
    ToggleButton disputesButton = new NavButton(DisputesView.class, Res.get("mainView.menu.support"));
    ToggleButton settingsButton = new NavButton(SettingsView.class, Res.get("mainView.menu.settings"));
    ToggleButton accountButton = new NavButton(AccountView.class, Res.get("mainView.menu.account"));
    ToggleButton daoButton = new NavButton(DaoView.class, Res.get("mainView.menu.dao"));
    Pane portfolioButtonHolder = new Pane(portfolioButton);
    Pane disputesButtonHolder = new Pane(disputesButton);
    if (!BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq()) {
        daoButton.setVisible(false);
        daoButton.setManaged(false);
    }
    root.sceneProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null) {
            newValue.addEventHandler(KeyEvent.KEY_RELEASED, keyEvent -> {
                // TODO can be removed once DAO is released
                if (Utilities.isAltOrCtrlPressed(KeyCode.D, keyEvent)) {
                    if (BisqEnvironment.getBaseCurrencyNetwork().isBitcoin()) {
                        daoButton.setVisible(true);
                        daoButton.setManaged(true);
                    }
                } else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT1, keyEvent)) {
                    marketButton.fire();
                } else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT2, keyEvent)) {
                    buyButton.fire();
                } else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT3, keyEvent)) {
                    sellButton.fire();
                } else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT4, keyEvent)) {
                    portfolioButton.fire();
                } else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT5, keyEvent)) {
                    fundsButton.fire();
                } else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT6, keyEvent)) {
                    disputesButton.fire();
                } else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT7, keyEvent)) {
                    settingsButton.fire();
                } else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT8, keyEvent)) {
                    accountButton.fire();
                } else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT9, keyEvent)) {
                    if (daoButton.isVisible())
                        daoButton.fire();
                }
            });
        }
    });
    HBox leftNavPane = new HBox(marketButton, buyButton, sellButton, portfolioButtonHolder, fundsButton, disputesButtonHolder) {

        {
            setLeftAnchor(this, 10d);
            setTopAnchor(this, 0d);
        }
    };
    Tuple2<ComboBox<PriceFeedComboBoxItem>, VBox> marketPriceBox = getMarketPriceBox();
    ComboBox<PriceFeedComboBoxItem> priceComboBox = marketPriceBox.first;
    priceComboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        model.setPriceFeedComboBoxItem(newValue);
    });
    ChangeListener<PriceFeedComboBoxItem> selectedPriceFeedItemListener = (observable, oldValue, newValue) -> {
        if (newValue != null)
            priceComboBox.getSelectionModel().select(newValue);
    };
    model.selectedPriceFeedComboBoxItemProperty.addListener(selectedPriceFeedItemListener);
    priceComboBox.setItems(model.priceFeedComboBoxItems);
    HBox.setMargin(marketPriceBox.second, new Insets(0, 0, 0, 0));
    Tuple2<TextField, VBox> availableBalanceBox = getBalanceBox(Res.get("mainView.balance.available"));
    availableBalanceBox.first.textProperty().bind(model.availableBalance);
    Tuple2<TextField, VBox> reservedBalanceBox = getBalanceBox(Res.get("mainView.balance.reserved"));
    reservedBalanceBox.first.textProperty().bind(model.reservedBalance);
    Tuple2<TextField, VBox> lockedBalanceBox = getBalanceBox(Res.get("mainView.balance.locked"));
    lockedBalanceBox.first.textProperty().bind(model.lockedBalance);
    HBox rightNavPane = new HBox(marketPriceBox.second, availableBalanceBox.second, reservedBalanceBox.second, lockedBalanceBox.second, settingsButton, accountButton, daoButton) {

        {
            setRightAnchor(this, 10d);
            setTopAnchor(this, 0d);
        }
    };
    root.widthProperty().addListener((observable, oldValue, newValue) -> {
        double w = (double) newValue;
        if (w > 0) {
            leftNavPane.setSpacing(w >= 1080 ? 12 : 6);
            rightNavPane.setSpacing(w >= 1080 ? 12 : 6);
        }
    });
    AnchorPane contentContainer = new AnchorPane() {

        {
            setId("content-pane");
            setLeftAnchor(this, 0d);
            setRightAnchor(this, 0d);
            setTopAnchor(this, 60d);
            setBottomAnchor(this, 10d);
        }
    };
    AnchorPane applicationContainer = new AnchorPane(leftNavPane, rightNavPane, contentContainer) {

        {
            setId("content-pane");
        }
    };
    BorderPane baseApplicationContainer = new BorderPane(applicationContainer) {

        {
            setId("base-content-container");
        }
    };
    baseApplicationContainer.setBottom(createFooter());
    setupNotificationIcon(portfolioButtonHolder);
    setupDisputesIcon(disputesButtonHolder);
    navigation.addListener(viewPath -> {
        if (viewPath.size() != 2 || viewPath.indexOf(MainView.class) != 0)
            return;
        Class<? extends View> viewClass = viewPath.tip();
        View view = viewLoader.load(viewClass);
        contentContainer.getChildren().setAll(view.getRoot());
        navButtons.getToggles().stream().filter(toggle -> toggle instanceof NavButton).filter(button -> viewClass == ((NavButton) button).viewClass).findFirst().orElseThrow(() -> new BisqException("No button matching %s found", viewClass)).setSelected(true);
    });
    VBox splashScreen = createSplashScreen();
    root.getChildren().addAll(baseApplicationContainer, splashScreen);
    model.showAppScreen.addListener((ov, oldValue, newValue) -> {
        if (newValue) {
            navigation.navigateToPreviousVisitedView();
            if (!persistedFilesCorrupted.isEmpty()) {
                if (persistedFilesCorrupted.size() > 1 || !persistedFilesCorrupted.get(0).equals("ViewPathAsString")) {
                    // show warning that some files has been corrupted
                    new Popup<>().warning(Res.get("popup.warning.incompatibleDB", persistedFilesCorrupted.toString(), model.getAppDateDir())).useShutDownButton().show();
                } else {
                    log.debug("We detected incompatible data base file for Navigation. That is a minor issue happening with refactoring of UI classes " + "and we don't display a warning popup to the user.");
                }
            }
            transitions.fadeOutAndRemove(splashScreen, 1500, actionEvent -> disposeSplashScreen());
        }
    });
    // Delay a bit to give time for rendering the splash screen
    UserThread.execute(model::start);
}
Also used : Button(javafx.scene.control.Button) Pos(javafx.geometry.Pos) BusyAnimation(bisq.desktop.components.BusyAnimation) Utilities(bisq.common.util.Utilities) ListCell(javafx.scene.control.ListCell) StackPane(javafx.scene.layout.StackPane) VBox(javafx.scene.layout.VBox) BSFormatter(bisq.desktop.util.BSFormatter) DisputesView(bisq.desktop.main.disputes.DisputesView) ComboBox(javafx.scene.control.ComboBox) ViewLoader(bisq.desktop.common.view.ViewLoader) Res(bisq.core.locale.Res) Pane(javafx.scene.layout.Pane) Navigation(bisq.desktop.Navigation) HBox(javafx.scene.layout.HBox) Popup(bisq.desktop.main.overlays.popups.Popup) TextField(javafx.scene.control.TextField) CachingViewLoader(bisq.desktop.common.view.CachingViewLoader) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) KeyEvent(javafx.scene.input.KeyEvent) Separator(javafx.scene.control.Separator) AnchorPane.setTopAnchor(javafx.scene.layout.AnchorPane.setTopAnchor) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) DevEnv(bisq.common.app.DevEnv) ToggleButton(javafx.scene.control.ToggleButton) AnchorPane(javafx.scene.layout.AnchorPane) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) UserThread(bisq.common.UserThread) BorderPane(javafx.scene.layout.BorderPane) PortfolioView(bisq.desktop.main.portfolio.PortfolioView) BisqException(bisq.core.exceptions.BisqException) SettingsView(bisq.desktop.main.settings.SettingsView) GUIUtil(bisq.desktop.util.GUIUtil) InitializableView(bisq.desktop.common.view.InitializableView) Timer(bisq.common.Timer) AnchorPane.setRightAnchor(javafx.scene.layout.AnchorPane.setRightAnchor) AnchorPane.setLeftAnchor(javafx.scene.layout.AnchorPane.setLeftAnchor) FxmlView(bisq.desktop.common.view.FxmlView) AutoTooltipToggleButton(bisq.desktop.components.AutoTooltipToggleButton) Inject(javax.inject.Inject) Tuple2(bisq.common.util.Tuple2) ProgressBar(javafx.scene.control.ProgressBar) Insets(javafx.geometry.Insets) BuyOfferView(bisq.desktop.main.offer.BuyOfferView) TextAlignment(javafx.scene.text.TextAlignment) AnchorPane.setBottomAnchor(javafx.scene.layout.AnchorPane.setBottomAnchor) Transitions(bisq.desktop.util.Transitions) FundsView(bisq.desktop.main.funds.FundsView) Tooltip(javafx.scene.control.Tooltip) AccountView(bisq.desktop.main.account.AccountView) KeyCode(javafx.scene.input.KeyCode) Color(javafx.scene.paint.Color) Version(bisq.common.app.Version) DaoView(bisq.desktop.main.dao.DaoView) Label(javafx.scene.control.Label) SellOfferView(bisq.desktop.main.offer.SellOfferView) BisqEnvironment(bisq.core.app.BisqEnvironment) MarketView(bisq.desktop.main.market.MarketView) DropShadow(javafx.scene.effect.DropShadow) View(bisq.desktop.common.view.View) ToggleGroup(javafx.scene.control.ToggleGroup) ImageView(javafx.scene.image.ImageView) ChangeListener(javafx.beans.value.ChangeListener) ContentDisplay(javafx.scene.control.ContentDisplay) ToggleButton(javafx.scene.control.ToggleButton) AutoTooltipToggleButton(bisq.desktop.components.AutoTooltipToggleButton) HBox(javafx.scene.layout.HBox) BorderPane(javafx.scene.layout.BorderPane) Insets(javafx.geometry.Insets) ComboBox(javafx.scene.control.ComboBox) BisqException(bisq.core.exceptions.BisqException) StackPane(javafx.scene.layout.StackPane) Pane(javafx.scene.layout.Pane) AnchorPane(javafx.scene.layout.AnchorPane) BorderPane(javafx.scene.layout.BorderPane) DisputesView(bisq.desktop.main.disputes.DisputesView) PortfolioView(bisq.desktop.main.portfolio.PortfolioView) SettingsView(bisq.desktop.main.settings.SettingsView) InitializableView(bisq.desktop.common.view.InitializableView) FxmlView(bisq.desktop.common.view.FxmlView) BuyOfferView(bisq.desktop.main.offer.BuyOfferView) FundsView(bisq.desktop.main.funds.FundsView) AccountView(bisq.desktop.main.account.AccountView) DaoView(bisq.desktop.main.dao.DaoView) SellOfferView(bisq.desktop.main.offer.SellOfferView) MarketView(bisq.desktop.main.market.MarketView) View(bisq.desktop.common.view.View) ImageView(javafx.scene.image.ImageView) TextField(javafx.scene.control.TextField) VBox(javafx.scene.layout.VBox) AnchorPane(javafx.scene.layout.AnchorPane)

Example 4 with View

use of bisq.desktop.common.view.View in project bisq-desktop by bisq-network.

the class MenuItem method loadView.

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 ArbitratorSelectionView)
        arbitratorSelection.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);
}
Also used : BackupView(bisq.desktop.main.account.content.backup.BackupView) AltCoinAccountsView(bisq.desktop.main.account.content.altcoinaccounts.AltCoinAccountsView) ArbitratorSelectionView(bisq.desktop.main.account.content.arbitratorselection.ArbitratorSelectionView) SeedWordsView(bisq.desktop.main.account.content.seedwords.SeedWordsView) PasswordView(bisq.desktop.main.account.content.password.PasswordView) ArbitratorSelectionView(bisq.desktop.main.account.content.arbitratorselection.ArbitratorSelectionView) FiatAccountsView(bisq.desktop.main.account.content.fiataccounts.FiatAccountsView) FxmlView(bisq.desktop.common.view.FxmlView) PasswordView(bisq.desktop.main.account.content.password.PasswordView) AccountView(bisq.desktop.main.account.AccountView) BackupView(bisq.desktop.main.account.content.backup.BackupView) SeedWordsView(bisq.desktop.main.account.content.seedwords.SeedWordsView) View(bisq.desktop.common.view.View) MainView(bisq.desktop.main.MainView) AltCoinAccountsView(bisq.desktop.main.account.content.altcoinaccounts.AltCoinAccountsView) FiatAccountsView(bisq.desktop.main.account.content.fiataccounts.FiatAccountsView)

Example 5 with View

use of bisq.desktop.common.view.View in project bisq-desktop by bisq-network.

the class FundsView method loadView.

private void loadView(Class<? extends View> viewClass) {
    // we want to get activate/deactivate called, so we remove the old view on tab change
    if (currentTab != null)
        currentTab.setContent(null);
    View view = viewLoader.load(viewClass);
    if (view instanceof DepositView)
        currentTab = depositTab;
    else if (view instanceof WithdrawalView)
        currentTab = withdrawalTab;
    else if (view instanceof ReservedView)
        currentTab = reservedTab;
    else if (view instanceof LockedView)
        currentTab = lockedTab;
    else if (view instanceof TransactionsView)
        currentTab = transactionsTab;
    currentTab.setContent(view.getRoot());
    root.getSelectionModel().select(currentTab);
}
Also used : DepositView(bisq.desktop.main.funds.deposit.DepositView) LockedView(bisq.desktop.main.funds.locked.LockedView) ReservedView(bisq.desktop.main.funds.reserved.ReservedView) WithdrawalView(bisq.desktop.main.funds.withdrawal.WithdrawalView) TransactionsView(bisq.desktop.main.funds.transactions.TransactionsView) ReservedView(bisq.desktop.main.funds.reserved.ReservedView) FxmlView(bisq.desktop.common.view.FxmlView) View(bisq.desktop.common.view.View) MainView(bisq.desktop.main.MainView) WithdrawalView(bisq.desktop.main.funds.withdrawal.WithdrawalView) DepositView(bisq.desktop.main.funds.deposit.DepositView) LockedView(bisq.desktop.main.funds.locked.LockedView) TransactionsView(bisq.desktop.main.funds.transactions.TransactionsView)

Aggregations

View (bisq.desktop.common.view.View)17 FxmlView (bisq.desktop.common.view.FxmlView)15 MainView (bisq.desktop.main.MainView)12 DaoView (bisq.desktop.main.dao.DaoView)4 Tab (javafx.scene.control.Tab)3 AbstractView (bisq.desktop.common.view.AbstractView)2 ActivatableView (bisq.desktop.common.view.ActivatableView)2 CachingViewLoader (bisq.desktop.common.view.CachingViewLoader)2 ViewLoader (bisq.desktop.common.view.ViewLoader)2 AccountView (bisq.desktop.main.account.AccountView)2 FiatAccountsView (bisq.desktop.main.account.content.fiataccounts.FiatAccountsView)2 BsqDashboardView (bisq.desktop.main.dao.wallet.dashboard.BsqDashboardView)2 ScrollPane (javafx.scene.control.ScrollPane)2 Timer (bisq.common.Timer)1 UserThread (bisq.common.UserThread)1 DevEnv (bisq.common.app.DevEnv)1 Version (bisq.common.app.Version)1 Tuple2 (bisq.common.util.Tuple2)1 Utilities (bisq.common.util.Utilities)1 BisqEnvironment (bisq.core.app.BisqEnvironment)1