RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Build Rich, Thin Client Applications Automatically Using XML : Page 2

There are new products afoot that let you do highly graphical client-side applications without the performance headaches of applets or the security concerns of ActiveX. Find out what these XWT-based technologies can do.

Inspecting Bambookit
There are too many initiatives out there to cover them all in this article, and more are being added daily. Some of the better known ones are XUL (XML User interface Language) and XWT (XML Windowing Toolkit) in the open source community, and Bambookit—a commercial offering. Links to various implementations are included at the end of this article.

Bambookit is a particularly impressive implementation as it is very easy to use and gives some great functionality and the ability to build complex, visually appealing, and high-performing user interfaces.

The XML file below draws a simple Bambookit GUI, containing a combo box:

<?xml version="1.0"?>
<Widget setSize="489,250" setLayout="iconviewx,120,25,0">
     <Combobox setLabel="Countries">
           <Listbox setWidth="120">
                 <Item setLabel="United States"/>
                 <Item setLabel="Canada"/>
                 <Item setLabel="Mexico"/>
                 <Item setLabel="Bermuda"/>
                 <Item setLabel="Bahamas"/>
To create the demo user interface in this article, download the evaluation of Bambookit from their Web site. This implementation is fully functional except that you cannot host Bambookit user interfaces from a Web server with it. Once you have downloaded it, unzip it to a directory named c:\bambookit on your hard drive.

Save the XML file above as combobox.xml in the c:\bambookit directory and then create an HTML file called combobox.html in the same directory containing the following code:

<applet archive="bamboo_20.jar" code="Loader.class" width=489 height=250>
<param name="loadgui" value="combobox.xml">
<param name="archive" value="bamboo_20.jar">
This code simply loads the runtime rendering engine of Bambookit from the JAR file bamboo_20.jar and points it at the xml file containing the definition of the desired user interface. The line of code that handles this operation is:

<param name="loadgui" value="combobox.xml">
The user interface generated from the above code is shown in Figure 1.
Figure 1. A Bamboo Combo Box. : Here is a simple user interface rendered with Bambookit.

This is a pretty simple demonstration, showing off how one can begin to build user interfaces with the toolkit. There are many more widgets available that can be used to build an interface with all the standard controls, text boxes, check boxes, buttons, tabbed dialogs, lists, treeviews, tables, and many more.

One thing that is very cool about Bambookit is that this loadgui parameter may point at a Web server, calling a service that delivers this XML. This may be a Web service (provided it gives a HTTP-Get interface), a servlet, an ASP or JSP page, or even a PHP script.

To change the source for your GUI, simply change the value attribute to point at your desired source file.

<param name="loadgui" value="http://localhost/xml.php">
In this case you would replace the http://localhost/xml.php reference with whatever your actual service is. This opens up the possibility of automatically generating UI code from a server-side process.

For example, in the XML from the sample app above, the specifics of the contents of the combo box could be pulled from a database and returned as Bambookit format XML by, for example a Web service, a servlet, or a PHP script.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date