magazine resources subscribe about advertising

 

 

 








 CD Home < Web Techniques < 1997 < October  

Feel the Beat with Marimba's Bongo

By Chris Baron

In 1996, four programmers from the original Java-development team left Sun to form Marimba and produce industrial-strength Java-development tools for user interface and application administration. Bongo, one of Marimba's two shipping products, allows developers to create either a Java-application interface or a standalone Java-based application called a "presentation." A Bongo presentation resembles a HyperCard stack -- it allows developers to quickly create an application with a sophisticated user interface, but without the tedious programming of directly coding in Java or C/C++. Bongo's nonprogramming, visual approach makes it ideal for producing simple applications that don't involve a lot of processing, such as product demonstrations, user-interface prototypes, and training applications. Bongo is fully integrated with Castanet, Marimba's other product, a technology for remotely installing and updating Java applications.

The commercial version of Bongo is distributed electronically from the Marimba Web site; a fully functional demo version is also available. The $495 retail price indicates that Bongo is aimed at the professional developer community rather than the home or small-scale developer market. The evaluation version of the software I received from the company came in the form of a book (with software on CD-ROM) entitled The Official Guide to Marimba Bongo, by Danny Goodman (Sams.Net, 1997). This book adequately fills the roles of both user and reference manuals. Serious users will need to purchase The Official Guide or one of the other two available books (with others on the way).

Tuning Up

Installation on my Windows 95 machine was straightforward using a standard Windows setup.exe and InstallShield. The basic installation includes the Bongo executables, a few example presentations, and the Marimba Java-class libraries. The executables and classes from the JDK 1.1 can also be installed (without documentation, examples, or debugger). All in all, Bongo consumes just over five megabytes of disk space. The Marimba class-library API, in Javadoc format, is also included on the CD-ROM and consumes another 2.4 megabytes if installed.

The Bongo software consists of the "builder," an authoring tool used to visually construct presentations, and a "player," used to run the presentations in standalone mode. Both are small, binary executables (not Java bytecode) that provide the glue between the native operating system, the Marimba class library, and the runtime environment's Java Virtual Machine (JVM). This allows better integration with the native windowing system than the default Java setup; for example, to load the player and run a presentation under Windows or MacOS, you simply double-click the presentation's icon. The downside of this operating-system integration is reduced portability -- operating systems that have a JVM but not the Bongo player cannot run standalone Bongo applications. Still, Bongo supports Windows 95/NT, Solaris 2.x SPARC, and MacOS 7.5 PowerPC with unsupported ports available for Linux, Solaris x86, FreeBSD, and IRIX.

Presentations can be used as the user interface for regular Java applications by linking the Marimba class library into your application class. Such applications are as portable as any other Java application. Standalone Bongo applications can be turned into Castanet "channels" with a single click and distributed over the Internet immediately.

Castanet is a technology for publishing and updating software applications and information over a network. Version 1.1 supports Java applications, applets, and HTML. Castanet consists of two parts: the transmitter, a special-purpose applications server, and the tuner, which resides on the client machine. The transmitter makes the applications and associated data, known as channels, available over an intranet or the Internet. The tuner, upon command, automatically downloads and installs selected channels. The coolest feature of Castanet is that upgrades to the channels are automatically downloaded and installed whenever the tuner connects to the transmitter.

Unlike many currently available interface builders, Bongo is not an AWT code-generation tool. Bongo presentations consist of a set of user-interface elements called "widgets" within a single window. The Bongo class libraries interpret the presentation file at run time and dynamically create the widget imagery. Table 1 shows the classes of widgets available in Bongo 1.0.

Most of these widgets will be familiar to users of GUI-based operating systems; a few, however, are noteworthy: Bongo explicitly recognizes the Web and the Web browser as standard parts of the desktop environment. To integrate a Bongo presentation and the user's Web browser, the Image, URL Text, URL Button, and Applet widgets can launch the system's default Web browser and instruct it to load a URL. Applet widgets allow designers to use any Java applet in their presentations. The applet runtime environment resembles that of a Web browser. The AWT Component widget allows you to use normal Java AWT components in your presentations, although Bongo has a native widget replacement for all the normal AWT components. Finally, the Presentation widget allows one presentation to load and play another. Thus, presentations can play the role of an application and of an application component similar to a Java applet.

Marimba provides the Java source code for the existing widgets, so the default widgets can be customized or replaced and incorporated into presentations just like native Bongo widgets.

Composing with Bongo

A Bongo presentation is created using a graphical user interface to select and position the widgets. Figure 1 shows the two windows used in the authoring process.

The window on the right shows a presentation under construction. Widgets are added to the presentation by selecting them from the New menu or pasting from the clipboard. Once added to the presentation, they can be dragged into position and resized with the mouse. The dashed line around the presentation window outlines the currently selected container widget. All widgets are located in a Container widget, which can hold individual widgets, other container widgets, or even another presentation. Only widgets within the currently selected container may be modified. Moving or resizing a container affects all of its widgets, simplifying editing. To select a different container, the user simply presses the Control key while clicking in the new container. Presentations are stored in a proprietary file format with a .GUI file extension.

For purposes of rendering, Bongo draws each widget as if it resided on an individual layer within its container. This allows the designer to easily and unambiguously control the appearance of the presentation. Cut, paste, resize, and delete operations on the widgets behave as you would expect, providing a familiar interface with a very short learning curve.

Unless explicitly set otherwise, widgets inherit their appearance properties from their container, and from its container, and so on, back to the base presentation widget. Widget properties can be set manually in the Bongo window (on the right in Figure 1). Each widget can be given a name to allow access to its properties from a Java-language script. The three overlapping squares on the right side of the Bongo window control the widget's foreground, fill, and background colors, and each widget can pop up a "tool tip" text message when the mouse is held over it. These features allow the interface designer to control the appearance of the presentation and don't restrict it to a specific look and feel.

Adding Scripts

Attractive presentations are nice, but they aren't very useful without the ability to do some processing. Bongo allows you to add a script to each widget that executes under certain conditions such as when the widget is clicked with the mouse. Unlike other Hypercard-like tools, Bongo has no proprietary scripting language -- it uses Java to control the presentation. The Bongo class libraries simplify the widget interface, so only the barest minimum of Java is required to create useful scripts, yet the full power of Java is available for those who need it. To attach a script to a widget, the user selects a widget in the presentation window and then clicks the Script tab in the Bongo window. The Script tab contains a simple syntax-aware editor suitable for entering short scripts. No file input or output is available from the Bongo window, so scripts must either be entered by hand or pasted into the window from the clipboard. When the user clicks the Apply button, the script is compiled by the normal javac compiler and the class is incorporated into the presentation file. Compilation errors are displayed in the small field at the bottom of the window. Double-clicking on an error message jumps the cursor to the offending line in the script. Figure 2 shows a Bongo window containing a script that uses the system clock to change the state of a Progress widget.

The script is attached to a button widget and runs whenever the button is clicked. The script can access the properties of the presentation's other widgets as well as standard Java-library methods. To trigger the script, Bongo generates a call to the action() method whenever the button is clicked and released. The action() method is the standard method Bongo uses to notify a script that a widget has been clicked, scrolled, or selected. Different widgets may require different input to generate a call to their action() methods. Bongo filters the low-level mouse and keyboard events, maintains the state of the widget properties, and updates the widget imagery.

It's quite easy to use a Bongo presentation as the interface for your standalone Java application. The Marimba class library handles the translation between the internal widget events and standard AWT events and presents these AWT events to your program. Listing One shows an application template with a Bongo presentation as the user interface.

To keep the edit-test-debug loop as short as possible, the presentation window has two modes: In Edit mode, you create and modify the presentation, while Browse mode allows you to test your presentation as if it were being run by the player utility. All scripts and widgets function normally and at full speed. This allows instant feedback on the operation of your presentation without lengthy delays for compiling and linking. The WYSIWYG editing environment and the ability to quickly switch between editing and testing makes for efficient development and a short learning curve. I easily mastered the basics of creating presentations and scripts within an hour of installing Bongo.

Sounding Out Bongo

To give Bongo a real trial, I decided to use it to create a simple application. My pretend task was to create a browser for back issues of Web Techniques, perhaps to be distributed on CD-ROM. I put together the application shown in Figure 3 in about three hours. Creating the interface took only a few minutes; the scripting was more time consuming, mostly because the Bongo documentation and Goodman's book lacked appropriate examples.

When the user selects the month and year desired, a script dynamically loads the cover image from disk and displays it in an Image widget. The table of contents is generated in a Table widget from a simple, comma-delimited text database, again via a script. By selecting an entry in the table of contents, the user can view the text of the article in a RichText widget under the Article tab. Any associated code listings are loaded into the Code tab, also in a RichText widget. Since the full java.io class library is available, creating scripts to read the table of contents, article text, and code listings from disk is no more difficult than for any Java application. Had I created this presentation as a Castanet Channel, the transmitter would have updated the database with each new issue for all users automatically via the tuner.

Sour Notes

Bongo has only a few shortcomings worth mentioning. There is no layout manager for Bongo widgets -- they must be positioned by hand, although a grid system and guidelines are included. Furthermore, the presentations do not resize well. A minimal capability is provided to anchor a widget at a fixed distance from one or two edges of the presentation, but this is a far cry from the dynamic resizing most users expect. To some extent, this shortcoming can be hidden by making the presentation non-resizable. Widget scripts don't handle AWT components with the same ease as native widgets. This is understandable, but it would be nice to use all those third-party AWT controls as easily as native widgets. The documentation provided with Bongo -- a short set of HTML pages on the Marimba Web site -- is very sparse for a product in Bongo's price range. Finally, the price seems a little high when I can get a full IDE such as Visual Cafe, including an AWT layout designer, for less than half the price.

Conclusion

Overall, however, Bongo is a good system. The authoring environment is intuitive and flexible enough for all but the most demanding interface requirements. The standalone applications are surprisingly quick and responsive compared to some native Java applications, and Bongo supports a wide range of operating systems and interface modes. Finally, the well-integrated Castanet support, both for Bongo presentations and standalone Java applications, make Bongo worth a serious look.

(Get the source code for this article here.)


Chris is an independent Web developer and programmer. He is co-author with Bob Weil of Drag 'n' Drop CGI: Enhance Your Web Site Without Programming (Addison-Wesley, 1997). He can be reached at chris@hypertising.com.




Copyright © 2003 CMP Media LLC