KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > swing > actions > Targetable


1 /*
2  * $Id: Targetable.java,v 1.1.1.1 2004/06/16 01:43:39 davidson1 Exp $
3  *
4  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5  * Santa Clara, California 95054, U.S.A. All rights reserved.
6  */

7
8 package org.jdesktop.swing.actions;
9
10 /**
11  * An interface which exposes the allowable actions to a TargetManager.
12  * The getCommands method will expose the allowable actions to another class
13  * and the doCommand method is called to invoke an action on the class.
14  * <p>
15  * Usually, the command key will be the key value of the Action. For components
16  * This could be the ActionMap keys. For actions managed with the ActionManager,
17  * this will be the value of an actions Action.ACTION_COMMAND_KEY
18  *
19  * @see TargetManager
20  * @author Mark Davidson
21  */

22 public interface Targetable {
23
24     /**
25      * Perform the command using the object value.
26      *
27      * @param command is a Action.ACTION_COMMAND_KEY
28      * @param value an arbitrary value. Usually this will be
29      * EventObject which trigered the command.
30      */

31     boolean doCommand(Object JavaDoc command, Object JavaDoc value);
32
33     /**
34      * Return a flag that indicates if a command is supported.
35      *
36      * @param command is a Action.ACTION_COMMAND_KEY
37      * @return true if command is supported; false otherwise
38      */

39     boolean hasCommand(Object JavaDoc command);
40
41     /**
42      * Returns an array of supported commands. If this Targetable
43      * doesn't support any commands (which is unlikely) then an
44      * empty array is returned.
45      *
46      * @return array of supported commands
47      */

48     Object JavaDoc[] getCommands();
49 }
50
Popular Tags