concept action in category griffon

This is an excerpt from Manning's book Griffon in Action.
Next, as you did for the GroovyEdit MVC group, you need to hook the Save and Close behaviors into the view. You do this by using the action’s id parameter. First, in the FilePanelView.groovy class, define these actions before the tabbedPane node:
actions { action(id: 'saveAction', enabled: bind {model.dirty}, name: 'Save', mnemonic: 'S', accelerator: shortcut('S'), closure: controller.saveFile) action(id: 'closeAction', name: 'Close', mnemonic: 'C', accelerator: shortcut('C'), closure: controller.closeFile) }
We’ve reached the core of a controller. Actions are the main reason for a controller’s existence. You’ve seen them before in previous examples, and now it’s time to define them properly.
An action is nothing more than a closure property or a method that follows a conventional set of arguments. It looks like the following when defined as a closure property:
def openFile = { evt = null -> ... }The alternate form, for an action defined as a method, looks like this:
You can appreciate at
that the same trick is used in the controller to query the model for all its observable properties (that is, asking the model’s metadata about all the properties it holds that are of interest for this application to work). The left panel has a special layout[6] that places each row nicely. A row is composed of a label and a text field. The text of the label is properly capitalized thanks to GriffonNameUtils—aliased to GNU using one of Groovy’s tricks to shorten a class name. Controllers also have a special griffonClass of their own. This particular griffonClass has a method that provides the names of the actions declared by the controller. Again this is precisely your goal, and you put that method to good use
.
that the same trick is used in the controller to query the model for all its observable properties (that is, asking the model’s metadata about all the properties it holds that are of interest for this application to work). The left panel has a special layout[
.