Reputation: 553
I am trying to add GraniteDS Framework to Javafx E4 application. I already osgify GraniteDS Javafx libraries to bundles, which i was able to initialize in JavaFX OSGi application (osgi app has jfxStart method with parameters i need).
But in Javafx E4 application (created using e(fx)clipse wizard) there no classes with start function.
In osgi app code was:
protected void jfxStart(IApplicationContext applicationContext, Application jfxApplication, Stage primaryStage) {
contextManager = new SimpleContextManager(new JavaFXApplication(jfxApplication, primaryStage));
contextManager.initModules(App.class);
Context context = contextManager.getContext();
context.set(this);
.......
}
The question is - how to get jfxApplication
and primaryStage
instances in Javafx E4 application and where(when) to execute initialization (in Activator start method probably?)
Upvotes: 0
Views: 464
Reputation: 5887
Both are available through DI:
class MyComponent {
@Inject
public MyComponent(Application app, @Named("primaryStage") Stage primaryStage) {
}
}
Please note that primaryStage is NEVER shown in an e4+JavaFX application so you maybe really want to have is the stage you are shown in - so most likely what you really want is
class MyComponent {
@Inject
public MyComponent(Application app, Stage primaryStage) {
}
}
Upvotes: 2