Toolkits Swing
  • linux
  • macosx
  • windows
  • solaris
License Apache Software License 2.0
Documentation No documentation link provided

Downloads 1394

Authored by:

Andres Almiray

Provides automatic action-per-controller management making the job of wiring up actions in Views much easier.


At the heart of this plugin lies the ActionManager. This singleton component is responsible for instantiating, configuring and keeping references to all actions per controller. It will automatically harvest all action candidates from a Controller once it has been instantiated. Each action has all of its properties configured following this strategy:

  • match <>.action.<>.<key>
  • match application.action.<>.<key>

<> should be properly capitalized. In other words, you can configure action properties specifically per Controller or application wide. Available keys are

Key Default value
name GriffonNameUtils.getNaturalName() applied to the action's name - 'Action' suffix (if it exists)
accelerator undefined
command undefined
short_description undefined
long_description undefined
mnemonic undefined
small_icon undefined; should point to an URL in the classpath
large_icon undefined; should point to an URL in the classpath
enabled undefined; boolean value

Another responsibility of the ActionManager component is to place variable bindings in the group's builder that point to the actions themselves. This relieves you of the burden of declaring the variables in an actions block if the default settings are good enough.


The following Controller defines four actions, the first two as closure properties while the others as methods. Two actions have an 'Action' suffix in their names.

    package sample
    import java.awt.event.ActionEvent
    class SampleController {
        def newAction = { ... }
        def open = { ... }
        void close(ActionEvent evt) { ... }
        void deleteAction(ActionEvent evt) { ... }

The actions new and delete use the 'Action' suffix in order to avoid compilation errors given that they make use of reserved keywords. It's all the same to the ActionManager as it will generate the following variables in the group's builder: newAction, openAction, closeAction and deleteAction. ActionManager expects the following keys to be available in the application's i18n resources (i.e. griffon-app/i18n/ = New = Open = Close = Delete
    # additional keys per action elided

In the case that you'd like the close action to be customized for all controllers, say using the Spanish language, then you'll have to provide a file named griffon-app/i18n/ with the following keys = Cerrar

Make sure to remove any controller specific keys when reaching for application wide configuration.