17.1. OverviewBefore introducing declarative actions, let's take a step back and look at what an action is all about. The primary role of actions is to expose application behavior to the user. When you click on a menu item or toolbar item or invoke a key sequence, an action is run. Further, you can set up a system such that the same action is placed in a menu, a toolbar, and bound to a key sequenceactions allow you to separate behavior from placement. Actions also determine if they are enabled, figure out what elements to work on, run the work, and display the results. Below is a list of the basic responsibilities of actions. As you explore the various ways of defining and using actions, remember that these responsibilities apply regardless of how or where they are defined and usedonly the syntax is different.
When you add an action, you have to implement each of these responsibilities. Figure 17-1 shows how the "Build" action from the IDE product implements these responsibilities. Figure 17-1. Action responsibilities[View full size image] The Build action is placed in the top-level toolbar and menu, it is rendered as a push button with a name and image, it's enabled when at least one project is selected, and its input is the selected project. Its behavior is to build the selected project. |
Sunday, October 25, 2009
Section 17.1. Overview
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment