Action class provides a simple facility for creating and deploying actions in a UI-type setting. It uses Java's Reflection API to store a method call, which is performed when the performAction() method is called on the Action object. Generally, you probably shouldn't be creating your own Action methods unless you're extending some of the built-in Menu stuff. Instead, an Action should be created via a call to a MenuItem's create() or add() method.
Shortcuts (which are a simple facility for keyboard shortcuts) generally contain a reference to an Action object, which is called when the keyboard shortcut is pressed.
TODO: Split the current Action class into an interface and a default implementation. Similar to Swing's Action class, an Action object should simply be a guarantee that the object has an actionPerformed method. Then, the default implementation, MethodAction, would have the functionality that is currently within the Action class, and we could create other, new types of actions: ThreadAction, CalculationAction, ListenableAction... I'm out of ideas, but come up with some yourself!
@author Gregory Jordan
@see org.andrewberman.ui.MenuItem
@see org.andrewberman.ui.Shortcut
@see org.andrewberman.ui.menu.MenuItem
| |