File: TuplesEditor.mesa
Contents: interface to a "tuples" subwindow for use by nut implementations
Created by: Donahue July 8, 1982 10:44 am
Last edited by:
Donahue, April 8, 1983 12:20 pm
Cattell, October 7, 1983 5:16 pm
DIRECTORY
DB: TYPE USING[Domain, Entity, Attribute],
ViewerClasses: TYPE USING[Viewer];
TuplesEditor: CEDAR DEFINITIONS =
BEGIN
Viewer: TYPE = ViewerClasses.Viewer;
defaultOld: BOOL; -- FALSE => attributes in NewOrOld mode, TRUE => OldOnly
DisplayTuples: PROC[e: DB.Entity, attrList: LIST OF DB.Attribute, parent: Viewer] RETURNS [Viewer];
Make a viewer nested in parent containing all of the tuples in which the entity
participates (i.e., tuples with an attribute referencing the entity). The nested viewer
will also contain blank tuples for relations in which an entity of e's type could
participate. Returns the nested viewer.
SaveTuples: PROC[viewer: Viewer, newEntity: DB.Entity ← NIL] RETURNS [errors: BOOL];
Given a table set up by DisplayTuples, add all of its contents to the database.
Returns TRUE if any errors were reported to the user as a result of bad entries.
The function of SaveTuples is determined by the newEntity and the oldEntity (the
entity originally supplied to DisplayTuples):
oldEntity newEntity result
NIL    e   add the relships on the screen to the entity e
e    NIL  destroy the entity e, and all relationships that reference it
e    e   update entity e to reflect any modifications to relships on screen
e1    e2 (#e1) add e1's relships, as modified on screen, to e2 (leaves e1 alone)
QueryTuples: PROC[viewer: Viewer, domain: DB.Domain] RETURNS [LIST OF DB.Entity];
Given a table set up by DisplayTuples, finds all the entities in the given domain
that satisfy the query filled into the table by the user.
NOTE: for both query and editor windows: the top-level viewer containing the viewer on which EditTuples or QueryTuples is called may have a $Typescript property whose value is a stream to send error messages to. If no such stream is provided, error messages will go to the Message window.
END.