Hi Eric,
You can download the code from this website. It includes each of the five steps discussed in the RIA chapters.
In baf/step5/obe/Navigator.js, the initializer for obe.Navigator connects the tree widgit event “focusNode” to a function that publishes the topic “focusNavNode”, passing interesting node information with the topic (line 25). Then, in baf/step5/obe/WorkspaceManager.js, the initializer for obe.WorkspaceManager subscribes obe.WorkspaceManager._showObject to the topic “focusNavNode” (line 15). This has the net effect of calling obe.WorkspaceManager._showObject whenever a tree node receives the focus. _showObject is the function that actually loads and initializes the form; publish-subscribe is discussed in Section 6.3.
Note that some of this example isn’t quite industrial strength. For example, there is no data binding. But the example would quickly become another book if the entire “real” framework was discussed. If your interested in a/the real framework, watch www.vista-info-tech.com where we will be publishing the real framework from which the RIA chapters was derived (open source, BSD license).
Sometimes menus do change for an application. In particular, a menu may change depending upon the permissions of the current user or the task. For example, consider the BAF framework that displays these workspace objects (WSOs). One WSO might be a form connected to data while another might be a form design connected to metadata. In the first case, menu items would talk about running the form (e.g., adding/editing/deleting data); in the second case menu items would talk about designing the form (e.g., aligning/sizing/formatting controls).
Also, once the investment is made in a generalized command menu framework, then constructing a menu for a particular application largely becomes a data issue rather than a code issue, hopefully simplifying the program construction process.
Thanks for the compliment. Tell everybody you know!!
Best,
Rawld
rgill [at] vista-info-tech.com