
Chapter 3 Creating a WebObjects Database Application
108
6. Check the “Fetches on load” box.
When “Fetches on load” is selected, the display group fetches its objects as
soon as the component is loaded into the application. You want this feature
in the MovieDetails page so that users are immediately presented with the
selected movie’s roles. In contrast, the Main page does not fetch on load; it
shouldn’t present a list of movies until the user has entered search criteria
and clicked Match.
7. Click OK.
8. In Project Builder, modify MovieDetail’s
setSelectedMovie method to look like
the following:
public void setSelectedMovie(EnterpriseObject newSelectedMovie) {
selectedMovie = newSelectedMovie;
// Add this line.
movieRoleDisplayGroup.setMasterObject(newSelectedMovie);
}
With this addition, whenever a user navigates to the MovieDetails page,
setSelectedMovie updates the movieRoleDisplayGroup’s master object so it displays
the corresponding MovieRole objects.
Adding a Repetition
Now you’ll extend the user interface of the MovieDetails component to display
the actors in the selected movie. Because different movies have different
numbers of roles, you need the dynamism of a repetition element. When you’re
done adding the repetition, your component should look like this:
Comentarios a estos manuales