## 31 EOInterface ¶

## 32 Introduction ¶

With GDL2 and EOInterface you can develop graphical applications using the gnustep gui libraries. It provides the ability to create connections between records from the database, and graphical controls.

Once a connection has been made between the graphical control and the record, EOInterface will update the record when the data changes in the control, and update the control when the data or the selection changes. EOInterface is composed of the EODisplayGroup class and EOAssociation subclasses.

EODisplayGroup contains the records and manages the selection, and notifies EOAssociations when the selection or selected record changes.

EOAssociation subclasses, associate graphical controls to the display group displaying the data in the display group, and updating the display group when the control changes the data. Multi-record associations such as table views can change the display groups selection.

## 33 EODisplayGroup class ¶

EODisplayGroup has an EODataSource, and can fetch and create objects, manage the selection, filter the objects for display with qualifiers, and sort them with EOSortOrderings.

If you have loaded the GDL2Palette into Gorm you can create an EODisplayGroup by dragging an entity or a relationship from the outline view in DBModeler, to the document window in Gorm the display group will be associated with an EODataSource and will be encoded/decoded to and from the .gorm file. It will be a top level object, visible in the ’Objects’ view of the gorm document. With the name of the entity or relationship dropped.

You can create connections from controls directly to the display group, for example you could connect a button or menu item to EODisplayGroups -selectNext: action by: Selecting the control and control-drag from the control to the display group. In the connect inspector, select -selectNext: and click ’connect’.

Available actions for EODisplayGroup:

1. -fetch:
2. -selectNext:
3. -selectPrevious:
4. -delete:
5. -insert:

Manual creation of a EODisplayGroup by initializing the display group and setting its dataSource:

    EODisplayGroup *dg;
    EODataSource *dataSource;

    dg = [[EODisplayGroup alloc] init];
    [dg setDataSource:dataSource];

## 34 EOAssociation class ¶

An EOAssociation is an abstract base class. Subclasses of EOAssociation can be created to connect properties of an object in an EODisplayGroup to graphical controls. EOControls contain aspects, objects, and keys, and display groups.

Where the object is a graphical control, the key, being a key appropriate for KVC on an enterprise object, and the aspect is a string describing the use for the key. Each association has their own set of aspects and the aspects supported may vary between different association classes.

Manual creation of an EOControlAssocation:

    EOAssociation *association;
    EODisplayGroup *authorDG;
    NSTextField *nameField;

    association = [[EOControlAssociation alloc] initWithObject:nameField];
    [association bindAspect:@"value" displayGroup:authorDG key:@"name"];
    [association establishConnection];
    [association release];

A few things of note, You can bind multiple aspects to an association. When the connection is broken the association will be released. When ’nameField’ is deallocated, the connection will automatically be broken.

EOAssociations can be created transparently by Gorm with the GDL2Palette. To create an association with Gorm, Select a control and control-drag from a control to an EODisplayGroup.

In the connect inspector there is a pop up button which contains a list of the association classes which are usable with the control. Select an association class and the first column in the browser changes to a list of the aspects available. Selecting an aspect in the browser and the second column in the browser will list the available class properties connectable to the aspect.

Unfortunately while not all association classes and aspects are implemented. They will unfortunately show up in the connect inspector.