org.jdesktop.application.Action Maven / Gradle / Ivy
Show all versions of tink-app Show documentation
/*
* Copyright (C) 2006 Sun Microsystems, Inc. All rights reserved. Use is
* subject to license terms.
*/
package org.jdesktop.application;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marks a method that will be used to define a Swing
* Action
object's actionPerformed
* method. It also identifies the resources that
* will be used to initialize the Action's properties.
* Additional @Action
parameters can be used
* to specify the name of the bound properties (from the
* same class) that indicate if the Action is to be
* enabled/selected, and if the GUI should be blocked
* while the Action's background {@link Task} is running.
*
*
* The {@link ApplicationActionMap} class creates an
* ActionMap
that contains one {@link ApplicationAction}
* for each @Action found in a target or "actions" class.
* Typically applications will use {@link
* ApplicationContext#getActionMap(Class, Object) getActionMap} to
* lazily construct and cache ApplicationActionMaps, rather than
* constructing them directly. By default the ApplicationActionMap's
* {@link ApplicationActionMap#get key} for an @Action is the
* name of the method. The name
parameter can be used to
* specify a different key.
*
*
* The ApplicationAction's
properties are initialized with
* resources loaded from a ResourceBundle with the same name as the
* actions class. The list of properties initialized this way
* is documented by the {@link ApplicationAction ApplicationAction's}
* constructor.
*
*
* The method marked with @Action, can have no parameters,
* or a single ActionEvent parameter. The method's return type
* can be void
or {@link Task}. If the return type
* is Task, the Task will be executed by the ApplicationAction's
* actionPerformed
method.
*
*
* [TBD the block parameter, and the Parameter annotation]
*
* @see ApplicationAction
* @see ApplicationActionMap
* @see ApplicationContext
* @author Hans Muller ([email protected])
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Action {
String name() default "";
String enabledProperty() default "";
String selectedProperty() default "";
Task.BlockingScope block() default Task.BlockingScope.NONE;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
@interface Parameter {
String value() default "";
}
}