Monday Sep 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.

About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« September 2008 »
SunMonTueWedThuFriSat
 
3
6
9
13
14
23
30
    
       
Today