Zarbiff Implementation Design and Details

Introduction

Our packages are a nested directory structure. The main directory contains most of the user interface objects and the main program (Zarbiff.java). Some of the most important objects are: Our object model:

Events

The AWT implements an event handling system for windows, menus, mouseclicks, keypresses, etc. You can probably learn more about the way this works than we know by reading any good Java AWT book once they become available.

Component type objects are placed in an event hierarchy. The Zarbiff frame is at the top. The Toolbar and GraphWindows are its children. The GraphCanvas and Scrollbars are children of the GraphWindow. Whenever some event occurs, the handleEvent method of the deepest child that the mouse was in (at least in X/windows) is called and passed and Event object describing the event. Typically handleEvent takes some special action and/or calles super.handleEvent to obtain the default behavior.

The default handleEvent takes key and mouse presses and calls keyDown, mouseUp, etc. and these methods may also be overridden. If a handleEvent method returns true then no further processing occurs for this event. If it returns false, this means that this object has not completed all actions that need to occur to process the event. In this case, the handleEvent method of the parent of the object is called. Example: If a 'd' key click occurs when the mouse is in the main surface of a window then GraphCanvas.keyDown is called. GraphCanvas only intercepts the 'p' key click, so it returns false. Then GraphWindow.handleEvent is called and it again returns false. Finally Zarbiff.handleEvent is called. It looks for 'd' in a table of defined keys and calls the appropriate filter if an action is defined for the 'd' key. A user's customized keys, menus, and control panel buttons are defined in the '.zarbiff' file.