Learn about XUL, a subset of XML used to describe user interfaces, that helps you to make rich user interfaces with nothing more complicated than a text editor. In the fourth part of this series you will learn about dialog boxes and wizards.
Aside from some other, more advanced elements which will be discussed later on, the elements looked at so far are pretty much all of the elements that actually draw the various things that make up an interface on the screen. There are, however, a couple of advanced elements that not only render objects on the screen, but also include built in functionality. These elements are used in place of the window element and create different types of window.
They are of course, dialog boxes and wizards. Using these alternative windows is not as simple as the other elements we have looked at so far; simply creating them and executing them via the command line will not make them work correctly. In order to use these advanced elements, you will need to create an RDF file that describes them and register them with Mozilla.
RDF, as mentioned previously, stands for Resource Description Framework, and is used, of course, to describe resources. Those resources are defined using URIs and may be Web locations or file system locations. The basic building block of RDF is the triple, a three part description comprising an object, a subject and the relationship between them. The concept of triples has been around for some time; if you’ve ever used the <meta> tag in an HTML document you’ve authored to add your name as the author or creator of the document, you’ve used a triple. You have the object, which is the HTML document; you have the subject, namely yourself; and you have a piece of information (called a predicate) that describes your relationship to the Web page –- the meta name value that says author (or creator). Graphs can be displayed visually using an arc-node diagram with the predicate pointing towards the object:
This very basic arc-node graph example contains two literals or actual values, something that should never happen in RDF; I have drawn it in this way purely as an example. Instead, the object or subject (or both) should be described as a resource by using a URI:
To show that the object is a literal, I have placed its value into a rectangular rather than oval container. It is worth noting at this point that predicates can also be expressed as resources using a URI. Almost anything can be described using RDF, provided it is something that has some kind of relationship with something else and can be expressed via a unique URI. This is just the very basics of RDF, a brief overview if you like, which I have included simply because you’ll need an RDF file to produce working wizards and dialogue boxes. There are some excellent resources out there if you want to learn more. A good place to start is the W3C site (www.w3.org), or the Mozilla site (www.mozilla.org).