LoganBerryBrowser.mesa
Copyright Ó 1986, 1992 by Xerox Corporation. All rights reserved.
Doug Terry, July 17, 1992 10:54 am PDT
Operations that allow one to create a LoganBerry browser with customized behavior.
DIRECTORY
ChoiceButtons USING [EnumTypeRef],
Containers USING [Container],
Icons USING [IconFlavor],
Labels USING [Label],
LoganBerry USING [Attribute, AttributeType, Entry, nullDB, OpenDB, SchemaInfo],
LoganQuery USING [AttributePatterns, Cursor, QueryPlan],
Menus USING [ClickProc, Menu],
RefTab USING [Ref],
Rope USING [ROPE],
TiogaButtons USING [TiogaButtonProc],
ViewerClasses USING [Viewer, ViewerFlavor];
LoganBerryBrowser: CEDAR DEFINITIONS
~ BEGIN
DBInfo: TYPE = REF DBInfoRec;
DBInfoRec: TYPE = RECORD[
db: LoganBerry.OpenDB ¬ LoganBerry.nullDB, -- open database handle
schema: LoganBerry.SchemaInfo ¬ NIL, -- database schema
shortname: Rope.ROPE ¬ NIL, -- short name for database
selected: BOOLEAN ¬ TRUE -- whether or not database is selected for browsing
];
DisplayProc: TYPE ~ PROC [entry: LoganBerry.Entry, tool: Tool] RETURNS [];
Tool: TYPE = REF ToolBody;
ToolBody: TYPE = RECORD[
name: Rope.ROPE ¬ NIL, -- browser name displayed in caption
databases: LIST OF DBInfo ¬ NIL, -- databases that can be browsed
menu: Menus.Menu ¬ NIL, -- command menu (default is standard menu)
innerFlavor: ViewerClasses.ViewerFlavor ¬ NIL, -- flavor for inner viewer
inner: ViewerClasses.Viewer ¬ NIL, -- viewer for retrieved database entries (*)
display: DisplayProc ¬ NIL, -- procedure to display entries in inner viewer
outer: Containers.Container ¬ NIL, -- main container (*)
icon: Icons.IconFlavor ¬ unInit, -- icon used
fields: LIST OF LoganBerry.AttributeType ¬ NIL, -- fields that should be present in the entry form (default is set of indexed attributes)
entryform: RefTab.Ref ¬ NIL, -- set of "FormField"s (*)
wantInputArea: BOOLEAN ¬ TRUE, -- whether input area should be created
inputArea: ViewerClasses.Viewer ¬ NIL, -- area for type in (*)
wantSortButton: BOOLEAN ¬ TRUE, -- whether sort button should be created
sortButton: ChoiceButtons.EnumTypeRef ¬ NIL, -- order of retrieval (*)
queryFeedback: Labels.Label ¬ NIL, -- area for feedback about query processing (*)
details: Containers.Container ¬ NIL, -- container for choice buttons (*)
historyData: REF ANY ¬ NIL, -- log of executed queries (*)
history: ViewerClasses.Viewer ¬ NIL, -- viewer for history data (*)
lastDeletes: LIST OF LoganBerry.Entry ¬ NIL, -- entries recently deleted (*)
height: CARDINAL ¬ 0, -- current height of tool (excluding inner viewer) (*)
cursor: LoganQuery.Cursor, -- currently executing query (*)
clientData: REF ¬ NIL -- client-specific data
];
Entries that are marked with (*) should be treated as read-only; all other entries can be set explicitly by a client before calling CreateTool.
CreateTool: PROC [db: LoganBerry.OpenDB ¬ LoganBerry.nullDB, tool: Tool] RETURNS [];
Builds a tool for browsing the given LoganBerry database. This procedure takes an OpenDB as a convenience to those clients wishing to browse a single database; to perform merged queries on multiple databases, clients must explicitly set tool.databases before calling this routine with a nullDB.
The following routines may be useful for those clients creating customized browsers.
ReadEntryForm: PROC [tool: Tool] RETURNS [form: LoganQuery.AttributePatterns, other: Rope.ROPE, orderBy: LoganBerry.AttributeType];
Returns the contents of the entry form and the sort button.
RestoreEntryForm: PROC [tool: Tool, form: LoganQuery.AttributePatterns, other: Rope.ROPE];
Writes the given form contents to the browser's entry form.
PrintEntry: PROC [entry: LoganBerry.Entry, tool: Tool];
Simply prints a LoganBerry entry in the browser's inner viewer (works only if the inner viewer is of the default flavor).
PrintEntryAsButton: PROC [entry: LoganBerry.Entry, tool: Tool, proc: TiogaButtons.TiogaButtonProc, clientData: REF ANY ¬ NIL];
Builds a tioga button in the browser's inner viewer (works only if the inner viewer is of flavor $TiogaButtons).
ReportFeedback: PROC [plan: LoganQuery.QueryPlan, tool: Tool] RETURNS [];
Displays the feedback obtained from the given query plan in the browser's feedback areas.
AddToHistory: PROC [tool: Tool, form: LoganQuery.AttributePatterns, other: Rope.ROPE];
Adds information to the browser's history viewer.
These are the default menu procs used by the Browser:
StopProc: Menus.ClickProc;
BrowseProc: Menus.ClickProc;
UpdateProc: Menus.ClickProc;
DeleteProc: Menus.ClickProc;
UnDeleteProc: Menus.ClickProc;
DetailsProc: Menus.ClickProc;
HistoryProc: Menus.ClickProc;
AdminOpsProc: Menus.ClickProc;
OpenProc: Menus.ClickProc;
CloseProc: Menus.ClickProc;
BuildIndicesProc: Menus.ClickProc;
CompactLogsProc: Menus.ClickProc;
END.