Griffon 0.9.5-rc2 – "Aquila hastata" - is a maintenance release of Griffon 0.9.
Dependency resolution can now work in offline mode. When engaged, no external repository will be queried for dependencies; all dependencies should be resolved against the current cache. Also, all artifact repositories are off limits, except those of type local. This mode can be enabled by specifying griffon.offline.mode in either griffon-app/conf/BuildConfig.groovy or $USER_HOME/.griffon/settings.groovy. This flag can also be set as a system property.
Sometimes you don't want controllers to be registered as application event listeners because their code never handles an event. This results in performance upgrades as controllers need not be notified. Both the application's event bus and custom event buses (classes annotated with @griffon.transform.EventPublisher) have a new method that control if the event bus is enabled or not. Events posted while the event bus is disabled will be automatically discarded.
Sometimes you don't want controllers to be registered as application event listeners because their code never handles an event. This results in performance upgrades as controllers need not be notified. This feature relies on the new config section available to MVC groups. Here's how this feature can be specified
mvcGroups {
// MVC Group for "foo"
'foo' {
model = 'foo.FooModel'
view = 'foo.FooView'
controller = 'foo.FooController'
config {
events {
listener = false
}
}
}
} |
There are times when creating multiple MVC groups where there's no need to trigger MVC events for example, a custom MVCGroupManager can potentially disable the event router for a time, then enable it after the group has been constructed. This feature relies on the new config section available to MVC groups. Here's how this feature can be specified
mvcGroups {
// MVC Group for "foo"
'foo' {
model = 'foo.FooModel'
view = 'foo.FooView'
controller = 'foo.FooController'
config {
events {
lifecycle = false
}
}
}
} |
Applications will fire an event named NewInstance whenever an artifact gets instantiated, this results in 3 events per MVC group in the typical case. This is great for letting other parts of the application know that there's a new artifact instance that can be processed by dependency injection for example. But, the runtime also pays the penalty for notifying listeners that may not handle the event. Skipping these events may lead to better performance. This feature relies on the new config section available to MVC groups. Here's how this feature can be specified
mvcGroups {
// MVC Group for "foo"
'foo' {
model = 'foo.FooModel'
view = 'foo.FooView'
controller = 'foo.FooController'
config {
events {
instantiation = false
}
}
}
} |
There's a new abstraction that deals with resource location: griffon.core.ResourceHandler. It defines the following contract
URL getResourceAsURL(String resourceName); InputStream getResourceAsStream(String resourceName); List<URL> getResources(String resourceName); |
Applications, addons and artifacts have been retrofitted with this interface; it's recommended that you use these facilities instead of querying a classloader. Also, there's a new AST transformation that grafts these methods to any class: griffon.transform.ResourcesAware.
The names of the threading methods (execSync, execAsync, execOutside) can be confusing. they have been renamed to the following ones
in griffon.core.ThreadingHandler
execOutside -> execOutsideUI execSync -> execInsideUISync execAsync -> execInsideUIAsync |
in griffon.core.GriffonApplication
eventOutside -> eventOutsideUI |
in griffon.util.EventPublisher
publishEventOutside -> publishEventOutsideUI |
in org.codehaus.griffon.runtime.core.EventRouter
publishOutside -> publishOutsideUI |
The old method names are still available and have been marked as deprecated. They will be removed when Griffon 1.0 is released.
Griffon 0.9.5-rc2 ships with 5 sample applications of varying levels of complexity demonstrating various parts of the framework. In order of complexity they are:
File Viewer is a simple demonstration of creating new MVCGroups on the fly.
Source: samples/FileViewer
To run the sample from source, change into the source directory and run griffon run-app from the command prompt.
GroovyEdit is an improved version of FileViewer that uses custom observable models.
Source: samples/GroovyEdit
To run the sample from source, change into the source directory and run griffon run-app from the command prompt.
Font Picker demonstrates form based data binding to adjust the sample rendering of system fonts.
Source: samples/FontPicker
To run the sample from source, change into the source directory and run griffon run-app from the command prompt.
Greet, a full featured Griffon Application, is a Twitter client. It shows Joint Java/Groovy compilation, richer MVCGroup interactions, and network service based data delivery.
Source: samples/Greet
To run the sample from source, change into the source directory and run griffon run-webstart from the command prompt. Because Greet uses JNLP APIs for browser integration using run-app will prevent web links from working.
SwingPad, a full featured Griffon Application, is a scripting console for rendering Groovy SwingBuilder views.
Source: samples/SwingPad
To run the sample from source, change into the source directory and run griffon run-app from the command prompt.