Managing a displaygroup’s selection, Managing a displaygroup’s selection 112 – Apple WebObjects 3.5 User Manual
Page 112

Chapter 3
Creating a WebObjects Database Application
112
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
.
1. Select the repetition’s role name string element.
2. 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.
3. 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.
4. Bind the
selectObject
method to the hyperlink’s
action
attribute.
Now write the code for
selectObject
in
MovieDetail.java
.
5. Modify the
selectObject
action to look like the following:
public Component selectObject()
{
movieRoleDisplayGroup.selectObject(movieRole);
return null;
}