In this paper we will present the DejaVu framework that allows for a component-based approach to developing Web-integrated applications.
To realize the functionality of hush and its extensions, we employed some basic patterns [GOF94] based on an improved version of the handle/body idiom that was originally introduced in [Coplien92].
The nested component pattern has been introduced to support the development of compound widgets. It allows for (re)using the script and C++ interface of possibly compound widgets, by employing explicit redirection to an inner or primary component. Every (compound) widget can delegate part of its functionality to an inner component. It is common practice to derive a compound widget from another widget by using interface inheritance only, and to delegate functionality to an inner component by explicit redirection.
The actor pattern provides a means to offer a multitude of functional modes simultaneously. For example, a single kit object gives access to multiple (embedded) script interpreters, as well as (possibly) a remote kit. The pattern is essential in supporting the multi-paradigm nature of the DejaVu framework. In our description of the design of the Web components we will show how dynamic role-switching (the actor pattern) is employed for using various network protocols via the same client class. The actor pattern is also used to define a (single) viewer class that is capable of displaying documents of various MIME types (including SGML, HTML, VRML).
The figure above shows the design of the basic Web-related components of the hush class library. The browser class 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 patterns 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 are indexed on their associated MIME type. 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 validating parser [Clark95] and an (experimental) style sheet mechanism based on the Tcl scripting language. This approach allows for experimenting with new (multimedia) document formats. Since the viewer provides no network functionality at all, it generates an event whenever it needs to retrieve data pointed to by a URL. Such events are generated as a response to user interaction (e.g. clicking an anchor) or to fetch inline data during the parsing process. These events (realized by the hidden urlevent class) are typically handled by a web component.
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 previously. This means that web inherits the interface of the MIMEviewer and delegates its (viewer) functionality to an 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 Web-aware applications, that is applications with Web functionality built-in.
Since viewers can be nested to arbitrary depth, any combination of viewers may be employed for inlining a variety of data formats in a uniform fashion. In particular, the combination of an SGML-aware viewer and style-sheets provides a solid starting point for discovering suitable high-level abstractions for integrating multimedia and advanced linking support in the Web.