Dead
[official-gcc.git] / gomp-20050608-branch / libjava / classpath / javax / swing / Action.java
blob3dd63539ddc268a5d6382377e9bb0a408dbbc741
1 /* Action.java --
2 Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
38 package javax.swing;
40 import java.awt.event.ActionListener;
41 import java.beans.PropertyChangeListener;
43 /**
44 * Provides a convenient central point of control for some task
45 * that can be triggered by more than one control in a Swing user interface
46 * (for example, a menu item and a toolbar button).
48 * @see AbstractButton#setAction(Action)
50 * @author Ronald Veldema (rveldema@cs.vu.nl)
51 * @author Andrew Selkirk
53 public interface Action extends ActionListener {
55 /**
56 * A key to access the default property for the action (this is not used).
58 String DEFAULT = "Default";
60 /**
61 * A key to access the long description for the action.
63 String LONG_DESCRIPTION = "LongDescription";
65 /**
66 * A key to access the name for the action.
68 String NAME = "Name";
70 /**
71 * A key to access the short description for the action (the short
72 * description is typically used as the tool tip text).
74 String SHORT_DESCRIPTION = "ShortDescription";
76 /**
77 * A key to access the icon for the action.
79 String SMALL_ICON = "SmallIcon";
81 /**
82 * A key to access the {@link KeyStroke} used as the accelerator for the
83 * action.
85 String ACCELERATOR_KEY = "AcceleratorKey";
87 /**
88 * A key to access the action command string for the action.
90 String ACTION_COMMAND_KEY = "ActionCommandKey";
92 /**
93 * A key to access the mnemonic for the action.
95 String MNEMONIC_KEY = "MnemonicKey";
97 /**
98 * Returns the value associated with the specified key.
100 * @param key the key (not <code>null</code>).
102 * @return The value associated with the specified key, or
103 * <code>null</code> if the key is not found.
105 Object getValue(String key);
108 * Sets the value associated with the specified key and sends a
109 * {@link java.beans.PropertyChangeEvent} to all registered listeners.
110 * The standard keys are defined in this interface: {@link #NAME},
111 * {@link #SHORT_DESCRIPTION}, {@link #LONG_DESCRIPTION},
112 * {@link #SMALL_ICON}, {@link #ACTION_COMMAND_KEY},
113 * {@link #ACCELERATOR_KEY} and {@link #MNEMONIC_KEY}. Any existing value
114 * associated with the key will be overwritten.
116 * @param key the key (not <code>null</code>).
117 * @param value the value (<code>null</code> permitted).
119 void putValue(String key, Object value);
122 * Returns the flag that indicates whether or not this action is enabled.
124 * @return The flag.
126 boolean isEnabled();
129 * Sets the flag that indicates whether or not this action is enabled. If
130 * the value changes, a {@link java.beans.PropertyChangeEvent} is sent to
131 * all registered listeners.
133 * @param b the new value of the flag.
135 void setEnabled(boolean b);
138 * Registers a listener to receive notification whenever one of the
139 * action's properties is modified.
141 * @param listener the listener.
143 void addPropertyChangeListener(PropertyChangeListener listener);
146 * Deregisters a listener so that it no longer receives notification of
147 * changes to the action's properties.
149 * @param listener the listener.
151 void removePropertyChangeListener(PropertyChangeListener listener);
153 } // Action