Question

I'm upgrading a big 0.3.1 Griffon app into 0.9.4 I'm getting these difficulties:

  • Startup arguments: I needed to deal with startup arguments so there was (in previous version) a:

    class MyApplication extends SwingApplication

now it seems this can be accomplished in a cleaner way using:

app.getStartupArgs()

where should I put my own code? in Initialize.groovy script perhaps?

Any post or example on how to deal with these arguments?

Thanks in advance.

Was it helpful?

Solution

Accessing app.getStartupArgs() can be done from anywhere you have access to the app variable. Remember that lifecycle scripts are always executed inside the EDT, no exceptions.

Personally I tend to use application events more and more, for example reading the startup args after all startup mvc groups have been created can be done like this (in a file named griffon-app/conf/Events.groovy)

onStartupEnd = { app ->
    println app.startupArgs
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top