View Management

It is quite common for a user to want to treat a collection of different views as one logical view. The Smalltalk class browser for instance contains several different subviews (a class list, selector list and code view, etc.). These simple subviews are all part of the same complex view, a browser. This relationship must be well defined.

Since individual views define which events they are interested in, and are responsible for their own operation combining several views to create arbitrarily complex views is easy. We need only to provide a general mechanism for grouping views together, a complex view. A complex view is a collection of views which acts as one. It is a container and a coordination mechanism for these views. Complex views respond to typical view methods (e.g., display, open, close, etc.) such that sending the open message to a complex view is like sending open to each of its subviews.

Complex views allow a user interface designer to create views with several different parts without modifying any code, he simply adds components to the collection. The components can be anything from a border or label for the view to another complex view. By adding one complex view to another complex view several times, the user can create an arbitrarily complex hierarchy. Suppose the designer wanted to combine a debugger and a class browser. He would create a complex view and add the debugger's view and the class browser's view, both of which are complex. Neither the code for the debugger nor the browser has to be modified.

Complex views are created from parts (see Figure 4.2) and have no displayable form of their own. They create a logical grouping, not a physical or graphical one. For this reason, the subviews of a complex view need not be grouped together and may overlap on the screen.

A complex view also serves as a coordinator for its subviews. The subviews can communicate with each other through the complex view. One kind of complex view is a screen manager (the screen is just a view with several subviews). The screen manager ensures that the proper views are visible and updates the screen when views are moved or deleted.