Having recently picked up a copy of Creating Applications with Mozilla on one of my occasional hit-and-run attacks on Amazon, I’ve been tinkering a bit with XUL to see how easy it is to build applications.
This is part of some ongoing tinkering I’ve been doing to look at ways to quickly prototype user interfaces. My immediate interest is to decide on a toolkit for building internal administration tools for work, but I’d like to try out creating client-side user interfaces for web applications/services in general.
I initially looked at XUL, and the Luxor toolkit but decided against them as the docs weren’t brilliant, and they were more complex than I wanted: I need something as simple as possible. I then picked up Thinlets and have been quite pleased. I’ve been building the FOAF-a-Matic Mark 2 using that framework and found it to quick and easy to use.
I’ve been teaching an introductory Java course for Bath University’s Community Course programme — I did one last term, and am half way through my second. As part of the preparation for this I took another look at Swing and found it was less horrid than I’d remembered. So I also ended building some code which I’ll release some day which is basically a Swing application framework, complete with a fledgling plugin system, and the Bean Scripting Framework for extra scripting goodness. I plan to add support for plugging in thinlets and probably applets as well. So the research has been is bearing fruit in various directions. And most importantly I’ve had some fun along the way. Until now anyway.
I came back to XUL once more via a rekindled interest in “smart browsing“. I’m interested in further automating the browser to do cool stuff ™ with all that metadata that web pages, blogs especially, are integrating these days. So, after poking around in my Mozilla installation a bit I decided it was time to find out exactly what XUL, XPCOM, XBL, etc were all about. Hence the book purchase.
Now, while the Creating Apps book has answered a lot of questions, its also raised a whole lot more. I’ve found it to be a rather infuriating read as it covers a lot of ground very quickly, so I’m left going back to the web, e.g. XUL Planet to get them answered. XUL is itself worthy of a book, even a Nutshell book, IMO.
The chapters on XUL Templates and Mozilla’s RDF support have left me on the one hand quite excited about the possibilities lurking beneath the covers of Mozilla, but on the other tearing my hair out with frustration as there are a lot of problems with the book. There are mistakes in the examples, diagrams are in correctly referenced, and in one case several pages were devoted to walking through an example of how to process some RDF data without actually showing the underlying data first.
There are corrections on the O’Reilly site, corrections on the Mozilla site, reader corrections in the per chapter comments, as well as bug reports. But no single unified place to check them all. I’m left running around double-checking everything. Even more frustratingly the example application, xFly, which has its own Mozilla project hasn’t been updated to include all the examples from the book! They are available as text files but you need to manually integrate them with the app (should you want to bother) or apply the corrections yourself. Not a good situation given the book was published September 2002.
This all lead me to conclude that the examples weren’t thoroughly tested, and had me questioning the wisdom of purchasing the book at all. But perhaps I’m being unfair as it may be that they’ve been trying to hit a moving target all along.
For example last night I spent several hours trying to apply sorting to a XUL tree element. The Creating Apps book uses the sort attribute in an example, but doesn’t explain it. I’ve since got that example running, but the sorting doesn’t actually work. Ooops. So I check the RDF docs on the Mozilla site and see that the XUL template primer has an example that uses the same syntax. Stumped again. The full XUL template reference, which is apparently outdated, has a “To Be Done” in the sorting section. Oh dear. So I check the XULPlanet tutorial and discover that uses a completely different syntax for the value of the sort attribute, and defines a couple of others to boot. This doesn’t work either. I even ended up fishing into the XUL for Mozilla itself to see how it did it (same as the XULPlanet tutorial). Still no joy. Googling doesn’t return any useful hits beyond the documents referenced above. This doesn’t bode well so I’m wondering whether to go any further at all.
But, if someone knows how to get sorting to work in a tree I’d appreciate some help.
And if anyone has built a complete working version of the xFly sample application from the Creating Apps book I’d appreciate a copy. And no doubt so would the authors.