PATH Documentation > WebObjects

Up Previous Next

Creating a WODisplayGroup

Synopsis

Discusses the different ways to create a WODisplayGroup.

Description

Typically a WODisplayGroup has an EODatabaseDataSource, which in turn, has an EOEditingContext. The EODatabaseDataSource maintains a fetch specification and an array of objects obtained from the EOEditingContext. Figure 1 shows the relationship between the WODisplayGroup, its EODatabaseDataSource and the session's EOEditingContext.

The WODisplayGroup and its EODatabaseDataSource

You create most WODisplayGroups in one of these ways:

In both cases, the EODatabaseDataSource is automatically created and attached to the session's default editing context.

Creating a Detail WODisplayGroup

Most WODisplayGroups operate independently of other WODisplayGroups; however, you can set up a master-detail association between two WODisplayGroups. You typically do this by dragging a to-many relationship from the EOModeler application to a component opened in the WebObjects Builder application. When you do this, the display group you create has an EODetailDataSource (defined in EOControl) as its data source, a detail key equal to the to-many relationship's key, and a master object equal to the entity from which you dragged the relationship. See "Setting Up a Master-Detail Configuration" in Getting Started With WebObjects .

Creating a WODisplayGroup Programmatically

To create a WODisplayGroup programmatically, you instantiate a EODatabaseDataSource and a WODisplayGroup. Then you make the proper connections between the EODatabaseDataSource, the WODisplayGroup, and the session's EOEditingContext. The following Java code, placed in a component's constructor, creates a WODisplayGroup and fetches all of the rows for the "Movie" entity.

 
public Main() {    super();    EOEditingContext ec = this.session().defaultEditingContext();    EODatabaseDataSource ds = new EODatabaseDataSource(ec,"Movie");    moviesDisplayGroup = new WODisplayGroup();    moviesDisplayGroup.setDataSource(ds);    moviesDisplayGroup.fetch();}

See Also

Questions

Keywords

Revision History

19 February 1999. Clif Liu. First Draft.


© 1999 Apple Computer, Inc.

Up Previous Next