Search in sources :

Example 16 with View

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

the class FxmlViewLoader method loadFromFxml.

private View loadFromFxml(URL fxmlUrl) {
    checkNotNull(fxmlUrl, "FXML URL must not be null");
    try {
        FXMLLoader loader = new FXMLLoader(fxmlUrl, resourceBundle);
        loader.setControllerFactory(viewFactory);
        loader.load();
        Object controller = loader.getController();
        if (controller == null)
            throw new ViewfxException("Failed to load view from FXML file at [%s]. " + "Does it declare an fx:controller attribute?", fxmlUrl);
        if (!(controller instanceof View))
            throw new ViewfxException("Controller of type [%s] loaded from FXML file at [%s] " + "does not implement [%s] as expected.", controller.getClass(), fxmlUrl, View.class);
        return (View) controller;
    } catch (IOException ex) {
        throw new ViewfxException(ex, "Failed to load view from FXML file at [%s]", fxmlUrl);
    }
}
Also used : ViewfxException(bisq.desktop.common.ViewfxException) IOException(java.io.IOException) FXMLLoader(javafx.fxml.FXMLLoader) FxmlView(bisq.desktop.common.view.FxmlView) View(bisq.desktop.common.view.View)

Example 17 with View

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

the class AccountView method loadView.

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"));
        if (arbitratorRegistrationTab != null) {
            arbitratorRegistrationTab.setDisable(false);
            if (arbitratorRegistrationView != null)
                arbitratorRegistrationView.onTabSelection(false);
        }
    } else if (view instanceof ArbitratorRegistrationView) {
        if (arbitratorRegistrationTab != null) {
            selectedTab = arbitratorRegistrationTab;
            arbitratorRegistrationView = (ArbitratorRegistrationView) view;
            arbitratorRegistrationView.onTabSelection(true);
        }
    } else {
        throw new IllegalArgumentException("View not supported: " + view);
    }
    selectedTab.setContent(view.getRoot());
    root.getSelectionModel().select(selectedTab);
}
Also used : AccountSettingsView(bisq.desktop.main.account.settings.AccountSettingsView) ArbitratorRegistrationView(bisq.desktop.main.account.arbitratorregistration.ArbitratorRegistrationView) ActivatableView(bisq.desktop.common.view.ActivatableView) FiatAccountsView(bisq.desktop.main.account.content.fiataccounts.FiatAccountsView) FxmlView(bisq.desktop.common.view.FxmlView) View(bisq.desktop.common.view.View) MainView(bisq.desktop.main.MainView) ArbitratorRegistrationView(bisq.desktop.main.account.arbitratorregistration.ArbitratorRegistrationView) AccountSettingsView(bisq.desktop.main.account.settings.AccountSettingsView)

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