beautypg.com

Apple WebObjects 3.5 User Manual

Page 107

background image

Setting Up a Master-Detail Configuration

107

Notice that the “Has detail data source” box is checked. This means
that

movieRoleDisplayGroup

gets its objects from a DetailDataSource object.

All display groups use some kind of data source to fetch their objects. A
data source is an object that exists primarily as a simple means for a
DisplayGroup to access a store of objects. It’s through a data source
that a display group fetches, inserts, updates, and deletes database
records.

A DetailDataSource is a subclass of DataSource that’s intended for use
in master-detail configurations. A detail data source keeps track of a
master object and a detail key. The master object is typically the selected
object in a master display group, but a master display group isn’t
strictly required. The detail key is the name of the relationship on
which the master-detail configuration is based. When a detail display
group asks its data source to fetch, the DetailDataSource simply gets
the destination objects from the master object as follows:

detailObjects = masterObject.valueForKey(detailKey);

In your master-detail configuration, the master object is the selected
Movie, and the detail key is

movieRoles

. When

movieRoleDisplayGroup

asks its

data source for its MovieRole objects, the detail DisplayGroup returns
the objects in the selected Movie’s

movieRoles

vector of MovieRoles.

Similarly, when MovieRole objects are inserted or deleted in

movieRoleDisplayGroup

, they are added and removed from the master

object’s

movieRoles

vector.

5. Set the display group to sort alphabetically by

roleName

.

Identifies this display group as a detail display group.

You can’t set the entity of a detail display group. The
entity is computed from the Master/Detail settings.

Sort MovieRole objects by roleName...

Check this box so the display group automatically
fetches its objects.

...from ‘A’ to ‘Z’.