use of org.phoebus.ui.welcome.Welcome in project phoebus by ControlSystemStudio.
the class PhoebusApplication method startUI.
private void startUI(final MementoTree memento, final JobMonitor monitor) throws Exception {
monitor.beginTask(Messages.MonitorTaskUi, 4);
main_stage = new Stage();
menuBar = createMenu(main_stage);
toolbar = createToolbar();
createTopResourcesMenu();
DockStage.configureStage(main_stage);
// Patch ID of main window
// (in case we ever need to identify the main window)
main_stage.getProperties().put(DockStage.KEY_ID, DockStage.ID_MAIN);
// isToolbarVisible() and showToolbar() depend on layout.top -> VBox -> menu, toolbar
final BorderPane layout = DockStage.getLayout(main_stage);
layout.setTop(new VBox(menuBar, toolbar));
layout.setBottom(StatusBar.getInstance());
// Update items now that methods like isToolbarVisible()
// can function since the scene has been populated
show_toolbar.setSelected(isToolbarVisible());
show_statusbar.setSelected(isStatusbarVisible());
// Main stage may still be moved, resized, and restored apps are added.
// --> Would be nice to _not_ show it, yet.
// But restoreState will only find ID_MAIN when the window is visible
// --> Do show it.
main_stage.show();
monitor.worked(1);
// If there's nothing to restore from a previous instance,
// start with welcome
monitor.updateTaskName(Messages.MonitorTaskTabs);
if (!application_parameters.contains("-clean") && !restoreState(memento))
new Welcome().create();
monitor.worked(1);
// Launch background job to list saved layouts
createLoadLayoutsMenu();
// Check command line parameters
monitor.updateTaskName(Messages.MonitorTaskCmdl);
handleParameters(application_parameters);
monitor.worked(1);
// In 'server' mode, handle parameters received from client instances
ApplicationServer.setOnReceivedArgument(parameters -> {
// Invoked by received arguments from the OS's file browser,
// i.e. the file browser is currently in focus.
// Assert that the phoebus window is visible
Platform.runLater(() -> main_stage.toFront());
handleClientParameters(parameters);
});
// DockStage.configureStage() installs an OnCloseRequest
// handler that will close the associated stage/window.
// For the primary window, replace with one that is like calling File/Exit,
// i.e. it closes _all_ stages and ends the application.
main_stage.setOnCloseRequest(event -> {
// Prevent closing right now..
event.consume();
// .. but schedule preparation to close
closeMainStage();
});
DockPane.addListener(dock_pane_listener);
DockPane.setActiveDockPane(DockStage.getDockPanes(main_stage).get(0));
monitor.done();
// as the UI loads style sheets etc.
if (Preferences.ui_monitor_period > 0)
freezeup_check = new ResponsivenessMonitor(3 * Preferences.ui_monitor_period, Preferences.ui_monitor_period, TimeUnit.MILLISECONDS);
if (PlatformInfo.is_mac_os_x) {
closeAllTabsKeyCombination = new KeyCodeCombination(KeyCode.W, KeyCombination.SHIFT_DOWN, KeyCodeCombination.SHORTCUT_DOWN);
} else {
closeAllTabsKeyCombination = new KeyCodeCombination(KeyCode.F4, KeyCombination.SHIFT_DOWN, KeyCombination.CONTROL_DOWN);
}
closeAllTabsMenuItem.acceleratorProperty().setValue(closeAllTabsKeyCombination);
}
Aggregations