Overview

Griffon 0.9.3-beta-1 – "Aquila fasciata" - is a maintenance release of Griffon 0.9.

New Features

Buildtime

Templates

Almost every create-* script relies on a template in order to create the desired artifact. This template could only be overridden if a plugin (or the application) provided another template that matched the same name as the original one. Clearly that is not an scaling solution so the template system has been revamped to accept a different template depending on the options specified during the command invocation. For example, creating a service with a custom template named MyService you would now invoke the following command

griffon create-service -service=MyService

Basically you specify the type of the artifact as an option (using lowercase on the first char), which leads to the following cases to be valid too

griffon create-mvc -view=CustomView

Speaking of MVC groups, the create-mvc command has additional settings that can be configured, like this

griffon create-mvc foo -group=Custom

Creates a new group definition where MVC member templates are assumed to be CustomModel, CustomView and CustomController. Will use the default template when there's no match.

griffon create-mvc foo -skipController=true

Creates a new group definition without a Controller. The configuration will look like this

mvcGroups {
    // MVC Group for "foo"
    'foo' {
        model      = 'foo.FooModel'
        view       = 'foo.FooView'
    }
    ...
}
griffon create-mvc foo -withController=foor.BarController

Creates a new group definition with another Controller class. The Controller is assumed to exist, a file will not be created for it. The configuration will look like this

mvcGroups {
    // MVC Group for "foo"
    'foo' {
        model      = 'foo.FooModel'
        view       = 'foo.FooView'
        controller = 'bar.BarController'
    }
    ...
}

Application Archetypes

Theres a new application archetype available. It bootstraps an application in a similar way as Ubuntu's Quickly does. Here's how to use it

griffon create-app sample -archetype=jumpstart

The generated code is fully i18n aware and customizable.

Default Package Name

When an application is created it will attempt to use the name of the application as the default package name for the initial MVC group (unless -skipPackagePrompt is specified). This package name is now stored in griffon-app/conf/BuildConfig.groovy for future references by additional scripts.

Filter Plugins by Platform

Calling griffon list-plugins will now filter the list automatically, leaving out those plugins that do not match the current development platform you're working on.

Runtime

Event Aware Logging Appender

There's a new application event aware logging appender that can fire events whenever a logging statement is received. Here's how it can be configured in griffon-app/conf/Config.groovy

log4j = {
    appenders {
        console name: 'stdout', layout: pattern(conversionPattern: '%d [%t] %-5p %c - %m%n')
        event   name: 'redirect', layout: pattern(conversionPattern: '%d [%t] %-5p %c - %m%n')
    }
    ...
}

This appender triggers an event named "LogEvent" which takes 3 arguments: the logging level (as a String), the logging message and an optional throwable.

Short-lived MVC groups

There are times when an MVC group instance must be created and discarded shortly afterwards. Griffon already sports a simple MVC lifecycle however it's easy to miss it which can lead to memory leaks. This is why a new set of methods have been added to both application and artifact interfaces. Say for example you want to create a modal dialog that is backed by an MVC group named 'display'. The model of this dialog has a title and message properties that are used to customize its looks. Heres' how it can be used with the new construct

withMVCGroup('display') { m, v, c ->
    m.title = 'Information'
    m.message = 'Something cool is about to happen'
    c.show()
}

This code assumes the controller of this group also has an action named show. The group will be automatically destroyed once the dialog is dismissed or closed.

Automatic Registration of ArtifactHandlers

In the past plugin authors were required to initialize and register their custom ArtifactHandlers during the addon init step. This is no longer the case as long as the full qualified class name of the ArtifactHandler is placed in the following file griffon-app/conf/metainf/services/griffon.core.ArtifactHandler.

Breaking Changes

Runtime Behavior

All of the createMVCGroup and buildMVCGroup methods have been moved from the griffon.core.GriffonMvcArtifact interface to the griffon.core.GriffonArtifact interface.
The signature of mvcGroupInit(Map<String, ?>) has been changed to mvcGroupInit(Map<String, Object>).

Dependencies

New versions for the following dependencies

Sample Applications

Griffon 0.9.3-beta-1 ships with 5 sample applications of varying levels of complexity demonstrating various parts of the framework. In order of complexity they are:

File Viewer

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

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

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

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

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.

0.9.3-beta-1 Release Notes