Monday September 29, 2008
Spring RCP Application Initialized From Griffon
To get them to co-exist, somehow Spring RCP's application class should replace the Griffon application class, or the other way round. Maybe I need to create an ApplicationBuilder for Spring RCP? There's also threading issues to figure out. Anyway, right now I'm able to show both applications: the Griffon application and the Spring RCP application (at least, their main windows):
Here's the application context, containing one single bean only, for the application class:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="application" class="org.springframework.richclient.application.Application">
</bean>
</beans>
Now the question is from where to initialize the above. In "Startup.groovy", I have this:
def rootController = app.controllers.root rootController.startApplication()
...which points to this in the above referenced controller:
def appContextPath = "richclient-application-context.xml"
def startApplication = { evt = null ->
edt {
withWorker( start: true ) {
onInit {
}
work {
try {
new ApplicationLauncher(appContextPath)
} catch (RuntimeException e) {
println 'Failure'
}
}
onDone {
}
}
}
}
Without SwingWorker, I couldn't get it to work. Then when the application is run, first the Griffon view is shown, then you see Spring RCP output (all about initialization of Spring RCP internals), and then the application class is initialized and displayed. Whether the above is a step forward or not I don't know. But at least it shows the Spring RCP application, which is nice to see in this context.
Sep 29 2008, 01:01:28 PM PDT Permalink


