Search in sources :

Example 6 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 VotingDashboardView)
        dashboard.setSelected(true);
    else if (view instanceof VoteView)
        vote.setSelected(true);
    else if (view instanceof VotingHistoryView)
        history.setSelected(true);
}
Also used : VotingDashboardView(bisq.desktop.main.dao.voting.dashboard.VotingDashboardView) VotingDashboardView(bisq.desktop.main.dao.voting.dashboard.VotingDashboardView) VotingHistoryView(bisq.desktop.main.dao.voting.history.VotingHistoryView) FxmlView(bisq.desktop.common.view.FxmlView) VoteView(bisq.desktop.main.dao.voting.vote.VoteView) DaoView(bisq.desktop.main.dao.DaoView) View(bisq.desktop.common.view.View) MainView(bisq.desktop.main.MainView) VoteView(bisq.desktop.main.dao.voting.vote.VoteView) VotingHistoryView(bisq.desktop.main.dao.voting.history.VotingHistoryView)

Example 7 with View

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

the class MarketView method loadView.

private void loadView(Class<? extends View> viewClass) {
    final Tab tab;
    View view = viewLoader.load(viewClass);
    if (view instanceof OfferBookChartView)
        tab = offerBookTab;
    else if (view instanceof TradesChartsView)
        tab = tradesTab;
    else if (view instanceof SpreadView)
        tab = spreadTab;
    else
        throw new IllegalArgumentException("Navigation to " + viewClass + " is not supported");
    if (tab.getContent() != null && tab.getContent() instanceof ScrollPane) {
        ((ScrollPane) tab.getContent()).setContent(view.getRoot());
    } else {
        tab.setContent(view.getRoot());
    }
    root.getSelectionModel().select(tab);
}
Also used : TradesChartsView(bisq.desktop.main.market.trades.TradesChartsView) SpreadView(bisq.desktop.main.market.spread.SpreadView) Tab(javafx.scene.control.Tab) ScrollPane(javafx.scene.control.ScrollPane) OfferBookChartView(bisq.desktop.main.market.offerbook.OfferBookChartView) SpreadView(bisq.desktop.main.market.spread.SpreadView) TradesChartsView(bisq.desktop.main.market.trades.TradesChartsView) FxmlView(bisq.desktop.common.view.FxmlView) View(bisq.desktop.common.view.View) MainView(bisq.desktop.main.MainView) OfferBookChartView(bisq.desktop.main.market.offerbook.OfferBookChartView)

Example 8 with View

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

the class OfferView method loadView.

private void loadView(Class<? extends View> viewClass) {
    TabPane tabPane = root;
    View view;
    boolean isBuy = direction == OfferPayload.Direction.BUY;
    if (viewClass == OfferBookView.class && offerBookView == null) {
        view = viewLoader.load(viewClass);
        // Offerbook must not be cached by ViewLoader as we use 2 instances for sell and buy screens.
        offerBookTab = new Tab(isBuy ? Res.get("shared.buyBitcoin") : Res.get("shared.sellBitcoin"));
        offerBookTab.setClosable(false);
        offerBookTab.setContent(view.getRoot());
        tabPane.getTabs().add(offerBookTab);
        offerBookView = (OfferBookView) view;
        offerBookView.onTabSelected(true);
        OfferActionHandler offerActionHandler = new OfferActionHandler() {

            @Override
            public void onCreateOffer(TradeCurrency tradeCurrency) {
                if (!createOfferViewOpen) {
                    OfferView.this.createOfferViewOpen = true;
                    OfferView.this.tradeCurrency = tradeCurrency;
                    // noinspection unchecked
                    OfferView.this.navigation.navigateTo(MainView.class, OfferView.this.getClass(), CreateOfferView.class);
                } else {
                    log.error("You have already a \"Create offer\" tab open.");
                }
            }

            @Override
            public void onTakeOffer(Offer offer) {
                if (!takeOfferViewOpen) {
                    OfferView.this.takeOfferViewOpen = true;
                    OfferView.this.offer = offer;
                    // noinspection unchecked
                    OfferView.this.navigation.navigateTo(MainView.class, OfferView.this.getClass(), TakeOfferView.class);
                } else {
                    log.error("You have already a \"Take offer\" tab open.");
                }
            }
        };
        offerBookView.setOfferActionHandler(offerActionHandler);
        offerBookView.setDirection(direction);
    } else if (viewClass == CreateOfferView.class && createOfferView == null) {
        view = viewLoader.load(viewClass);
        // CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times
        // in different graphs
        createOfferView = (CreateOfferView) view;
        createOfferView.initWithData(direction, tradeCurrency);
        createOfferPane = createOfferView.getRoot();
        createOfferTab = new Tab(getCreateOfferTabName());
        // close handler from close on create offer action
        createOfferView.setCloseHandler(() -> tabPane.getTabs().remove(createOfferTab));
        createOfferTab.setContent(createOfferPane);
        tabPane.getTabs().add(createOfferTab);
        tabPane.getSelectionModel().select(createOfferTab);
    } else if (viewClass == TakeOfferView.class && takeOfferView == null && offer != null) {
        view = viewLoader.load(viewClass);
        // CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times
        // in different graphs
        takeOfferView = (TakeOfferView) view;
        takeOfferView.initWithData(offer);
        takeOfferPane = ((TakeOfferView) view).getRoot();
        takeOfferTab = new Tab(getTakeOfferTabName());
        // close handler from close on take offer action
        takeOfferView.setCloseHandler(() -> tabPane.getTabs().remove(takeOfferTab));
        takeOfferTab.setContent(takeOfferPane);
        tabPane.getTabs().add(takeOfferTab);
        tabPane.getSelectionModel().select(takeOfferTab);
    }
}
Also used : TabPane(javafx.scene.control.TabPane) TradeCurrency(bisq.core.locale.TradeCurrency) CreateOfferView(bisq.desktop.main.offer.createoffer.CreateOfferView) Tab(javafx.scene.control.Tab) Offer(bisq.core.offer.Offer) OfferBookView(bisq.desktop.main.offer.offerbook.OfferBookView) ActivatableView(bisq.desktop.common.view.ActivatableView) TakeOfferView(bisq.desktop.main.offer.takeoffer.TakeOfferView) OfferBookView(bisq.desktop.main.offer.offerbook.OfferBookView) View(bisq.desktop.common.view.View) MainView(bisq.desktop.main.MainView) CreateOfferView(bisq.desktop.main.offer.createoffer.CreateOfferView)

Example 9 with View

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

the class PortfolioView 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 OpenOffersView)
        currentTab = openOffersTab;
    else if (view instanceof PendingTradesView)
        currentTab = pendingTradesTab;
    else if (view instanceof ClosedTradesView)
        currentTab = closedTradesTab;
    else if (view instanceof FailedTradesView)
        currentTab = failedTradesTab;
    currentTab.setContent(view.getRoot());
    root.getSelectionModel().select(currentTab);
}
Also used : OpenOffersView(bisq.desktop.main.portfolio.openoffer.OpenOffersView) PendingTradesView(bisq.desktop.main.portfolio.pendingtrades.PendingTradesView) ClosedTradesView(bisq.desktop.main.portfolio.closedtrades.ClosedTradesView) FailedTradesView(bisq.desktop.main.portfolio.failedtrades.FailedTradesView) OpenOffersView(bisq.desktop.main.portfolio.openoffer.OpenOffersView) PendingTradesView(bisq.desktop.main.portfolio.pendingtrades.PendingTradesView) ClosedTradesView(bisq.desktop.main.portfolio.closedtrades.ClosedTradesView) FxmlView(bisq.desktop.common.view.FxmlView) FailedTradesView(bisq.desktop.main.portfolio.failedtrades.FailedTradesView) View(bisq.desktop.common.view.View) MainView(bisq.desktop.main.MainView)

Example 10 with View

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

the class SettingsView method loadView.

private void loadView(Class<? extends View> viewClass) {
    final Tab tab;
    View view = viewLoader.load(viewClass);
    if (view instanceof PreferencesView)
        tab = preferencesTab;
    else if (view instanceof NetworkSettingsView)
        tab = networkTab;
    else if (view instanceof AboutView)
        tab = aboutTab;
    else
        throw new IllegalArgumentException("Navigation to " + viewClass + " is not supported");
    if (tab.getContent() != null && tab.getContent() instanceof ScrollPane) {
        ((ScrollPane) tab.getContent()).setContent(view.getRoot());
    } else {
        tab.setContent(view.getRoot());
    }
    root.getSelectionModel().select(tab);
}
Also used : PreferencesView(bisq.desktop.main.settings.preferences.PreferencesView) Tab(javafx.scene.control.Tab) ScrollPane(javafx.scene.control.ScrollPane) NetworkSettingsView(bisq.desktop.main.settings.network.NetworkSettingsView) AboutView(bisq.desktop.main.settings.about.AboutView) FxmlView(bisq.desktop.common.view.FxmlView) AboutView(bisq.desktop.main.settings.about.AboutView) View(bisq.desktop.common.view.View) MainView(bisq.desktop.main.MainView) NetworkSettingsView(bisq.desktop.main.settings.network.NetworkSettingsView) PreferencesView(bisq.desktop.main.settings.preferences.PreferencesView)

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