1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/content/widgets/wizard.xml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,611 @@ 1.4 +<?xml version="1.0"?> 1.5 +<!-- This Source Code Form is subject to the terms of the Mozilla Public 1.6 + - License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> 1.8 + 1.9 + 1.10 +<!DOCTYPE bindings [ 1.11 + <!ENTITY % wizardDTD SYSTEM "chrome://global/locale/wizard.dtd"> 1.12 + %wizardDTD; 1.13 +]> 1.14 + 1.15 +<bindings id="wizardBindings" 1.16 + xmlns="http://www.mozilla.org/xbl" 1.17 + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.18 + xmlns:xbl="http://www.mozilla.org/xbl"> 1.19 + 1.20 + <binding id="wizard-base"> 1.21 + <resources> 1.22 + <stylesheet src="chrome://global/skin/wizard.css"/> 1.23 + </resources> 1.24 + </binding> 1.25 + 1.26 + <binding id="wizard" extends="chrome://global/content/bindings/general.xml#root-element"> 1.27 + <resources> 1.28 + <stylesheet src="chrome://global/skin/wizard.css"/> 1.29 + </resources> 1.30 + <content> 1.31 + <xul:hbox class="wizard-header" anonid="Header"/> 1.32 + 1.33 + <xul:deck class="wizard-page-box" flex="1" anonid="Deck"> 1.34 + <children includes="wizardpage"/> 1.35 + </xul:deck> 1.36 + <children/> 1.37 + 1.38 + <xul:hbox class="wizard-buttons" anonid="Buttons" xbl:inherits="pagestep,firstpage,lastpage"/> 1.39 + </content> 1.40 + 1.41 + <implementation> 1.42 + <property name="title" onget="return document.title;" 1.43 + onset="return document.title = val;"/> 1.44 + 1.45 + <property name="canAdvance" onget="return this._canAdvance;" 1.46 + onset="this._nextButton.disabled = !val; return this._canAdvance = val;"/> 1.47 + <property name="canRewind" onget="return this._canRewind;" 1.48 + onset="this._backButton.disabled = !val; return this._canRewind = val;"/> 1.49 + 1.50 + <property name="pageStep" readonly="true" onget="return this._pageStack.length"/> 1.51 + 1.52 + <field name="pageCount">0</field> 1.53 + 1.54 + <field name="_accessMethod">null</field> 1.55 + <field name="_pageStack">null</field> 1.56 + <field name="_currentPage">null</field> 1.57 + 1.58 + <property name="wizardPages"> 1.59 + <getter> 1.60 + <![CDATA[ 1.61 + var xulns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 1.62 + return this.getElementsByTagNameNS(xulns, "wizardpage"); 1.63 + ]]> 1.64 + </getter> 1.65 + </property> 1.66 + 1.67 + <property name="currentPage" onget="return this._currentPage"> 1.68 + <setter> 1.69 + <![CDATA[ 1.70 + if (!val) 1.71 + return val; 1.72 + 1.73 + this._currentPage = val; 1.74 + 1.75 + // Setting this attribute allows wizard's clients to dynamically 1.76 + // change the styles of each page based on purpose of the page. 1.77 + this.setAttribute("currentpageid", val.pageid); 1.78 + 1.79 + if (this.onFirstPage) { 1.80 + this.canRewind = false; 1.81 + this.setAttribute("firstpage", "true"); 1.82 +#ifdef XP_UNIX 1.83 +#ifndef XP_MACOSX 1.84 + this._backButton.setAttribute('hidden', 'true'); 1.85 +#endif 1.86 +#endif 1.87 + } else { 1.88 + this.canRewind = true; 1.89 + this.setAttribute("firstpage", "false"); 1.90 +#ifdef XP_UNIX 1.91 +#ifndef XP_MACOSX 1.92 + this._backButton.setAttribute('hidden', 'false'); 1.93 +#endif 1.94 +#endif 1.95 + } 1.96 + 1.97 + if (this.onLastPage) { 1.98 + this.canAdvance = true; 1.99 + this.setAttribute("lastpage", "true"); 1.100 + } else { 1.101 + this.setAttribute("lastpage", "false"); 1.102 + } 1.103 + 1.104 + this._deck.setAttribute("selectedIndex", val.pageIndex); 1.105 + this._advanceFocusToPage(val); 1.106 + 1.107 + this._adjustWizardHeader(); 1.108 + this._wizardButtons.onPageChange(); 1.109 + 1.110 + this._fireEvent(val, "pageshow"); 1.111 + 1.112 + return val; 1.113 + ]]> 1.114 + </setter> 1.115 + </property> 1.116 + 1.117 + <property name="pageIndex" 1.118 + onget="return this._currentPage ? this._currentPage.pageIndex : -1;"> 1.119 + <setter> 1.120 + <![CDATA[ 1.121 + if (val < 0 || val >= this.pageCount) 1.122 + return val; 1.123 + 1.124 + var page = this.wizardPages[val]; 1.125 + this._pageStack[this._pageStack.length-1] = page; 1.126 + this.currentPage = page; 1.127 + 1.128 + return val; 1.129 + ]]> 1.130 + </setter> 1.131 + </property> 1.132 + 1.133 + <property name="onFirstPage" readonly="true" 1.134 + onget="return this._pageStack.length == 1;"/> 1.135 + 1.136 + <property name="onLastPage" readonly="true"> 1.137 + <getter><![CDATA[ 1.138 + var cp = this.currentPage; 1.139 + return cp && ((this._accessMethod == "sequential" && cp.pageIndex == this.pageCount-1) || 1.140 + (this._accessMethod == "random" && cp.next == "")); 1.141 + ]]></getter> 1.142 + </property> 1.143 + 1.144 + <method name="getButton"> 1.145 + <parameter name="aDlgType"/> 1.146 + <body> 1.147 + <![CDATA[ 1.148 + var btns = this.getElementsByAttribute("dlgtype", aDlgType); 1.149 + return btns.item(0) ? btns[0] : document.getAnonymousElementByAttribute(this._wizardButtons, "dlgtype", aDlgType); 1.150 + ]]> 1.151 + </body> 1.152 + </method> 1.153 + 1.154 + <field name="_canAdvance"/> 1.155 + <field name="_canRewind"/> 1.156 + <field name="_wizardHeader"/> 1.157 + <field name="_wizardButtons"/> 1.158 + <field name="_deck"/> 1.159 + <field name="_backButton"/> 1.160 + <field name="_nextButton"/> 1.161 + <field name="_cancelButton"/> 1.162 + 1.163 + <!-- functions to be added as oncommand listeners to the wizard buttons --> 1.164 + <field name="_backFunc">(function() { document.documentElement.rewind(); })</field> 1.165 + <field name="_nextFunc">(function() { document.documentElement.advance(); })</field> 1.166 + <field name="_finishFunc">(function() { document.documentElement.advance(); })</field> 1.167 + <field name="_cancelFunc">(function() { document.documentElement.cancel(); })</field> 1.168 + <field name="_extra1Func">(function() { document.documentElement.extra1(); })</field> 1.169 + <field name="_extra2Func">(function() { document.documentElement.extra2(); })</field> 1.170 + 1.171 + <field name="_closeHandler">(function(event) { 1.172 + if (document.documentElement.cancel()) 1.173 + event.preventDefault(); 1.174 + })</field> 1.175 + 1.176 + <constructor><![CDATA[ 1.177 + this._canAdvance = true; 1.178 + this._canRewind = false; 1.179 + this._hasLoaded = false; 1.180 + 1.181 + this._pageStack = []; 1.182 + 1.183 + try { 1.184 + // need to create string bundle manually instead of using <xul:stringbundle/> 1.185 + // see bug 63370 for details 1.186 + this._bundle = Components.classes["@mozilla.org/intl/stringbundle;1"] 1.187 + .getService(Components.interfaces.nsIStringBundleService) 1.188 + .createBundle("chrome://global/locale/wizard.properties"); 1.189 + } catch (e) { 1.190 + // This fails in remote XUL, which has to provide titles for all pages 1.191 + // see bug 142502 1.192 + } 1.193 + 1.194 + // get anonymous content references 1.195 + this._wizardHeader = document.getAnonymousElementByAttribute(this, "anonid", "Header"); 1.196 + this._wizardButtons = document.getAnonymousElementByAttribute(this, "anonid", "Buttons"); 1.197 + this._deck = document.getAnonymousElementByAttribute(this, "anonid", "Deck"); 1.198 + 1.199 + this._initWizardButton("back"); 1.200 + this._initWizardButton("next"); 1.201 + this._initWizardButton("finish"); 1.202 + this._initWizardButton("cancel"); 1.203 + this._initWizardButton("extra1"); 1.204 + this._initWizardButton("extra2"); 1.205 + 1.206 + this._initPages(); 1.207 + 1.208 + window.addEventListener("close", this._closeHandler, false); 1.209 + 1.210 + // start off on the first page 1.211 + this.pageCount = this.wizardPages.length; 1.212 + this.advance(); 1.213 + 1.214 + // give focus to the first focusable element in the dialog 1.215 + window.addEventListener("load", this._setInitialFocus, false); 1.216 + ]]></constructor> 1.217 + 1.218 + <method name="getPageById"> 1.219 + <parameter name="aPageId"/> 1.220 + <body><![CDATA[ 1.221 + var els = this.getElementsByAttribute("pageid", aPageId); 1.222 + return els.item(0); 1.223 + ]]></body> 1.224 + </method> 1.225 + 1.226 + <method name="extra1"> 1.227 + <body><![CDATA[ 1.228 + if (this.currentPage) 1.229 + this._fireEvent(this.currentPage, "extra1"); 1.230 + ]]></body> 1.231 + </method> 1.232 + 1.233 + <method name="extra2"> 1.234 + <body><![CDATA[ 1.235 + if (this.currentPage) 1.236 + this._fireEvent(this.currentPage, "extra2"); 1.237 + ]]></body> 1.238 + </method> 1.239 + 1.240 + <method name="rewind"> 1.241 + <body><![CDATA[ 1.242 + if (!this.canRewind) 1.243 + return; 1.244 + 1.245 + if (this.currentPage && !this._fireEvent(this.currentPage, "pagehide")) 1.246 + return; 1.247 + 1.248 + if (this.currentPage && !this._fireEvent(this.currentPage, "pagerewound")) 1.249 + return; 1.250 + 1.251 + if (!this._fireEvent(this, "wizardback")) 1.252 + return; 1.253 + 1.254 + 1.255 + this._pageStack.pop(); 1.256 + this.currentPage = this._pageStack[this._pageStack.length-1]; 1.257 + this.setAttribute("pagestep", this._pageStack.length); 1.258 + ]]></body> 1.259 + </method> 1.260 + 1.261 + <method name="advance"> 1.262 + <parameter name="aPageId"/> 1.263 + <body><![CDATA[ 1.264 + if (!this.canAdvance) 1.265 + return; 1.266 + 1.267 + if (this.currentPage && !this._fireEvent(this.currentPage, "pagehide")) 1.268 + return; 1.269 + 1.270 + if (this.currentPage && !this._fireEvent(this.currentPage, "pageadvanced")) 1.271 + return; 1.272 + 1.273 + if (this.onLastPage && !aPageId) { 1.274 + if (this._fireEvent(this, "wizardfinish")) 1.275 + window.setTimeout(function() {window.close();}, 1); 1.276 + } else { 1.277 + if (!this._fireEvent(this, "wizardnext")) 1.278 + return; 1.279 + 1.280 + var page; 1.281 + if (aPageId) 1.282 + page = this.getPageById(aPageId); 1.283 + else { 1.284 + if (this.currentPage) { 1.285 + if (this._accessMethod == "random") 1.286 + page = this.getPageById(this.currentPage.next); 1.287 + else 1.288 + page = this.wizardPages[this.currentPage.pageIndex+1]; 1.289 + } else 1.290 + page = this.wizardPages[0]; 1.291 + } 1.292 + 1.293 + if (page) { 1.294 + this._pageStack.push(page); 1.295 + this.setAttribute("pagestep", this._pageStack.length); 1.296 + 1.297 + this.currentPage = page; 1.298 + } 1.299 + } 1.300 + ]]></body> 1.301 + </method> 1.302 + 1.303 + <method name="goTo"> 1.304 + <parameter name="aPageId"/> 1.305 + <body><![CDATA[ 1.306 + var page = this.getPageById(aPageId); 1.307 + if (page) { 1.308 + this._pageStack[this._pageStack.length-1] = page; 1.309 + this.currentPage = page; 1.310 + } 1.311 + ]]></body> 1.312 + </method> 1.313 + 1.314 + <method name="cancel"> 1.315 + <body><![CDATA[ 1.316 + if (!this._fireEvent(this, "wizardcancel")) 1.317 + return true; 1.318 + 1.319 + window.close(); 1.320 + window.setTimeout(function() {window.close();}, 1); 1.321 + return false; 1.322 + ]]></body> 1.323 + </method> 1.324 + 1.325 + <method name="_setInitialFocus"> 1.326 + <parameter name="aEvent"/> 1.327 + <body> 1.328 + <![CDATA[ 1.329 + document.documentElement._hasLoaded = true; 1.330 + var focusInit = 1.331 + function() { 1.332 + // give focus to the first focusable element in the dialog 1.333 + if (!document.commandDispatcher.focusedElement) 1.334 + document.commandDispatcher.advanceFocusIntoSubtree(document.documentElement); 1.335 + 1.336 + try { 1.337 + var button = 1.338 + document.documentElement._wizardButtons.defaultButton; 1.339 + if (button) 1.340 + window.notifyDefaultButtonLoaded(button); 1.341 + } catch (e) { } 1.342 + }; 1.343 + 1.344 + // Give focus after onload completes, see bug 103197. 1.345 + setTimeout(focusInit, 0); 1.346 + ]]> 1.347 + </body> 1.348 + </method> 1.349 + 1.350 + <method name="_advanceFocusToPage"> 1.351 + <parameter name="aPage"/> 1.352 + <body> 1.353 + <![CDATA[ 1.354 + if (!this._hasLoaded) 1.355 + return; 1.356 + 1.357 + document.commandDispatcher.advanceFocusIntoSubtree(aPage); 1.358 + 1.359 + // if advanceFocusIntoSubtree tries to focus one of our 1.360 + // dialog buttons, then remove it and put it on the root 1.361 + var focused = document.commandDispatcher.focusedElement; 1.362 + if (focused && focused.hasAttribute("dlgtype")) 1.363 + this.focus(); 1.364 + ]]> 1.365 + </body> 1.366 + </method> 1.367 + 1.368 + <method name="_initPages"> 1.369 + <body><![CDATA[ 1.370 + var meth = "sequential"; 1.371 + var pages = this.wizardPages; 1.372 + for (var i = 0; i < pages.length; ++i) { 1.373 + var page = pages[i]; 1.374 + page.pageIndex = i; 1.375 + if (page.next != "") 1.376 + meth = "random"; 1.377 + } 1.378 + this._accessMethod = meth; 1.379 + ]]></body> 1.380 + </method> 1.381 + 1.382 + <method name="_initWizardButton"> 1.383 + <parameter name="aName"/> 1.384 + <body><![CDATA[ 1.385 + var btn = document.getAnonymousElementByAttribute(this._wizardButtons, "dlgtype", aName); 1.386 + if (btn) { 1.387 + btn.addEventListener("command", this["_"+aName+"Func"], false); 1.388 + this["_"+aName+"Button"] = btn; 1.389 + } 1.390 + return btn; 1.391 + ]]></body> 1.392 + </method> 1.393 + 1.394 + <method name="_adjustWizardHeader"> 1.395 + <body><![CDATA[ 1.396 + var label = this.currentPage.getAttribute("label"); 1.397 + if (!label && this.onFirstPage && this._bundle) 1.398 +#ifdef XP_MACOSX 1.399 + label = this._bundle.GetStringFromName("default-first-title-mac"); 1.400 +#else 1.401 + label = this._bundle.formatStringFromName("default-first-title", [this.title], 1); 1.402 +#endif 1.403 + else if (!label && this.onLastPage && this._bundle) 1.404 +#ifdef XP_MACOSX 1.405 + label = this._bundle.GetStringFromName("default-last-title-mac"); 1.406 +#else 1.407 + label = this._bundle.formatStringFromName("default-last-title", [this.title], 1); 1.408 +#endif 1.409 + this._wizardHeader.setAttribute("label", label); 1.410 + this._wizardHeader.setAttribute("description", this.currentPage.getAttribute("description")); 1.411 + ]]></body> 1.412 + </method> 1.413 + 1.414 + <method name="_hitEnter"> 1.415 + <parameter name="evt"/> 1.416 + <body> 1.417 + <![CDATA[ 1.418 + if (!evt.defaultPrevented) 1.419 + this.advance(); 1.420 + ]]> 1.421 + </body> 1.422 + </method> 1.423 + 1.424 + <method name="_fireEvent"> 1.425 + <parameter name="aTarget"/> 1.426 + <parameter name="aType"/> 1.427 + <body> 1.428 + <![CDATA[ 1.429 + var event = document.createEvent("Events"); 1.430 + event.initEvent(aType, true, true); 1.431 + 1.432 + // handle dom event handlers 1.433 + var noCancel = aTarget.dispatchEvent(event); 1.434 + 1.435 + // handle any xml attribute event handlers 1.436 + var handler = aTarget.getAttribute("on"+aType); 1.437 + if (handler != "") { 1.438 + var fn = new Function("event", handler); 1.439 + var returned = fn.apply(aTarget, [event]); 1.440 + if (returned == false) 1.441 + noCancel = false; 1.442 + } 1.443 + 1.444 + return noCancel; 1.445 + ]]> 1.446 + </body> 1.447 + </method> 1.448 + 1.449 + </implementation> 1.450 + 1.451 + <handlers> 1.452 + <handler event="keypress" keycode="VK_RETURN" 1.453 + group="system" action="this._hitEnter(event)"/> 1.454 + <handler event="keypress" keycode="VK_ESCAPE" group="system"> 1.455 + if (!event.defaultPrevented) 1.456 + this.cancel(); 1.457 + </handler> 1.458 + </handlers> 1.459 + </binding> 1.460 + 1.461 + <binding id="wizardpage" extends="chrome://global/content/bindings/wizard.xml#wizard-base"> 1.462 + <implementation> 1.463 + <field name="pageIndex">-1</field> 1.464 + 1.465 + <property name="pageid" onget="return this.getAttribute('pageid');" 1.466 + onset="this.setAttribute('pageid', val);"/> 1.467 + 1.468 + <property name="next" onget="return this.getAttribute('next');" 1.469 + onset="this.setAttribute('next', val); 1.470 + this.parentNode._accessMethod = 'random'; 1.471 + return val;"/> 1.472 + </implementation> 1.473 + </binding> 1.474 + 1.475 +#ifdef XP_MACOSX 1.476 + <binding id="wizard-header" extends="chrome://global/content/bindings/wizard.xml#wizard-base"> 1.477 + <content> 1.478 + <xul:stack class="wizard-header-stack" flex="1"> 1.479 + <xul:vbox class="wizard-header-box-1"> 1.480 + <xul:vbox class="wizard-header-box-text"> 1.481 + <xul:label class="wizard-header-label" xbl:inherits="xbl:text=label"/> 1.482 + </xul:vbox> 1.483 + </xul:vbox> 1.484 + <xul:hbox class="wizard-header-box-icon"> 1.485 + <xul:spacer flex="1"/> 1.486 + <xul:image class="wizard-header-icon" xbl:inherits="src=iconsrc"/> 1.487 + </xul:hbox> 1.488 + </xul:stack> 1.489 + </content> 1.490 + </binding> 1.491 + 1.492 + <binding id="wizard-buttons" extends="chrome://global/content/bindings/wizard.xml#wizard-base"> 1.493 + <content> 1.494 + <xul:vbox flex="1"> 1.495 + <xul:hbox class="wizard-buttons-btm"> 1.496 + <xul:button class="wizard-button" dlgtype="extra1" hidden="true"/> 1.497 + <xul:button class="wizard-button" dlgtype="extra2" hidden="true"/> 1.498 + <xul:button label="&button-cancel-mac.label;" class="wizard-button" dlgtype="cancel"/> 1.499 + <xul:spacer flex="1"/> 1.500 + <xul:button label="&button-back-mac.label;" accesskey="&button-back-mac.accesskey;" 1.501 + class="wizard-button wizard-nav-button" dlgtype="back"/> 1.502 + <xul:button label="&button-next-mac.label;" accesskey="&button-next-mac.accesskey;" 1.503 + class="wizard-button wizard-nav-button" dlgtype="next" 1.504 + default="true" xbl:inherits="hidden=lastpage" /> 1.505 + <xul:button label="&button-finish-mac.label;" class="wizard-button" 1.506 + dlgtype="finish" default="true" xbl:inherits="hidden=hidefinishbutton" /> 1.507 + </xul:hbox> 1.508 + </xul:vbox> 1.509 + </content> 1.510 + 1.511 + <implementation> 1.512 + <method name="onPageChange"> 1.513 + <body><![CDATA[ 1.514 + this.setAttribute("hidefinishbutton", !(this.getAttribute("lastpage") == "true")); 1.515 + ]]></body> 1.516 + </method> 1.517 + </implementation> 1.518 + 1.519 + </binding> 1.520 + 1.521 +#else 1.522 + 1.523 + <binding id="wizard-header" extends="chrome://global/content/bindings/wizard.xml#wizard-base"> 1.524 + <content> 1.525 + <xul:hbox class="wizard-header-box-1" flex="1"> 1.526 + <xul:vbox class="wizard-header-box-text" flex="1"> 1.527 + <xul:label class="wizard-header-label" xbl:inherits="xbl:text=label"/> 1.528 + <xul:label class="wizard-header-description" xbl:inherits="xbl:text=description"/> 1.529 + </xul:vbox> 1.530 + <xul:image class="wizard-header-icon" xbl:inherits="src=iconsrc"/> 1.531 + </xul:hbox> 1.532 + </content> 1.533 + </binding> 1.534 + 1.535 + <binding id="wizard-buttons" extends="chrome://global/content/bindings/wizard.xml#wizard-base"> 1.536 + <content> 1.537 + <xul:vbox class="wizard-buttons-box-1" flex="1"> 1.538 + <xul:separator class="wizard-buttons-separator groove"/> 1.539 + <xul:hbox class="wizard-buttons-box-2"> 1.540 + <xul:button class="wizard-button" dlgtype="extra1" hidden="true"/> 1.541 + <xul:button class="wizard-button" dlgtype="extra2" hidden="true"/> 1.542 + <xul:spacer flex="1" anonid="spacer"/> 1.543 +#ifdef XP_UNIX 1.544 + <xul:button label="&button-cancel-unix.label;" class="wizard-button" 1.545 + dlgtype="cancel" icon="cancel"/> 1.546 + <xul:spacer style="width: 24px"/> 1.547 + <xul:button label="&button-back-unix.label;" accesskey="&button-back-unix.accesskey;" 1.548 + class="wizard-button" dlgtype="back" icon="go-back"/> 1.549 + <xul:deck class="wizard-next-deck" anonid="WizardButtonDeck"> 1.550 + <xul:hbox> 1.551 + <xul:button label="&button-finish-unix.label;" class="wizard-button" 1.552 + dlgtype="finish" default="true" flex="1"/> 1.553 + </xul:hbox> 1.554 + <xul:hbox> 1.555 + <xul:button label="&button-next-unix.label;" accesskey="&button-next-unix.accesskey;" 1.556 + class="wizard-button" dlgtype="next" icon="go-forward" 1.557 + default="true" flex="1"/> 1.558 + </xul:hbox> 1.559 + </xul:deck> 1.560 +#else 1.561 + <xul:button label="&button-back-win.label;" accesskey="&button-back-win.accesskey;" 1.562 + class="wizard-button" dlgtype="back" icon="go-back"/> 1.563 + <xul:deck class="wizard-next-deck" anonid="WizardButtonDeck"> 1.564 + <xul:hbox> 1.565 + <xul:button label="&button-finish-win.label;" class="wizard-button" 1.566 + dlgtype="finish" default="true" flex="1"/> 1.567 + </xul:hbox> 1.568 + <xul:hbox> 1.569 + <xul:button label="&button-next-win.label;" accesskey="&button-next-win.accesskey;" 1.570 + class="wizard-button" dlgtype="next" icon="go-forward" 1.571 + default="true" flex="1"/> 1.572 + </xul:hbox> 1.573 + </xul:deck> 1.574 + <xul:button label="&button-cancel-win.label;" class="wizard-button" 1.575 + dlgtype="cancel" icon="cancel"/> 1.576 +#endif 1.577 + </xul:hbox> 1.578 + </xul:vbox> 1.579 + </content> 1.580 + 1.581 + <implementation> 1.582 + <field name="_wizardButtonDeck" readonly="true"> 1.583 + document.getAnonymousElementByAttribute(this, "anonid", "WizardButtonDeck"); 1.584 + </field> 1.585 + 1.586 + <method name="onPageChange"> 1.587 + <body><![CDATA[ 1.588 + if (this.getAttribute("lastpage") == "true") { 1.589 + this._wizardButtonDeck.setAttribute("selectedIndex", 0); 1.590 + } else { 1.591 + this._wizardButtonDeck.setAttribute("selectedIndex", 1); 1.592 + } 1.593 + ]]></body> 1.594 + </method> 1.595 + 1.596 + <property name="defaultButton" readonly="true"> 1.597 + <getter><![CDATA[ 1.598 + const kXULNS = 1.599 + "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 1.600 + var buttons = this._wizardButtonDeck.selectedPanel 1.601 + .getElementsByTagNameNS(kXULNS, "button"); 1.602 + for (var i = 0; i < buttons.length; i++) { 1.603 + if (buttons[i].getAttribute("default") == "true" && 1.604 + !buttons[i].hidden && !buttons[i].disabled) 1.605 + return buttons[i]; 1.606 + } 1.607 + return null; 1.608 + ]]></getter> 1.609 + </property> 1.610 + </implementation> 1.611 + </binding> 1.612 +#endif 1.613 + 1.614 +</bindings>