01: package org.osbl.client.action;
02:
03: import java.util.EventListener;
04:
05: /**
06: * An ObjectAction is an Action, that can be performed on certain Objects.
07: * It is quite similar to Swing Actions, except that the actionPerformed method provides the objects, for which the
08: * action was caused.
09: * Typical uses are the ObjectDetail, that will call the action for the currently shown object and the ObjectList, that
10: * will call the action for selected objects.
11: */
12: public interface ObjectAction extends EventListener {
13: /**
14: *
15: * @param event
16: */
17: void actionPerformed(ObjectActionEvent event);
18:
19: public static final String DEFAULT = "Default";
20: /**
21: * The key used for storing the <code>String</code> name
22: * for the action, used for a menu or button.
23: */
24: public static final String NAME = "Name";
25: /**
26: * The key used for storing a short <code>String</code>
27: * description for the action, used for tooltip text.
28: */
29: public static final String SHORT_DESCRIPTION = "ShortDescription";
30: /**
31: * The key used for storing a longer <code>String</code>
32: * description for the action, could be used for context-sensitive help.
33: */
34: public static final String LONG_DESCRIPTION = "LongDescription";
35: /**
36: * The key used for storing a small <code>Icon</code>, such
37: * as <code>ImageIcon</code>, for the action, used for toolbar buttons.
38: */
39: public static final String SMALL_ICON = "SmallIcon";
40: /**
41: * The key used to determine the command <code>String</code> for the
42: * <code>ActionEvent</code> that will be created when an
43: * <code>Action</code> is going to be notified as the result of
44: * residing in a <code>Keymap</code> associated with a
45: * <code>JComponent</code>.
46: */
47: public static final String ACTION_COMMAND_KEY = "ActionCommandKey";
48: /**
49: * The key used for storing a <code>KeyStroke</code> to be used as the
50: * accelerator for the action.
51: *
52: * @since 1.3
53: */
54: public static final String ACCELERATOR_KEY = "AcceleratorKey";
55: /**
56: * The key used for storing a <code>KeyEvent</code> to be used as
57: * the mnemonic for the action.
58: *
59: * @since 1.3
60: */
61: public static final String MNEMONIC_KEY = "MnemonicKey";
62:
63: /**
64: * Gets one of this object's properties using the associated key.
65: * @see #putValue
66: */
67: public Object getValue(String key);
68:
69: /**
70: * Sets one of this object's properties using the associated key.
71: *
72: * @param key a <code>String</code> containing the key
73: * @param value an <code>Object</code> value
74: */
75: public void putValue(String key, Object value);
76:
77: /**
78: * Sets the enabled state of the <code>Action</code>. When enabled,
79: * any component associated with this object is active and
80: * able to fire this object's <code>actionPerformed</code> method.
81: * If the value has changed, a <code>PropertyChangeEvent</code> is sent
82: * to listeners.
83: *
84: * @param b true to enable this <code>Action</code>, false to disable it
85: */
86: public void setEnabled(boolean b);
87:
88: /**
89: * Returns the enabled state of the <code>Action</code>. When enabled,
90: * any component associated with this object is active and
91: * able to fire this object's <code>actionPerformed</code> method.
92: *
93: * @return true if this <code>Action</code> is enabled
94: */
95: public boolean isEnabled();
96: }
|