Navigating from Main to MovieDetails
To get to the MovieDetails page from the Main page, users use a hyperlink. Clicking the hyperlink should set MovieDetail's selectedMovie variable and then open the MovieDetails page.-
Add a hyperlink at the bottom of the Main component.
-
Replace the text "Hyperlink" with "Movie Details."
-
Choose Add Action from the pull-down list.
-
In the Add Action panel, type showDetails in the Name field.
-
Select MovieDetails from the "Page returned" combo box.
-
Click Add.
-
Bind the showDetails action to the hyperlink's action attribute.
-
In Project Builder, modify the showDetails action in Main.java to look like the following:
public MovieDetails showDetails() {
This method creates the MovieDetails page and then invokes its setSelectedMovie method with the movie that's selected in the Main page. The display group method selectedObject returns its selected object, which, in the Main component, is set when a user clicks a movie title hyperlink.
MovieDetails nextPage =
(MovieDetails)pageWithName("MovieDetails");
// Initialize your component here
EOEnterpriseObject selection =
(EOEnterpriseObject)movieDisplayGroup.selectedObject();
nextPage.setSelectedMovie(selection);
© 1999 Apple Computer, Inc. (Last Updated 24 Aug 99)