01 September 2015

Griffon 2.4.0 Release Notes

Dependencies

The following dependencies have been upgraded

  • org.codehaus.groovy:groovy-all:2.4.4

Runtime

Java8 Support

There is a new griffon-core-java8 module that delivers Java8 specific support. The first iteration of this module provides specialized PropertyEditors for java.time.LocalDate, java.time.LocalDateTime and java.time.LocalTime.

Chained PropertyEditors

It’s now possible to chain several PropertyEditors that target the same source class. You must make use of PropertyEditorResolver.registerEditor and PropertyEditorResolver.findEditor instead of the JDK’s PropertyEditorManager.

MVCGroup Relationships

An MVCGroup can now supply the names of its children groups. When a parent MVCGroup is destroyed so will its children, automatically. All references to parent* members on a child artifact will be set to null upon the group’s destruction.

Context

MVC members may have their properties injected from the group’s context. You just need to annotate the field or the property setter with @Contextual, for example

package org.example

import javafx.inject.Inject
import griffon.inject.Contextual

class LoginController {
    LoginModel model                  // injected by MVC group

    @Inject
    private LoginService loginService // injected by DI container

    @Contextual
    private Credentials credentials   // injected from context
                                      // found under key = org.example.Credentials
}

You may use @Named to change the default key and @Nonnull to specify a required injection.

Resources, Messages and Configuration

It’s now possible to decorate instances of ResourceResolver, MessageSource and Configuration using a decorator for the respective type. The griffon-groovy package for example, adds the capability to resolve simple messages and resources using Groovy’s property syntax. Thus the following lines are equivalent

application.messageSource.getMessage('some.key') == application.messageSource['some.key']
application.resourceResolver.resolveResource('some.key') == application.resourceResolver['some.key']

JavaFX Support

There are a couple of improvements in JavaFXUtils:

  • The methods findElement and findNode work with more containers.

  • Actions can be bound to ToolBar buttons.

Also, the GraphicPropertyEditor can handle plain resources, such as images/icon.png, instead of an icon class argument as before. Additional property editors include LinearGradientPropertyEditor, RadialGradientPropertyEditor and PaintPropertyEditor.

Buildtime

AST Transformations

JavaFX support adds two new AST transformations: @ListChangeListener and @MapChangeListener. They enable the registration of ListChangeListener and MapChangeListener on JavaFX properties, much in the same way as @PropertyListener works with PropertyChangeListener and PropertyChangeEvent.

All listeners generated by @ChangeListener, @InvalidationListener, @ListChangeListener and @MapChangeListener can be automatically wrapped with their Weak reference counterparts if the value of the weak annotation member is set to true.

Swing GDSL

For those developers that rely on IntelliJ IDEA, there’s a new GDSL file that can autocomplete all nodes delivered by SwingBuilder.

Compatibility

  • The method containsKey in griffon.core.Context returns true if the key exists in the current context or its hierarchy.

  • The method hasKey in griffon.core.Context returns true if the key exists in the current context only.

Full binary compatibility report between Griffon 2.4.0 and 2.3.0 can be found here.

A list of fixed issues can be found at the 2.4.0 milestone page.