Search in sources :

Example 1 with MainController

use of org.monarchinitiative.loinc2hpo.controller.MainController in project loinc2hpo by monarch-initiative.

the class Main method init.

@Override
public void init() throws IOException {
    final Injector injector = Guice.createInjector(new DepInjectionModule());
    final Callback<Class<?>, Object> guiceFactory = clazz -> injector.getInstance(clazz);
    rootNode = FXMLLoader.load(getClass().getResource("/fxml/main.fxml"), // The resource bundle, useful to internationalised apps. Null here.
    null, new JavaFXBuilderFactory(), // this Guice factory will manage the instantiation of the controllers and their dependency injections.
    guiceFactory);
    // the following two lines both works; not sure what the first line is
    // mainController = injector.getInstance(Key.get(MainController.class));
    mainController = injector.getInstance(MainController.class);
}
Also used : Scene(javafx.scene.Scene) JavaFXBuilderFactory(javafx.fxml.JavaFXBuilderFactory) Loinc2HpoPlatform(org.monarchinitiative.loinc2hpo.io.Loinc2HpoPlatform) MainController(org.monarchinitiative.loinc2hpo.controller.MainController) URL(java.net.URL) Inject(com.google.inject.Inject) Key(com.google.inject.Key) IOException(java.io.IOException) Injector(com.google.inject.Injector) Application(javafx.application.Application) Platform(javafx.application.Platform) Parent(javafx.scene.Parent) Logger(org.apache.logging.log4j.Logger) Stage(javafx.stage.Stage) FXMLLoader(javafx.fxml.FXMLLoader) Guice(com.google.inject.Guice) Optional(java.util.Optional) Callback(javafx.util.Callback) Image(javafx.scene.image.Image) LogManager(org.apache.logging.log4j.LogManager) javax.swing(javax.swing) JavaFXBuilderFactory(javafx.fxml.JavaFXBuilderFactory) Injector(com.google.inject.Injector) MainController(org.monarchinitiative.loinc2hpo.controller.MainController)

Aggregations

Guice (com.google.inject.Guice)1 Inject (com.google.inject.Inject)1 Injector (com.google.inject.Injector)1 Key (com.google.inject.Key)1 IOException (java.io.IOException)1 URL (java.net.URL)1 Optional (java.util.Optional)1 Application (javafx.application.Application)1 Platform (javafx.application.Platform)1 FXMLLoader (javafx.fxml.FXMLLoader)1 JavaFXBuilderFactory (javafx.fxml.JavaFXBuilderFactory)1 Parent (javafx.scene.Parent)1 Scene (javafx.scene.Scene)1 Image (javafx.scene.image.Image)1 Stage (javafx.stage.Stage)1 Callback (javafx.util.Callback)1 javax.swing (javax.swing)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 MainController (org.monarchinitiative.loinc2hpo.controller.MainController)1