

Managing a DisplayGroup's Selection
Remember how clicking a movie title in the Main page selects the corresponding Movie object in movieDisplayGroup. MovieDetails has a similar behavior for selecting a MovieRole object in movieRoleDisplayGroup.First you need to add a hyperlink element around the repetition's role name string so that users can select a particular MovieRole. When a user clicks one of the movie role hyperlinks, the application should select the corresponding MovieRole object in the movieRoleDisplayGroup.
- Select the repetition's role name string element.
- Click the Add WOHyperlink button in the Other WebObjects toolbar to add a hyperlink element around the string.
Now you need to create an action method to invoke when the hyperlink is clicked.
- Use the Add Action command in the pull-down menu to add an action named selectObject, returning null.
Before you write the body of the selectObject method, bind it to the hyperlink while you're still in WebObjects Builder.
- Bind the selectObject method to the hyperlink's action attribute.
Now write the code for selectObject in MovieDetail.java.
- Modify the selectObject action to look like the following:
public Component selectObject() { movieRoleDisplayGroup.selectObject(movieRole); return null; }
Table of Contents
Next Section