-- File: EntityEditor.mesa
-- Contents: interface to a "related entities" subwindow for use by nut implementations
-- Created by: Donahue, October 18, 1982 1:48 pm
-- Last edited by:
-- Donahue, April 8, 1983 2:27 pm
-- Cattell, April 6, 1983 2:48 pm

DIRECTORY
DB: TYPE USING[ Entity, Segment ],
ViewerClasses: TYPE USING[ Viewer ],
VTables: TYPE USING[ VTable ];

EntityEditor: DEFINITIONS IMPORTS DB =

BEGIN OPEN DB, ViewerClasses, VTables;

SaveFailed: ERROR;

DisplayEntities: PROC[of: Entity, parent: Viewer, in: DB.Segment,
       noEdits: BOOLEANFALSE] RETURNS[viewer: VTable];
-- make a nested viewer (a VTable) that has all of the tuples for the "*" relation, using the
-- entity provided as the "of" field
-- if noEdits is true then the table produced cannot be changed
-- the viewer produced is NOT painted
-- the entities are displayed in iconic form (yellow-bugging them "opens" them, blue-bugging
-- deletes them from the display)

NewEntry: PROC[ is: Entity, table: VTable ];
-- add a new entry to the table
-- The table will be expanded as necessary to contain the new icon (duplicates are not stored)
-- Again, the table is not painted and no updates are actually made to the database

SaveEntities: PROC[ viewer: Viewer, newOf: Entity ← NIL ];
-- given a table set up by DisplayEntities, add all of its contents to the database
-- if a newOf is provided, then it will be used to create new relationships with all of the
-- entities that are displayed in the table; otherwise all of the existing relationships for the
-- entity provided when the table was created will be updated

END.