Skip to content

Package: Main

Main

nameinstructionbranchcomplexitylinemethod
Main()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
main(String[])
M: 29 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 11 C: 0
0%
M: 1 C: 0
0%
onStageCreated(ApplicationContext)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * *************************************************************************************************************************************************************
3: *
4: * SteelBlue: DCI User Interfaces
5: * http://tidalwave.it/projects/steelblue
6: *
7: * Copyright (C) 2015 - 2024 by Tidalwave s.a.s. (http://tidalwave.it)
8: *
9: * *************************************************************************************************************************************************************
10: *
11: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17: * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
18: *
19: * *************************************************************************************************************************************************************
20: *
21: * git clone https://bitbucket.org/tidalwave/steelblue-src
22: * git clone https://github.com/tidalwave-it/steelblue-src
23: *
24: * *************************************************************************************************************************************************************
25: */
26: package it.tidalwave.role.ui.example.presentation.javafx;
27:
28: import javax.annotation.Nonnull;
29: import javafx.application.Platform;
30: import org.springframework.context.ApplicationContext;
31: import org.springframework.context.annotation.ComponentScan;
32: import org.springframework.context.annotation.Configuration;
33: import org.springframework.context.annotation.EnableAspectJAutoProxy;
34: import org.springframework.context.annotation.aspectj.EnableSpringConfigured;
35: import it.tidalwave.ui.javafx.JavaFXSpringAnnotationApplication;
36: import it.tidalwave.ui.javafx.JavaFXSpringApplication;
37: import it.tidalwave.util.PreferencesHandler;
38: import it.tidalwave.role.ui.example.presentation.MainPanelPresentationControl;
39: import static it.tidalwave.util.PreferencesHandler.KEY_INITIAL_SIZE;
40:
41: /***************************************************************************************************************************************************************
42: *
43: * The main class extends {@link JavaFXSpringApplication} and invokes a starting method on a controller that boots
44: * the application.
45: *
46: * @author Fabrizio Giudici
47: *
48: **************************************************************************************************************************************************************/
49: // START SNIPPET: annotations
50: @Configuration
51: @EnableSpringConfigured
52: @EnableAspectJAutoProxy
53: @ComponentScan(basePackages = "it.tidalwave")
54: public class Main extends JavaFXSpringAnnotationApplication
55: // END SNIPPET: annotations
56: {
57: /***********************************************************************************************************************************************************
58: * Usually {@code main()} does nothing more than a typical {@code main()} of a JavaFX application.
59: * JavaFX and Spring are automatically booted with an implicit configuration:
60: *
61: * <ul>
62: * <li>The FXML resource for the main UI is loaded from the same package as this class, and the name's
63: * {@code Application.fxml}</li>
64: * <li>A splash screen is created from a FXML resource in the same package as this class and name
65: * {@code Splash.fxml}, It is rendered on the screen while the system is initialised in background.</li>
66: * </ul>
67: **********************************************************************************************************************************************************/
68: // START SNIPPET: main
69: public static void main (@Nonnull final String ... args)
70: {
71: try
72: {
73: System.setProperty(PreferencesHandler.PROP_APP_NAME, "SteelBlueExample");
74: Platform.setImplicitExit(true);
75: final var preferencesHandler = PreferencesHandler.getInstance();
76: preferencesHandler.setDefaultProperty(KEY_INITIAL_SIZE, 0.8);
77: System.setProperty("it.tidalwave.role.ui.example.logFolder", preferencesHandler.getLogFolder().toAbsolutePath().toString());
78: launch(args);
79: }
80: catch (Throwable t)
81: {
82: // Don't use logging facilities here, they could be not initialized
83: t.printStackTrace();
84: System.exit(-1);
85: }
86: }
87: // END SNIPPET: main
88:
89: /***********************************************************************************************************************************************************
90: * This method retrieves a reference to the main controller and boots it.
91: **********************************************************************************************************************************************************/
92: // START SNIPPET: onStageCreated
93: @Override
94: protected void onStageCreated (@Nonnull final ApplicationContext applicationContext)
95: {
96: applicationContext.getBean(MainPanelPresentationControl.class).populate();
97: }
98: // END SNIPPET: onStageCreated
99: }