com.jgoodies.uif.application
Annotation Type Action


@Documented
@Target(value=METHOD)
@Retention(value=RUNTIME)
public @interface Action

A method annotation to specify Action method bodies with their name, and initial enablement. Actions can be requested using Application.getActionMap(Object) that returns an ActionMap that in turn maps action names to Actions.

Methods annotated with this Annotation can have two signatures: with or without an ActionEvent parameter. E.g.

 @Action
 public void doOK(ActionEvent e) {
     // Do something; may use the action event, for example when
     // opening a dialog to request the event sources root windows
 }

 @Action
 public void doCancel() {
     // Do something. Has no action event available.
 }
 
By default the action name is the method name. This can be changed by setting the optional annotation value name, e.g.
 @Action(name="saveInvoice")
 public void save() {
     // Saves the invoice
 }
 
The action's initial enablement can be set with an option. Actions are enabled by default.
 @Action(enabled=false)
 public void openSelectedItem(ActionEvent e) {
     // Should be enabled if and only if there's a selection.
 }
 

Version:
$Revision: 1.3 $
Author:
Karsten Lentzsch
See Also:
ApplicationContext.getActionMap(Object), Action, ActionMap

Optional Element Summary
 boolean enabled
           
 String name
           
 

name

public abstract String name
Default:
""

enabled

public abstract boolean enabled
Default:
true


Copyright © 2000-2008 JGoodies Karsten Lentzsch. All Rights Reserved.