Building with XUL


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Good afternoon ladies and gentleman, my name is Ben Goodger and I’m the lead engineer of the Mozilla Firefox browser. I currently work for Google in Mountain View California. I’m here to talk to you today about XUL, the XML User Interface Language that we built Firefox with. I’m going to give you a brief run through of what XUL is, the benefits it has, show you a little of what developing with XUL and the Mozilla platform looks like, and give you some demos. I’ll also tell you what we’re doing with XUL this year and in the future. At the end there’ll be some time for Q&A.
  • Building with XUL

    1. 1. <ul><li>Building with XUL </li></ul><ul><li>Ben Goodger </li></ul><ul><li>Software Engineer, Google Inc. </li></ul>
    2. 2. What is XUL? <ul><li>XUL is a powerful language that lets you quickly develop client software </li></ul><ul><li>XUL is used by Mozilla Firefox, Thunderbird and other software projects. </li></ul>
    3. 3. What can XUL do? <ul><li>Extensions (to Firefox, Thunderbird, other applications) - BugMeNot, AdBlock, MiniT, Sage, Enigmail, etc. </li></ul><ul><li>Applications (like Firefox, Thunderbird, etc) </li></ul>
    4. 4. XUL Features <ul><li>XML Syntax </li></ul><ul><li>Flexible Box Model </li></ul><ul><li>Wide array of application controls </li></ul><ul><li>Data binding </li></ul><ul><li>Rich set of platform services </li></ul><ul><li>Development supported across numerous platforms </li></ul><ul><li>Scripting and flexibility with implementation language </li></ul><ul><li>Tools for section 508 accessibility compliance </li></ul><ul><li>Localizability </li></ul><ul><li>Tested and deployed to millions of people </li></ul>
    5. 5. Where is XUL going? <ul><li>XUL2.0 (API polish) </li></ul><ul><li>XULRunner </li></ul><ul><li>Standardization (via: WHATWG: datagrid, etc, W3C: XUL Box Model in CSS) </li></ul>
    6. 6. A Simple XUL Demo
    7. 7. What does XUL look like? <ul><li><?xml version=&quot;1.0&quot;?> </li></ul><ul><li><?xml-stylesheet href=&quot;chrome://global/skin/&quot;?> </li></ul><ul><li><window id=&quot;test&quot; </li></ul><ul><li>xmlns=&quot;; </li></ul><ul><li>title=&quot;Hello, World!&quot;> </li></ul><ul><li><script type=&quot;application/x-javascript&quot; src=&quot;test.js&quot;/> </li></ul><ul><li><vbox flex=&quot;1&quot;> </li></ul><ul><li><listbox id=&quot;itemlist&quot; flex=&quot;1&quot;> </li></ul><ul><li><listitem label=&quot;Item 1&quot;/> </li></ul><ul><li><listitem label=&quot;Item 2&quot;/> </li></ul><ul><li></listbox> </li></ul><ul><li><hbox> </li></ul><ul><li><textbox id=&quot;labelfield&quot; flex=&quot;1&quot; </li></ul><ul><li>oninput=&quot;validateInput();&quot;/> </li></ul><ul><li><button id=&quot;addButton&quot; label=&quot;Add Item&quot; </li></ul><ul><li>disabled=&quot;true&quot; oncommand=&quot;addItem();&quot;/> </li></ul><ul><li></hbox> </li></ul><ul><li></vbox> </li></ul><ul><li></window> </li></ul>
    8. 8. Making XUL Live <ul><li>function addItem() { </li></ul><ul><li>var listbox = document.getElementById(&quot;itemlist&quot;); </li></ul><ul><li>var listitem = document.createElement(&quot;listitem&quot;); </li></ul><ul><li>var labelfield = document.getElementById(&quot;labelfield&quot;); </li></ul><ul><li>listbox.appendChild(listitem); </li></ul><ul><li>listitem.label = labelfield.value; </li></ul><ul><li>labelfield.value = &quot;&quot;; </li></ul><ul><li>validateInput(); </li></ul><ul><li>labelfield.focus(); </li></ul><ul><li>} </li></ul><ul><li>function validateInput() { </li></ul><ul><li>var field = document.getElementById(&quot;labelfield&quot;); </li></ul><ul><li>var button = document.getElementById(&quot;addButton&quot;); </li></ul><ul><li>button.disabled = field.value == &quot;&quot;; </li></ul><ul><li>} </li></ul>
    9. 9. Adding Visual Panache <ul><li>Visual style is added using CSS </li></ul><ul><li>Icons, colors, backgrounds </li></ul><ul><li>Themes </li></ul>
    10. 10. Making your XUL Application Live <ul><li>Networking </li></ul><ul><li>File I/O </li></ul><ul><li>Preferences </li></ul><ul><li>Web Services </li></ul><ul><li>Extensions </li></ul>
    11. 11. Extending XUL <ul><li>XBL is Mozilla’s Extensible Binding Language </li></ul><ul><li>Create new elements by using others </li></ul><ul><li>Develop element node apis </li></ul><ul><li><binding id=“mytag”> <content> <xul:hbox> <xul:button label=“Button 1”/> <xul:button label=“Button 2”/> </xul:hbox> </content> <implementation> <constructor> alert(“foo”); </constructor> </implementation> </binding> </li></ul>
    12. 12. Building XUL Extensions <ul><li>Changing the UI - overlaying the DOM - executing script </li></ul>
    13. 13. A XUL Extension to Firefox <ul><li>Adds Session History Strip above browser </li></ul><ul><li>Thumb strip added using XUL overlays </li></ul><ul><li>Uses <canvas> to render page thumbnails </li></ul>
    14. 14. Packaging XUL Extensions <ul><li>Extension Bundle </li></ul><ul><li>UI </li></ul><ul><li>Components </li></ul><ul><li>Defaults </li></ul><ul><li>Housekeeping </li></ul>
    15. 15. Packaging XUL Applications <ul><li>Application Bundle </li></ul><ul><li>UI </li></ul><ul><li>Components </li></ul><ul><li>Defaults </li></ul><ul><li>Housekeeping </li></ul>
    16. 16. Resources <ul><li> </li></ul><ul><li>news:// </li></ul><ul><li>irc:// #developers </li></ul><ul><li>Rapid Application Development with Mozilla </li></ul><ul><li>Firefox Hacks </li></ul>
    17. 17. Why Use XUL <ul><li>Rapid development </li></ul><ul><li>Easy to learn </li></ul><ul><li>Rich platform services especially for internet applications </li></ul><ul><li>Localizable, accessibility compliant </li></ul><ul><li>Small application size when targeting deployed XULRunner </li></ul><ul><li>Platform deployed to millions of users </li></ul>
    18. 18. Questions?