This is your guide to building Internet applications and user interfaces with the Mozilla component framework, which is best known for the Firefox web browser and Thunderbird email client. Programming Firefox demonstrates how to use the XML User Interface Language (XUL) with open source tools in the framework's Cross-Platform Component (XPCOM) library to develop a variety of projects, such as commercial web applications and Firefox extensions.This book serves as both a programmer's reference and an in-depth tutorial, so not only do you get a comprehensive look at XUL's capabilities - from simple interface design to complex, multitier applications with real-time operations - but you also learn how to build a complete working application with XUL. If you're coming from a Java or .NET environment, you'll be amazed at how quickly large-scale applications can be constructed with XPCOM and XUL.Topics in Programming Firefox include: * An overview of Firefox technology * An introduction to the graphical elements that compose a XUL application * Firefox development tools and the process used to design and build applications * Managing an application with multiple content areas * Introduction to Resource Description Files, and how the Firefox interface renders RDF * Manipulating XHTML with JavaScript * Displaying documents using the Scalable Vector Graphics standard and HTML Canvas * The XML Binding Language and interface overlays to extend Firefox * Implementing the next-generation forms interface through XForms Programming Firefox......Page 1 Table of Contents......Page 6 Preface......Page 10 Why Buy This Book?......Page 11 Conventions Used in This Book......Page 12 How This Book Is Organized......Page 13 Comments and Questions......Page 15 Acknowledgments......Page 16 Mozilla to Firefox and Thunderbird......Page 18 XML History......Page 20 XSLT and XPath......Page 21 CSS......Page 22 At the Top of It All: The DOM......Page 23 Getting Started......Page 24 Supporting Tools......Page 26 MySQL......Page 27 Getting the Browser......Page 28 File Structure......Page 29 Boxes......Page 32 Adding Styling......Page 33 Box Sizes......Page 35 Flex......Page 38 Pack......Page 39 Align......Page 40 Introducing Input Controls......Page 41 Text Entry......Page 42 Menus and Toolboxes......Page 44 Lists......Page 45 Trees......Page 47 Grids......Page 49 Group Boxes......Page 51 Tab Boxes......Page 52 Splitters......Page 53 Content Display Panels......Page 55 Miscellaneous Widgets......Page 56 Helper Features......Page 57 Mozilla Style Declarations......Page 59 Pseudoproperties......Page 60 Summary......Page 61 Defining a Target Application......Page 62 Adding Logic......Page 64 JavaScript, Events, and DOM Nodes......Page 65 Interfaces......Page 66 Moving from widgets to document nodes......Page 67 Events......Page 69 Dynamic assignment of attributes......Page 70 External script files......Page 71 The event parameter......Page 73 Modifying Node Contents......Page 75 Simple Authentication Script......Page 76 XUL Input Widgets......Page 77 Modifying node styles......Page 78 Removing and adding document nodes......Page 80 Looking for the Obvious: Bad Typing......Page 85 The JavaScript console......Page 86 The console dump() command......Page 87 The DOM Inspector tool......Page 89 Summary......Page 90 Chrome Overview......Page 93 Chrome Directory Structure......Page 95 Package Registration......Page 96 XUL-to-Server Communications......Page 97 Configuring the Server......Page 98 The Client/Server Protocol......Page 100 The client-side request......Page 101 When Things Go Wrong......Page 105 Adding a Database......Page 106 Creating account tables......Page 107 Creating database user accounts......Page 109 Connecting PHP to MySQL......Page 110 Calling the MySQLi API......Page 111 Creating a XUL File to Be Served......Page 117 PHP Serving XUL......Page 118 Using PHP require()......Page 121 PHP serving XUL files......Page 122 Logic changes......Page 123 Summary......Page 124 Dividing the Display Area......Page 126 HTML Documents, Windows, and iframes......Page 130 XUL Windows and Content Type......Page 132 ......Page 134 ......Page 136 Event phases......Page 139 Synchronizing Interface Widgets and Frames......Page 142 Adding state transitions......Page 143 An event handler too many......Page 147 Responding to the “right” event target......Page 148 Managing events in iframes......Page 149 Adding Pull-Down Menus......Page 150 Operating system caveats......Page 154 Adding Dialog Windows......Page 155 Summary......Page 169 Tree Structure......Page 171 Different Types of Tree Content......Page 176 Selecting Tree Items......Page 177 Parsing ranges......Page 179 RDF tags and attributes......Page 180 Templates (simple form)......Page 183 Hierarchical output......Page 185 Adding rules......Page 189 Formal RDF terminology......Page 192 Using Templates for Conditional Processing......Page 197 IDs and URIs......Page 199 Template forms: Summary......Page 204 Modifying Datasources......Page 205 RDF Statements: A Closer Look......Page 206 RDF Interfaces and Services......Page 207 Accessing datasources......Page 208 Modifying datasources: Creating and removing RDF statements......Page 210 Removing resources and containers......Page 211 Adding dialogs......Page 213 Tying Everything Together......Page 218 Summary......Page 237 A Design Review......Page 238 Properties and Native Wrappers......Page 239 Selection and Range Objects......Page 241 Manipulating Selections and Ranges......Page 243 Moving Text Between Frames......Page 244 File Services......Page 248 Selecting a destination file......Page 249 Writing document content to a file......Page 250 Emailing Note Document Contents......Page 252 Mixing XUL and HTML......Page 253 Synthesizing DOM events......Page 254 Adding Interactivity to DOM Elements......Page 256 Summary......Page 280 Graphics......Page 281 A Sample Graphing Project......Page 282 File type and content type......Page 283 SVG Overview......Page 284 Appearance Properties......Page 285 Transform, Translate, and Scale......Page 286 The source document......Page 289 A transformation stylesheet......Page 292 The resulting XHTML file......Page 298 Style Information......Page 303 Adding Interactivity......Page 304 Canvas Drawing......Page 309 Program algorithm......Page 310 Program Code......Page 311 Summary......Page 316 Overlay Files......Page 318 Overlay File Structure......Page 319 Dynamic loading......Page 322 Overlays and the Browser......Page 323 Adding Logic......Page 325 XBL Structure......Page 329 XBL Content......Page 331 Passing attributes to XBL content......Page 332 Implementation......Page 333 Event Handlers......Page 335 An Expanded Example......Page 336 HTTP Request Widget......Page 338 Extending Bindings......Page 343 Summary......Page 350 XForms......Page 351 Basic XForms Structure......Page 352 The Stylesheet......Page 353 The Server Script......Page 354 An Overview of an XForms Document......Page 355 Pseudoclasses and Conditional Styling......Page 358 Pseudoclasses......Page 360 Data validation......Page 361 Calculating field values......Page 369 Relevant and conditional appearance......Page 371 User Interface Elements......Page 372 Repeating Interface Markup......Page 373 XML Events......Page 376 XForms Actions......Page 378 Dynamic Insertion and Removal of Entries......Page 380 Changes in Form Structure......Page 386 Summary......Page 390 Installation and Deployment......Page 391 XULRunner Applications......Page 392 Downloading XULRunner......Page 393 Hiworld in a directory......Page 395 Building necessary startup files......Page 396 File Structure......Page 399 Creating the Stylesheet......Page 401 Registering the Skin......Page 402 Setting Up for Locale Development......Page 403 DTD and entity mapping......Page 404 Moving to JAR files......Page 405 Extension Interfaces: Overlays Revisited......Page 408 Filesystem implementation......Page 409 String bundles......Page 410 String bundles in overlays......Page 411 Installation Manifest: install.rdf......Page 412 Extensions and the Manifest File......Page 414 Installing and Testing......Page 415 Were the Files Installed?......Page 417 Chrome Problems......Page 418 Integration Problems......Page 419 Summary......Page 420 Browser Package Files......Page 422 Following the Files......Page 423 JavaScript Widgets, Attributes, and Properties......Page 427 nsISomeInterfaceName......Page 428 nsIDOMXULControlElement......Page 429 nsIDOMXULElement......Page 430 nsIDOMXULMenuListElement......Page 431 nsIDOMXULPopupElement......Page 432 nsIDOMXULTextboxElement......Page 433 widget_element (the XUL tag used for an interface element)......Page 434 Common attributes, properties, and methods......Page 435 arrowscrollbox......Page 436 browser......Page 437 button......Page 438 caption......Page 439 colorpicker......Page 440 dialog......Page 442 editor......Page 443 grippy......Page 444 image......Page 445 label......Page 446 listbox......Page 447 listhead......Page 449 listitem......Page 450 menuitem......Page 451 menulist......Page 452 menupopup......Page 453 prefwindow......Page 454 radio......Page 455 richlistbox......Page 456 scrollbox......Page 457 statusbar......Page 458 tab......Page 459 tabbrowser......Page 460 tabs......Page 462 textbox......Page 463 titlebar......Page 464 toolbarbutton......Page 465 toolbarspacer......Page 466 tooltip......Page 467 tree......Page 468 treecols......Page 469 window......Page 470 wizard......Page 474 wizardpage......Page 475 button-base......Page 476 menuitem-base......Page 477 toolbar-base......Page 478 wizard-base......Page 479 XUL Widgets: Attributes, Properties, and Methods......Page 480 Index......Page 496 This is your guide to building Internet applications and user interfaces with the Mozilla component framework, which is best known for the Firefox web browser and Thunderbird email client. Programming Firefox demonstrates how to use the XML User Interface Language (XUL) with open source tools in the framework's Cross-Platform Component (XPCOM) library to develop a variety of projects, such as commercial web applications and Firefox extensions.This book serves as both a programmer's reference and an in-depth tutorial, so not only do you get a comprehensive look at XUL's capabilities--from simple interface design to complex, multitier applications with real-time operations--but you also learn how to build a complete working application with XUL. If you're coming from a Java or .NET environment, you'll be amazed at how quickly large-scale applications can be constructed with XPCOM and XUL.Topics in Programming Firefox include:An overview of Firefox technologyAn introduction to the graphical elements that compose a XUL applicationFirefox development tools and the process used to design and build applicationsManaging an application with multiple content areasIntroduction to Resource Description Files, and how the Firefox interface renders RDFManipulating XHTML with JavaScriptDisplaying documents using the Scalable Vector Graphics standard and HTML CanvasThe XML Binding Language and interface overlays to extend FirefoxImplementing the next-generation forms interface through XFormsProgramming Firefox is ideal for the designer or developer charged with delivering innovative standards-based Internet applications, whether they're web server applications or Internet-enabled desktop applications. It's not just a how-to book, but a what-if exploration that encourages you to push the envelope of the Internet experience. This is your guide to building Internet applications and user interfaces with the Mozilla component framework, which is best known for the Firefox web browser and Thunderbird email client. Programming Firefox demonstrates how to use the XML User Interface Language (XUL) with open source tools in the framework's Cross-Platform Component (XPCOM) library to develop a variety of projects, such as commercial web applications and Firefox extensions. This book serves as both a programmer's reference and an in-depth tutorial, so not only do you get a comprehensive look at XUL's capabilities--from simple interface design to complex, multitier applications with real-time operations--but you also learn how to build a complete working application with XUL. If you're coming from a Java or .NET environment, you'll be amazed at how quickly large-scale applications can be constructed with XPCOM and XUL. Topics in Programming Firefox Programming Firefox is ideal for the designer or developer charged with delivering innovative standards-based Internet applications, whether they're web server applications or Internet-enabled desktop applications. It's not just a how-to book, but a what-if exploration that encourages you to push the envelope of the Internet experience. "This is your guide to building Internet applications and user interfaces with the Mozilla component framework, which is best known for the Firefox web browser and Thunderbird email client. Programming Firefox demonstrates how to use the XML User Interface Language (XUL) with open source tools in the framework's Cross-Platform Component (XPCOM) library to develop a variety of projects, such as commercial web applications and Firefox extensions." "This book serves as both a programmer's reference and an in-depth tutorial, so not only do you get a comprehensive look at XUL's capabilities - from simple interface design to complex, multitier applications with real-time operations - but you also learn how to build a complete working application with XUL. If you're coming from a Java or .NET environment, you'll be amazed at how quickly you can construct large-scale applications with XPCOM and XUL." "Programming Firefox is ideal for the designer or developer charged with delivering innovative standards-based Internet applications. It's not just a how-to book, but a what-if exploration that encourages you to push the envelope of the Internet experience."--Jacket