beautypg.com

Configuring the browser, Configuring the browser 114 – Apple WebObjects 3.5 User Manual

Page 114

background image

Chapter 3

Creating a WebObjects Database Application

114

2. Using the Display Group Options panel, assign

talentDisplayGroup

’s entity to

Talent.

Remember that to open the Display Group Options panel, simply

double-click the

talentDisplayGroup

variable in the object browser. The icon

initially displayed next to the variable indicates that initialization
parameters have not yet been set.

3. Configure

talentDisplayGroup

to sort its objects alphabetically (ascending)

by

lastName

.

4. Configure it to fetch on load.

After you configure

talentDisplayGroup

, the object browser shows a icon

next to the variable.

The Movies application uses a display group to provide Talent objects, but you
could fetch the Talent objects from the database without one. Display groups
provide a simple way to fetch, insert, update, and delete enterprise objects
without writing much, if any, code. To get finer-grained control over these
operations, you can work directly with an EditingContext object. An editing
context can do everything a display group does and much more, but you have to
write more code to use one. For more information, see the EditingContext class
specification in the Enterprise Objects Framework Reference.

Configuring the Browser

In a way similar to the way you create bindings for a repetition, create your
browser’s bindings.

1. Bind

talentDisplayGroup.displayedObjects

to the browser’s

list

attribute.

2. Bind

talent

to the browser’s

item

attribute.

3. Bind

talent.lastName

to the browser’s

value

attribute.

The

value

attribute tells the browser what string to display. For each

item

in

its

list

, the browser evaluates the

item

’s

value

.

The browser in the MovieDetails page should display the actors’ full
names, but there isn’t an attribute for full name. In the next section, you’ll
create a custom Talent class that implements a

fullName

method, but for now

just use

talent.lastName

as the

value

attribute.

A browser also has a

selections

attribute that should be bound to a vector of

objects. A browser’s selection can be zero, one, or many objects; but in the