Skip to end of metadata
Go to start of metadata

Description

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

Installation

The current version of griffon-actions-plugin is 0.2
To install just issue the following command

Usage

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 <controller.class.name>.action.<action.name>.<key>
  • match application.action.<action.name>.<key>

<action.name> 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.

Example

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.

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/messages.properties)

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

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

History

Version

Date

Notes

0.2

10-21-11

Release sync with Griffon 0.9.4

0.1

08-15-11

Initial release

  • No labels