As an illustration of our approach, we will discuss the
design of the Web-related components
Figure 1 shows the design of the basic Web-related components of the hush class library. The browser provides the toplevel user interface for all Web components, including a viewer, scrollbars, navigation buttons (back, forward, home, reload) and an entry box to enter URLs. The client, web and viewer components form the conceptual base of our approach of viewing the Web. Each component can be extended in a simple way, due to a systematic application of the idioms discussed previously.
Multiple viewers are accessible via the MIMEviewer
which employs the actor pattern to be able to display various
types of MIME-encoded data (e.g. HTML, SGML combined with Tcl
style sheets, VRML). The viewer contains a dictionary of
several viewer actors, that is indexed on the associated
MIME-types. In this way, new viewers can be easily added, even
dynamically. The viewer implementation classes can make use
of existing widgets to display parts of structured documents,
which simplifies their implementation. Another advantage of
this design is the fact that whenever a viewer for a new MIME
type has been added, it is possible to inline this data type
in an SGML or extended-HTML document, via recursive usage of a
viewer widget in another viewer. In other words, it is
possible to inline VRML or video into an HTML document, or
even to insert an HTML-page into another HTML-page. The
SGML-viewer uses an SGML-compliant
The client component provides an abstraction of network (file) access and transport protocols. An important consideration in the design of this component was the requirement to allow for new network transfer protocols. This requirement has been met by employing the actor pattern. The client component implicitly changes its role, depending on the protocol required for fetching the data. When the client component gets the instruction to retrieve a URL, it inspects the URL, decides what role it needs and switches to the appropriate role.
The web component combines the functionality of the viewer and client components. It is able to follow links by retrieving data via several protocols (e.g. HTTP, files, FTP), a task delegated to its client component. Additionally, the web component adds a history and caching mechanism to the MIMEviewer. The web widget uses the nested component pattern described in section 3. This means that web inherits the interface of the MIMEviewer and delegates its (viewer) functionality to a inner viewer component. The web component's behavior is similar to the standard widgets of the framework, and can be conveniently used as a part of an application's GUI. Because the web widget has both a C++ interface and a Tcl interface, it is easy to create, or extend, applications with Web functionality.