diff options
| author | Felix Kehrer <felix.kehrer@gmail.com> | 2018-05-07 16:02:17 +0200 | 
|---|---|---|
| committer | Felix Kehrer <felix.kehrer@gmail.com> | 2018-05-07 16:02:17 +0200 | 
| commit | f15137dfbff0835a90bb345a7a4f6c8732cef46f (patch) | |
| tree | 224b8b83925c909b65e74be45c762e1912c17f2a /src/main/java/at/ac/tuwien/sepm/assignment/groupphase/application | |
| parent | 1243cb27f0239d4dc17fa519a0b0c51881723644 (diff) | |
| parent | f8c893b3a0dc51bde50238ddf3b7d1db318cb743 (diff) | |
| download | sepm-groupproject-f15137dfbff0835a90bb345a7a4f6c8732cef46f.tar.gz sepm-groupproject-f15137dfbff0835a90bb345a7a4f6c8732cef46f.tar.xz sepm-groupproject-f15137dfbff0835a90bb345a7a4f6c8732cef46f.zip  | |
Merge branch 'main_controller' into review_fahrzeug_anmelden
Diffstat (limited to 'src/main/java/at/ac/tuwien/sepm/assignment/groupphase/application')
| -rw-r--r-- | src/main/java/at/ac/tuwien/sepm/assignment/groupphase/application/MainApplication.java | 52 | 
1 files changed, 52 insertions, 0 deletions
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/application/MainApplication.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/application/MainApplication.java new file mode 100644 index 0000000..01c04d3 --- /dev/null +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/application/MainApplication.java @@ -0,0 +1,52 @@ +package at.ac.tuwien.sepm.assignment.groupphase.application; + +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.userInterface.CreateOperationController; +import at.ac.tuwien.sepm.assignment.groupphase.util.SpringFXMLLoader; +import javafx.application.Application; +import javafx.application.Platform; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.stereotype.Component; + +@Component +@ComponentScan("at.ac.tuwien.sepm.assignment.groupphase") +public class MainApplication extends Application { + +    private static AnnotationConfigApplicationContext configApplicationContext; + +    public static void main(String[] args) { +        Application.launch(MainApplication.class, args); +    } + +    @Override +    public void start(Stage primaryStage) throws Exception { +        primaryStage.setTitle("Einsatz erstellen"); +        primaryStage.centerOnScreen(); +        primaryStage.setOnCloseRequest(event -> Platform.exit()); + +        configApplicationContext = new AnnotationConfigApplicationContext(MainApplication.class); +        final var fxmlLoader = configApplicationContext.getBean(SpringFXMLLoader.class); +        primaryStage.setScene( +                new Scene( +                        (Parent) +                                fxmlLoader.load( +                                        getClass() +                                                .getResourceAsStream( +                                                        "/fxml/CreateOperationController.fxml")))); + +        CreateOperationController controller = +                configApplicationContext.getBean(CreateOperationController.class); +        controller.updateList(); +        primaryStage.show(); +        primaryStage.toFront(); +    } + +    @Override +    public void stop() throws Exception { +        super.stop(); +        configApplicationContext.close(); +    } +}  | 
