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);
}
}
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);
}
Aggregations