use of eu.ggnet.dwoss.assembly.client.support.monitor.MonitorManager in project dwoss by gg-net.
the class DwOssApplication method start.
/**
* Starting the Deutsche Warenwirtschaft Open Source application.
* The startup happens through the following steps:
* <ol>
* <li>Parameter validation via <a href="https://jcommander.org/">JCommander</a>. The required and optional parametes are defined here
* {@link ConnectionParameter}.</li>
* <li>Setting the LAF for Swing components via {@link LafMenuManager#loadAndSetUserLaf() }</li>
* <li>Displaying a placeholder main pane and the blocking login screen.
* <ul>
* <li>The login screen has no authentification system on visibility but the user can already type in his username and password.</li>
* <li>The guardian is set later and only then an authentification will happen, even if the user has pressed return before.</li>
* <li>A red/green circle in the ui displays the status of the guardian (red meaning not yet set).</li>
* </ul>
* </li>
* <li>Initialize the client backend, remote connections, saft core, and preparing the main view by wrapping the javafx pane in a swing frame.
* <ul>
* <li>{@link #initSeContainer() }</li>
* <li>{@link #initGlobalExceptionHandling() }</li>
* <li>{@link #initRemoteConnection(eu.ggnet.dwoss.assembly.client.support.ConnectionParameter) }</li>
* <li>{@link #initMainPane() }</li>
* <li>{@link #startSaftInitMainFrameAndWrapMainPane(javax.swing.JFrame, javafx.scene.layout.Pane, eu.ggnet.dwoss.assembly.client.support.ConnectionParameter)
* }</li>
* </ul>
* </li>
* <li>Activating the authentification in the login screen by calling {@link LoginScreenController#setAndActivateGuardian(eu.ggnet.saft.experimental.auth.Guardian)
* with the remote guardian</li>
* <li>Start the polling of server progress {@link MonitorManager#startPolling() }</li>
* <li>Initialize the session timeout and global keys for manual logout and relocation of windows. Ctrl+Shift+L for manual logout and Ctrl+Shift+R for
* relocation of all windows</li>
* </ol>
*
* @param primaryStage primaryStage of application.
* @throws Exception all possible exeptions.
*/
@Override
public void start(Stage primaryStage) throws Exception {
try {
// Parameter discovery is done here, cause a error will be shown via Ui.
ConnectionParameter cp = new ConnectionParameter();
JCommander.newBuilder().addObject(cp).programName(DwOssMain.class.getName()).build().parse(getParameters().getRaw().toArray(new String[] {}));
L.debug("start() parameters discovered: {}", cp);
LafMenuManager.loadAndSetUserLaf();
createAndShowMainPane(primaryStage);
// Creating the Swing MainFrame as long as we are in the Swing mode.
JFrame mainFrame = new JFrame();
LoginScreenController firstLoginScreen = createAndShowFirstLoginScreen(primaryStage, mainFrame);
CompletableFuture.runAsync(() -> {
container = initSeContainer();
instance = container.getBeanManager().createInstance();
saft = instance.select(Saft.class).get();
UiCore.initGlobal(saft);
}).thenRun(() -> initGlobalExceptionHandling()).thenRun(() -> initRemoteConnection(cp)).thenApply(v -> initMainPane()).thenAcceptAsync(mainView -> startSaftInitMainFrameAndWrapMainPane(mainFrame, mainView, cp), java.awt.EventQueue::invokeLater).thenRunAsync(() -> firstLoginScreen.setAndActivateGuardian(Dl.local().lookup(Guardian.class))).thenRun(() -> initOnceViews()).thenRun(() -> instance.select(MonitorManager.class).get().startPolling()).thenRun(() -> initSessionTimeoutAndManualLogoutKeys()).thenRun(() -> initRelocationKeys()).handle((v, ex) -> {
new DwFinalExceptionConsumer(null).accept(Optional.empty(), ex);
return null;
});
} catch (ParameterException e) {
// Sout is here correct.
System.out.println(e.getMessage());
System.out.println();
e.getJCommander().usage();
Alert a = new Alert(javafx.scene.control.Alert.AlertType.ERROR);
a.setTitle("Fehler beim Start");
a.setHeaderText("Fehler bei Start.");
a.setContentText("Es ist ein Fehler beim Start aufgetreten. Bitte Console und/oder Logs prüfen.");
a.show();
}
}
Aggregations