Book Contents

Table of Contents

Ch.Chapter NamePage #
SubchapterSubchapter Title
SubsectionSubsection Title

Acknowledgmentsxix Introductionxxi 1Fundamental Concepts1 1.1Understanding Mozilla Product Names2 1.1.1Platform Versions4 1.1.2Example Applications5 1.1.3Jargon Buster7 1.2The XML Environment8 1.2.1Common Underlying Format9 1.2.2The Open-Closed Principle9 1.2.3Beyond English10 1.2.4Hierarchical Thinking10 1.3Platform Concepts11 1.3.1Architecture11 1.3.2Innovations17 1.3.3Consequences21 1.4The RAD Environment23 1.4.1Less Time, Same Effect24 1.4.2Visual Prototypes24 1.4.3Vertical Solutions24 1.4.4COTS Software Versus Home Grown25 1.4.5Destructured Testing25 1.5Effective RAD Projects with Mozilla25 1.6Hands On: Cranking Up the Platform27 1.6.1Installation27 1.6.2Command Line Options28 1.6.3Chrome Directories and the Address Book28 1.6.4"hello, world"33 1.6.5NoteTaker Preparation34 1.7Debug Corner: Debugging from Outside35 1.7.1Important Preferences35 1.7.2Multiwindow Development37 1.7.3Compile-Time Options39 1.8Summary39 2XUL Layout41 2.1XUL Means Boxes43 2.2Principles of XUL Layout44 2.2.1Displaying a Single Tag46 2.2.2Displaying Multiple Tags47 2.2.3Common Box Layout Attributes49 2.2.4Frame and Style Extension Concepts51 2.3Box Layout Tags54 2.3.1Boxes54 2.3.2Flex and Spacers55 2.3.3Stacks and Decks58 2.3.4Grids61 2.4A Box Improvement: <groupbox> and <caption>64 2.5General-Purpose XUL Attributes65 2.6Good Coding Practices for XUL66 2.7Style Options69 2.8Hands On: NoteTaker Boilerplate71 2.8.1The Layout Design Process71 2.8.2Completing Registration74 2.9Debug Corner: Detecting Bad XUL75 2.9.1Warnings and Silence76 2.9.2Debug Springs and Struts77 2.10Summary79 3Static Content81 3.1XUL and HTML Compared82 3.2XUL Content Tags84 3.2.1Text and Strings84 3.2.2Images and <image>87 3.2.3Border Decorations89 3.3Understanding Font Systems89 3.4Style Options92 3.5Hands On: NoteTaker Boilerplate95 3.5.1Adding Text95 3.5.2Configuring and Using Locales97 3.6Debug Corner: The DOM Inspector99 3.7Summary101 4First Widgets and Themes103 4.1What Makes a Button a Button?105 4.2The Origins of XUL Widgets107 4.2.1Split Widget Design108 4.3XUL Buttons109 4.3.1Five Fundamental Buttons109 4.3.2Button Variations115 4.3.3Grippys116 4.3.4Labels and <label>119 4.3.5Bits and Pieces120 4.4Themes and Skins121 4.4.1Mozilla Themes122 4.4.2Mozilla Skins123 4.4.3The Stylesheet Hierarchy125 4.4.4Native Themes126 4.4.5Theme Sampler128 4.4.6GTK and X-Windows Resources129 4.5Style Options129 4.6Hands On: NoteTaker Buttons and Themes130 4.7Debug Corner: Diagnosing Buttons and Skins133 4.8Summary135 5Scripting137 5.1JavaScript's Role as a Language139 5.2Standards, Browsers, and <script>140 5.3ECMAScript Edition 3141 5.3.1Syntax141 5.3.2Objects152 5.3.3Processing Concepts158 5.4Language Enhancements162 5.4.1Mozilla SpiderMonkey Enhancements162 5.4.2ECMA-262 Edition 4 Enhancements163 5.4.3Security Enhancements163 5.5Mozilla's Scriptable Interfaces164 5.5.1Interface Origins165 5.5.2W3C DOM Standards166 5.5.3Mozilla AOMs and BOMs173 5.5.4XPCOM and XPConnect175 5.5.5Scripting Libraries181 5.5.6XBL Bindings184 5.5.7Island Interfaces185 5.6Hands On: NoteTaker Dynamic Content186 5.6.1Scripting <deck> via the DOM186 5.6.2Alternative: Scripting Styles via the DOM188 5.6.3Alternative: Scripting <deck> via the AOM and XBL189 5.6.4Reading String Bundles via XPCOM190 5.7Debug Corner: Script Diagnosis193 5.8Summary195 6Events197 6.1How Mozilla Handles Events199 6.1.1Scheduling Input and Output199 6.1.2The DOM Event Model204 6.1.3Timed Events208 6.1.4Broadcasters and Observers210 6.1.5Commands216 6.1.6Content Delivery Events217 6.2How Keystrokes Work217 6.2.1Where Key Events Come From219 6.2.2What Keys Are Available220 6.2.3<keybinding>, <keyset>, and <key>221 6.2.4The XUL accesskey Attribute223 6.2.5Find As You Type (Typeahead Find)223 6.3How Mouse Gestures Work223 6.3.1Content Selection224 6.3.2Drag and Drop227 6.3.3Window Resizing229 6.3.4Advanced Gesture Support229 6.4Style Options229 6.5Hands On: NoteTaker User Input230 6.6Debug Corner: Detecting Events235 6.6.1Diagnosing Key Problems235 6.7Summary236 7Forms and Menus239 7.1XUL and HTML Forms Compared240 7.2Where to Find Information on Menus242 7.3Forms242 7.3.1Form Concepts243 7.3.2Simple XUL Form Tags245 7.3.3Form Submission247 7.4Menus250 7.4.1<menuitem>252 7.4.2<menuseparator>253 7.4.3<arrowscrollbox> and <scrollbox>254 7.4.4<menupopup>254 7.4.5<menu>255 7.4.6<menulist>256 7.4.7Menu Variations256 7.5Style Options256 7.5.1CSS Styles from HTML Forms257 7.5.2Custom Widget Display Types258 7.6Hands On: NoteTaker Events and Forms258 7.7Debug Corner: Diagnosing Events and Forms261 7.7.1Unpopping Menus261 7.7.2Picking Apart Complex Widgets262 7.7.3Finding Object Properties for Forms and Menus263 7.8Summary263 8Navigation265 8.1Navigation Systems266 8.1.1Visual Versus Recipe Navigation267 8.1.2The Focus Ring268 8.1.3The Menu System269 8.1.4Accessibility269 8.2Navigation Widgets270 8.2.1Scrolling Widgets271 8.2.2Toolbars275 8.2.3Menu Bars278 8.2.4Statusbars280 8.2.5Title Bars281 8.2.6Displaying Multiple Panels282 8.2.7Special-Purpose Widgets288 8.3Style Options289 8.4Hands On: NoteTaker Toolbars and Tabs289 8.5Debug Corner: Navigation Problems292 8.6Summary293 9Commands295 9.1Commands and Mozilla296 9.1.1Hello, World297 9.2Command Concepts298 9.2.1The Functor Pattern299 9.2.2The Command Pattern and Controllers300 9.2.3Controller Sites303 9.2.4Dispatchers and Dispatching303 9.2.5Change Notifications304 9.3How Commands Are Started305 9.3.1A Virtuous Circle306 9.4Using Commands Via XUL307 9.4.1<command> and command=307 9.4.2commandupdater="true" and oncommandupdate=308 9.4.3<commandset> and <commands>309 9.5Using Commands Via the AOM310 9.5.1How to Make a Widget Reflect Command State312 9.6Commands and XPCOM Components314 9.7Existing Commands316 9.8Style Options317 9.9Hands On: Command Design317 9.10Debug Corner: Catching Unexpected Commands322 9.11Summary323 10Windows and Panes325 10.1Ordinary <window> Windows326 10.2Popup Content327 10.2.1Defining Popup Content327 10.2.2Flyover Help/Tooltips328 10.2.3Context Menus329 10.3Dialog Boxes329 10.3.1<dialog>330 10.3.2<dialogheader>332 10.3.3<wizard>332 10.3.4Java, JavaScript, and Others332 10.4JavaScript Window Creation332 10.4.1Navigator Versus Chrome Windows333 10.4.3window.openDialog()335 10.4.4window.content, id="content" and loadURI()336 10.4.5alert(), confirm(), and prompt()337 10.4.6nsIPromptService338 10.4.7Special-Purpose XPCOM Dialog Boxes339 10.5Embedding Documents in Panes340 10.5.1<iframe>340 10.5.2<page>342 10.5.3<editor>342 10.5.4<browser>343 10.5.5<tabbrowser>343 10.5.6<IFRAME>,<iframe> and <FRAME>,<frame>344 10.5.7Non-Tags344 10.6Mixing Documents344 10.6.1Mixing XML Document Types344 10.6.2Mixing XUL Documents345 10.7Managing Existing Windows346 10.8Style Options347 10.9Hands On: NoteTaker Dialogs349 10.10Debug Corner: Diagnostic Windows357 10.11Summary359 11RDF361 11.1Mozilla Uses of RDF364 11.2Learning Strategies for RDF365 11.3A Tutorial on Facts366 11.3.1Facts Versus Data Structures366 11.3.2Predicates and Triples369 11.3.3Three Ways to Organize Facts372 11.3.4Facts About Facts375 11.3.5Queries, Filters, and Ground Facts378 11.4RDF Syntax379 11.4.1Syntax Concepts380 11.4.2<RDF>385 11.4.3<Description>386 11.4.4Predicate/Property Tags388 11.4.5<Seq>, <Bag>, <Alt>, and <li>390 11.5RDF Examples393 11.5.1A URL Example: The Download Manager393 11.5.2Using URNs for Plain Data394 11.5.3A URN Example: MIME Types396 11.5.4RDF Application Areas397 11.6Hands On: NoteTaker: Data Models398 11.7Debug Corner: Dumping RDF407 11.8Summary408 12Overlays and Chrome411 12.1Overlays413 12.1.1Overlay Tags414 12.1.2Overlay Discovery415 12.1.3The Merging Process420 12.2The Chrome Registry424 12.3Persisting Window State428 12.4Related AOM and XPCOM Objects429 12.5Hands On: The NoteTaker Toolbar429 12.6Debug Corner: Overlay Tips432 12.7Summary433 13Listboxes and Trees435 13.1Text Grids436 13.2Listboxes438 13.2.1Visual Appearance438 13.2.2Construction439 13.2.3<listbox>443 13.2.4<listcols>443 13.2.5<listcol>444 13.2.6<listhead>444 13.2.7<listheader>444 13.2.8<listitem>445 13.2.9<listcell>446 13.2.10RDF and Sorting446 13.2.11User Interactions446 13.2.12AOM and XPCOM Interfaces447 13.3Trees449 13.3.1Visual Appearance450 13.3.2Construction451 13.3.3<tree>454 13.3.4<treecols>454 13.3.5<treecol>455 13.3.6<treechildren>456 13.3.7<treeitem>456 13.3.8<treeseparator>457 13.3.9<treerow>457 13.3.10<treecell>457 13.3.11<treerows> and <treecolpicker>458 13.3.12Nontags458 13.3.13RDF and Sorting458 13.3.14User Interactions458 13.3.15AOM and XPCOM Interfaces460 13.4Style Options468 13.4.1<listbox>469 13.4.2<tree>469 13.4.3Native Theme Support472 13.5Hands On: NoteTaker: The Keywords Panel473 13.5.1Laying Out <listbox> and <tree>473 13.5.2Systematic Use of Event Handlers476 13.5.3Data-Driven Listboxes and Trees481 13.6Debug Corner: Making <listbox> and <tree> Work493 13.7Summary494 14Templates497 14.1An Example Template: Hello, World499 14.2Template Concepts501 14.2.1RDF Queries and Unification501 14.2.2XUL Content Generation512 14.2.3JavaScript Access515 14.2.4The Data Source Issue516 14.3Template Construction517 14.3.1Special XUL Names518 14.3.2The Base Tag520 14.3.3<template>526 14.3.4<rule>526 14.3.5<conditions>529 14.3.6<bindings>531 14.3.7<action> and Simple Syntax Content532 14.4Common Query Patterns534 14.4.1Containers534 14.4.2Single-Fact Queries535 14.4.3Property Set535 14.4.4Singleton Solution536 14.4.5Tree Queries537 14.4.6Unions539 14.4.7Illegal Queries539 14.5Template Lifecycle539 14.6Scripting541 14.6.1Guidelines for Dynamic Templates541 14.6.2AOM and XPCOM Template Objects542 14.6.3Builders543 14.6.4Views544 14.6.5Delegates544 14.6.6Common Scripting Tasks545 14.7Style Options546 14.8Hands On: NoteTaker Data Made Live546 14.8.1Creating Test Data547 14.8.2Simple Templates for Form Elements549 14.8.3An Extended Syntax Template for <listbox>552 14.8.4An Extended Syntax Template for <tree>553 14.8.5Coordinating and Refreshing Template Content556 14.9Debug Corner: Template Survival Guide559 14.9.1Building Up a Template560 14.10Summary561 15XBL Bindings563 15.1Binding Concepts565 15.1.1An Example Binding565 15.1.2Standards567 15.1.3Relationship with DOM Hierarchies568 15.1.4Default Actions568 15.1.5Object-like Features569 15.1.6XBL Component Framework572 15.2Constructing One XBL Binding572 15.2.1Bound Tags and -moz-binding573 15.2.2<bindings>574 15.2.3<binding>574 15.2.4<resources>575 15.2.5<content>576 15.2.6<implementation>581 15.2.7<handlers>588 15.2.8Non-tags and Non-attributes590 15.3Combining Multiple Bindings591 15.3.1Simple Inheritance with extends=591 15.3.2Zero Content Bindings592 15.3.3Input Façade Bindings593 15.3.4Inner Content Bindings594 15.4How Bindings Are Processed594 15.5Scripting595 15.6Style Options598 15.7Hands On: The <noteplacer> Tag598 15.7.1Designing Widget Interfaces599 15.7.2Adding XBL Content602 15.7.3Adding XBL Functionality605 15.7.4Integrating the Binding611 15.8Debug Corner: XBL Diagnosis614 15.9Summary615 16XPCOM Objects617 16.1Concepts and Terms619 16.1.1Reading Others' Code: Naming Conventions619 16.1.2Modular Programming621 16.1.3Foreign-Type Systems622 16.2General-Purpose Scripting623 16.2.1Command-Line Arguments623 16.2.2Data Structures and Algorithms624 16.2.3Databases625 16.2.4Environment628 16.2.5Files and Folders628 16.2.6Interrupts and Signals632 16.2.7Network Protocols633 16.2.8Processes and Threads636 16.3Data Transfer638 16.3.1Content Processing Concepts638 16.3.2Streams641 16.3.3Transports644 16.3.4Channels645 16.3.5Data Sources647 16.4Web Scripting652 16.4.1URIs, URLs, and URNs656 16.4.2Downloading Files657 16.4.3File and MIME Types658 16.4.4Uploading and Posting Files659 16.4.5Web Protocol Stack Objects659 16.4.6XSLT Batch Processing662 16.5Platform Configuration662 16.5.1Cache Control662 16.5.2File System Directory663 16.5.3Preferences670 16.5.4Security670 16.5.5User Profiles677 16.6Hands On: Saving and Loading NoteTaker Notes677 16.6.1Data Source Design677 16.6.2Data Source Setup678 16.6.3Dynamically Allocating Data Sources to Templates680 16.6.4Scripted RDF Queries Using XPCOM Interfaces685 16.6.5When to Move User-Entered Data into RDF688 16.6.6Enhancing Commands to Process RDF Content689 16.6.7Custom RDF Tree Views and Data Sources700 16.7Debug Corner: Working with Data Sources700 16.7.1Revealing Data Source Content701 16.8Summary703 17Deployment705 17.1Overview of Install Strategies707 17.2Steps Toward Remote Deployment712 17.2.1What the Programmer Does712 17.2.2What the User Does722 17.2.3What the Platform Does724 17.3Install Technologies725 17.3.1File Uses and Formats725 17.3.2Mozilla Registries726 17.3.3XUL Wizards728 17.3.4Web-Side Objects731 17.3.5XPInstall-Side Objects732 17.3.6XPCOM Objects743 17.4Hands On: Bundling Up NoteTaker744 17.4.1Release Preparation744 17.4.2Creating Support Files and Scripts745 17.4.3Final Bundling749 17.5Debug Corner: Logging and Testing751 17.6Summary752 Index (not available)753 About the Author771

Get Firefox! Not Quite Valid XHTML 1.0 Transitional Valid CSS Crafted with jEdit ( )