Intended audience: Application developers and development managers who seek to better understand XUL and why the Mozilla platform is built with it.
XUL (pronounced "zool") is Mozilla's XML-based User interface Language that lets you build feature-rich cross platform applications that can run connected or disconnected from the Internet. These applications are easily customized with alternative text, graphics and layout so they can be readily branded or localized for various markets. Web developers already familiar with Dynamic HTML (DHTML) will learn XUL quickly and can start building applications right away.
This document will describe the compelling reasons for application developers to leverage XUL and Mozilla technology for building cross platform applications. This same investigation will provide sufficient explanation of Mozilla's motivation to build XUL and why the Mozilla platform is constructed using it. The key features and benefits of XUL will be explored followed by an examination of supporting Mozilla technologies. Finally, a mini case study of a Calendar application written in XUL will reinforce the benefits of building applications with Mozilla.
Key Features and Benefits</tr></tr></tr>
|XBL||The eXtensible Bindings Language (XBL) is a markup language that defines special new elements, or "bindings" for XUL widgets. With XBL, developers can define new content for XUL widgets, add additional event handlers to a XUL widget, and add new interface properties and methods. Essentially, XBL empowers developers with the ability to extend XUL by customizing existing tags and creating new tags of their own.|
By using XBL, developers can easily build custom user interface widgets such as progress meters, fancy pop-up menus, and even toolbars and search forms. These custom components can then be used in XUL applications by specifying the custom tag and associated attributes.
|Overlays||Overlays are XUL files used to describe extra content for the UI. They are a general mechanism for adding UI for additional components, overriding small pieces of a XUL file without having to resupply the whole UI, and reusing particular pieces of the UI.
Overlays are a powerful mechanism for customizing and extending existing applications because they work in two related but highly different ways. In one respect, Overlays are synonymous with "include" files in other languages because an application may specify that an Overlay be included in its definition. But Overlays can also be specified externally, enabling the designer to superimpose them upon an application without changing the original source.
In practical terms, this enables developers to maintain one code stream for a given application then apply custom branding or include special features for customers with a completely independent code base. This leads to an overall solution that is easier and less costly to maintain in the long run.
|XPCOM/XPConnect||XPCOM and XPConnect are complementary technologies that enable the integration of external libraries with XUL applications.
|XPInstall||XPInstall, Mozilla's Cross Platform Install facility, provides a standard way of packaging XUL application components with an install script that Mozilla can download and execute.
XPInstall enables users to effortlessly install new XUL applications over the Internet or from corporate intranet servers. To install a new application the user need only click a hypertext link on a web page or in an email message and accept the new package through a Mozilla install dialog.
todo: describe cool toolkit and xul runner features
Case Study: A Mozilla Calendar Application
This mini case study describes how OEone Corporation (http://www.oeone.com) integrated its Calendar application with the core Mozilla product. The Calendar application is comprised of a XUL front end and an XPCOM component that leverages libical, a native library written in C, for date operations and calendar data storage. The Calendar was initially developed exclusively for Linux but was successfully ported to both Macintosh and Windows within a week.
Separation of presentation from logic makes applications resilient to change. The original UI implementation made extensive use of graphics for rendering the month and week views. Later, as the developers learned more about XUL and the implementation of the basic components matured, better ways were identified to simplify the composition of the UI. This lead to increased screen drawing performance and reduced memory and disk footprint requirements of the application. The UI for the month and week views was practically rewritten while the application logic remained virtually unchanged.
Fortunately an implementation of the libical library was already available for Macintosh so, with the cross platform nature of XPCOM, a Macintosh calendar implementation was working within a few days. However there was no existing Win32 port available, so developers had to undertake a porting effort to migrate libical to Windows. Within a week this too was complete and Mozilla had a working calendar for all three primary platforms: Linux, Macintosh, and Windows.
XPInstall is easy for developers and for users. The Calendar is not a planned deliverable for the Mozilla 1.0 release, and therefore is not included as a standard component in regular nightly and milestone release builds. Developers who are equipped with the software and knowledge required to compile Mozilla can set an optional environment variable and build the Calendar themselves. But many Mozilla users who want to try out the Calendar can't afford this luxury. Using XPInstall it was easy for the developers to package a version of Calendar that could be installed directly over the Internet by clicking a link.
Mozilla, featuring XUL, delivers a compelling technology for developing cross platform applications with the same rich user interface and end user experience as native desktop applications. Designers who are experienced in building web applications using W3C standard technologies can leverage this experience from the browser directly to the desktop.
Before the web became the standard for delivering applications to users across disparate desktops, this problem was solved with cross platform client-server tools. But these offerings were invariably proprietary, cost a substantial amount of money per developer, and had runtime license fees that kept you humble and tightly tethered to the vendor. Mozilla delivers much of the same value as these cross platform tools, but with an open source license.
As a rapidly maturing cross platform technology, XUL could fill an interesting void for technologies such as Java J2EE and Microsoft .Net which focus on enabling network access to distributed objects. Dynamic application logic can benefit significantly from a UI presentation layer that is standards-based, scriptable, extensible, and similarly distributable over the Internet.
XUL blurs the distinction between desktop application and Internet browser apps because it is firmly entrenched in both worlds. Some web applications will benefit from being migrated to XUL because of the enhanced UI capabilities, consistent implementation of the specification across supported platforms, and access to native resources such as shared libraries and the local file system.
Whether you need to migrate an existing web application to the desktop, are looking for a technology that will enable you to easily port your applications to multiple platforms, or want to integrate your own cool features into the browser, XUL warrants serious consideration.
- XUL Planet - Samples, Tutorials and Language-References to XUL and XBL http://www.xulplanet.com/
- Introduction to a XUL Document, Dan Matejka <email@example.com> http://www.mozilla.org/xpfe/xptoolkit/xulintro.html
- XBL - Extensible Binding Language 1.0, David Hyatt <firstname.lastname@example.org> http://www.mozilla.org/projects/xbl/xbl.html
- XBL - XML Binding Language (W3C Note), David Hyatt < email@example.com> http://www.w3.org/TR/xbl/
- XUL Overlays, Ian Oeschger <firstname.lastname@example.org> and David Hyatt <email@example.com> http://www.mozilla.org/xpfe/xptoolkit/overlays.html
- XPCOM Part 1: An introduction to XPCOM, Rick Parrish <firstname.lastname@example.org> http://www-106.ibm.com/developerworks/webservices/library/co-xpcom.html
- XPConnect (Scriptable Components), John Bandhauer <email@example.com> http://www.mozilla.org/scriptable/
- Creating New Packages for Mozilla, Ian Oeschger <firstname.lastname@example.org> http://www.mozilla.org/docs/xul/xulnotes/xulnote_packages.html
- Mozilla Calendar Project Page, maintained by Mike Potter <email@example.com> http://www.mozilla.org/projects/calendar/
Original Document Information
- Author: Peter Bojanic