|
1 <?xml version="1.0"?> |
|
2 <!-- This Source Code Form is subject to the terms of the Mozilla Public |
|
3 - License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> |
|
5 |
|
6 |
|
7 <!DOCTYPE bindings [ |
|
8 <!ENTITY % wizardDTD SYSTEM "chrome://global/locale/wizard.dtd"> |
|
9 %wizardDTD; |
|
10 ]> |
|
11 |
|
12 <bindings id="wizardBindings" |
|
13 xmlns="http://www.mozilla.org/xbl" |
|
14 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
|
15 xmlns:xbl="http://www.mozilla.org/xbl"> |
|
16 |
|
17 <binding id="wizard-base"> |
|
18 <resources> |
|
19 <stylesheet src="chrome://global/skin/wizard.css"/> |
|
20 </resources> |
|
21 </binding> |
|
22 |
|
23 <binding id="wizard" extends="chrome://global/content/bindings/general.xml#root-element"> |
|
24 <resources> |
|
25 <stylesheet src="chrome://global/skin/wizard.css"/> |
|
26 </resources> |
|
27 <content> |
|
28 <xul:hbox class="wizard-header" anonid="Header"/> |
|
29 |
|
30 <xul:deck class="wizard-page-box" flex="1" anonid="Deck"> |
|
31 <children includes="wizardpage"/> |
|
32 </xul:deck> |
|
33 <children/> |
|
34 |
|
35 <xul:hbox class="wizard-buttons" anonid="Buttons" xbl:inherits="pagestep,firstpage,lastpage"/> |
|
36 </content> |
|
37 |
|
38 <implementation> |
|
39 <property name="title" onget="return document.title;" |
|
40 onset="return document.title = val;"/> |
|
41 |
|
42 <property name="canAdvance" onget="return this._canAdvance;" |
|
43 onset="this._nextButton.disabled = !val; return this._canAdvance = val;"/> |
|
44 <property name="canRewind" onget="return this._canRewind;" |
|
45 onset="this._backButton.disabled = !val; return this._canRewind = val;"/> |
|
46 |
|
47 <property name="pageStep" readonly="true" onget="return this._pageStack.length"/> |
|
48 |
|
49 <field name="pageCount">0</field> |
|
50 |
|
51 <field name="_accessMethod">null</field> |
|
52 <field name="_pageStack">null</field> |
|
53 <field name="_currentPage">null</field> |
|
54 |
|
55 <property name="wizardPages"> |
|
56 <getter> |
|
57 <![CDATA[ |
|
58 var xulns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; |
|
59 return this.getElementsByTagNameNS(xulns, "wizardpage"); |
|
60 ]]> |
|
61 </getter> |
|
62 </property> |
|
63 |
|
64 <property name="currentPage" onget="return this._currentPage"> |
|
65 <setter> |
|
66 <![CDATA[ |
|
67 if (!val) |
|
68 return val; |
|
69 |
|
70 this._currentPage = val; |
|
71 |
|
72 // Setting this attribute allows wizard's clients to dynamically |
|
73 // change the styles of each page based on purpose of the page. |
|
74 this.setAttribute("currentpageid", val.pageid); |
|
75 |
|
76 if (this.onFirstPage) { |
|
77 this.canRewind = false; |
|
78 this.setAttribute("firstpage", "true"); |
|
79 #ifdef XP_UNIX |
|
80 #ifndef XP_MACOSX |
|
81 this._backButton.setAttribute('hidden', 'true'); |
|
82 #endif |
|
83 #endif |
|
84 } else { |
|
85 this.canRewind = true; |
|
86 this.setAttribute("firstpage", "false"); |
|
87 #ifdef XP_UNIX |
|
88 #ifndef XP_MACOSX |
|
89 this._backButton.setAttribute('hidden', 'false'); |
|
90 #endif |
|
91 #endif |
|
92 } |
|
93 |
|
94 if (this.onLastPage) { |
|
95 this.canAdvance = true; |
|
96 this.setAttribute("lastpage", "true"); |
|
97 } else { |
|
98 this.setAttribute("lastpage", "false"); |
|
99 } |
|
100 |
|
101 this._deck.setAttribute("selectedIndex", val.pageIndex); |
|
102 this._advanceFocusToPage(val); |
|
103 |
|
104 this._adjustWizardHeader(); |
|
105 this._wizardButtons.onPageChange(); |
|
106 |
|
107 this._fireEvent(val, "pageshow"); |
|
108 |
|
109 return val; |
|
110 ]]> |
|
111 </setter> |
|
112 </property> |
|
113 |
|
114 <property name="pageIndex" |
|
115 onget="return this._currentPage ? this._currentPage.pageIndex : -1;"> |
|
116 <setter> |
|
117 <![CDATA[ |
|
118 if (val < 0 || val >= this.pageCount) |
|
119 return val; |
|
120 |
|
121 var page = this.wizardPages[val]; |
|
122 this._pageStack[this._pageStack.length-1] = page; |
|
123 this.currentPage = page; |
|
124 |
|
125 return val; |
|
126 ]]> |
|
127 </setter> |
|
128 </property> |
|
129 |
|
130 <property name="onFirstPage" readonly="true" |
|
131 onget="return this._pageStack.length == 1;"/> |
|
132 |
|
133 <property name="onLastPage" readonly="true"> |
|
134 <getter><![CDATA[ |
|
135 var cp = this.currentPage; |
|
136 return cp && ((this._accessMethod == "sequential" && cp.pageIndex == this.pageCount-1) || |
|
137 (this._accessMethod == "random" && cp.next == "")); |
|
138 ]]></getter> |
|
139 </property> |
|
140 |
|
141 <method name="getButton"> |
|
142 <parameter name="aDlgType"/> |
|
143 <body> |
|
144 <![CDATA[ |
|
145 var btns = this.getElementsByAttribute("dlgtype", aDlgType); |
|
146 return btns.item(0) ? btns[0] : document.getAnonymousElementByAttribute(this._wizardButtons, "dlgtype", aDlgType); |
|
147 ]]> |
|
148 </body> |
|
149 </method> |
|
150 |
|
151 <field name="_canAdvance"/> |
|
152 <field name="_canRewind"/> |
|
153 <field name="_wizardHeader"/> |
|
154 <field name="_wizardButtons"/> |
|
155 <field name="_deck"/> |
|
156 <field name="_backButton"/> |
|
157 <field name="_nextButton"/> |
|
158 <field name="_cancelButton"/> |
|
159 |
|
160 <!-- functions to be added as oncommand listeners to the wizard buttons --> |
|
161 <field name="_backFunc">(function() { document.documentElement.rewind(); })</field> |
|
162 <field name="_nextFunc">(function() { document.documentElement.advance(); })</field> |
|
163 <field name="_finishFunc">(function() { document.documentElement.advance(); })</field> |
|
164 <field name="_cancelFunc">(function() { document.documentElement.cancel(); })</field> |
|
165 <field name="_extra1Func">(function() { document.documentElement.extra1(); })</field> |
|
166 <field name="_extra2Func">(function() { document.documentElement.extra2(); })</field> |
|
167 |
|
168 <field name="_closeHandler">(function(event) { |
|
169 if (document.documentElement.cancel()) |
|
170 event.preventDefault(); |
|
171 })</field> |
|
172 |
|
173 <constructor><![CDATA[ |
|
174 this._canAdvance = true; |
|
175 this._canRewind = false; |
|
176 this._hasLoaded = false; |
|
177 |
|
178 this._pageStack = []; |
|
179 |
|
180 try { |
|
181 // need to create string bundle manually instead of using <xul:stringbundle/> |
|
182 // see bug 63370 for details |
|
183 this._bundle = Components.classes["@mozilla.org/intl/stringbundle;1"] |
|
184 .getService(Components.interfaces.nsIStringBundleService) |
|
185 .createBundle("chrome://global/locale/wizard.properties"); |
|
186 } catch (e) { |
|
187 // This fails in remote XUL, which has to provide titles for all pages |
|
188 // see bug 142502 |
|
189 } |
|
190 |
|
191 // get anonymous content references |
|
192 this._wizardHeader = document.getAnonymousElementByAttribute(this, "anonid", "Header"); |
|
193 this._wizardButtons = document.getAnonymousElementByAttribute(this, "anonid", "Buttons"); |
|
194 this._deck = document.getAnonymousElementByAttribute(this, "anonid", "Deck"); |
|
195 |
|
196 this._initWizardButton("back"); |
|
197 this._initWizardButton("next"); |
|
198 this._initWizardButton("finish"); |
|
199 this._initWizardButton("cancel"); |
|
200 this._initWizardButton("extra1"); |
|
201 this._initWizardButton("extra2"); |
|
202 |
|
203 this._initPages(); |
|
204 |
|
205 window.addEventListener("close", this._closeHandler, false); |
|
206 |
|
207 // start off on the first page |
|
208 this.pageCount = this.wizardPages.length; |
|
209 this.advance(); |
|
210 |
|
211 // give focus to the first focusable element in the dialog |
|
212 window.addEventListener("load", this._setInitialFocus, false); |
|
213 ]]></constructor> |
|
214 |
|
215 <method name="getPageById"> |
|
216 <parameter name="aPageId"/> |
|
217 <body><![CDATA[ |
|
218 var els = this.getElementsByAttribute("pageid", aPageId); |
|
219 return els.item(0); |
|
220 ]]></body> |
|
221 </method> |
|
222 |
|
223 <method name="extra1"> |
|
224 <body><![CDATA[ |
|
225 if (this.currentPage) |
|
226 this._fireEvent(this.currentPage, "extra1"); |
|
227 ]]></body> |
|
228 </method> |
|
229 |
|
230 <method name="extra2"> |
|
231 <body><![CDATA[ |
|
232 if (this.currentPage) |
|
233 this._fireEvent(this.currentPage, "extra2"); |
|
234 ]]></body> |
|
235 </method> |
|
236 |
|
237 <method name="rewind"> |
|
238 <body><![CDATA[ |
|
239 if (!this.canRewind) |
|
240 return; |
|
241 |
|
242 if (this.currentPage && !this._fireEvent(this.currentPage, "pagehide")) |
|
243 return; |
|
244 |
|
245 if (this.currentPage && !this._fireEvent(this.currentPage, "pagerewound")) |
|
246 return; |
|
247 |
|
248 if (!this._fireEvent(this, "wizardback")) |
|
249 return; |
|
250 |
|
251 |
|
252 this._pageStack.pop(); |
|
253 this.currentPage = this._pageStack[this._pageStack.length-1]; |
|
254 this.setAttribute("pagestep", this._pageStack.length); |
|
255 ]]></body> |
|
256 </method> |
|
257 |
|
258 <method name="advance"> |
|
259 <parameter name="aPageId"/> |
|
260 <body><![CDATA[ |
|
261 if (!this.canAdvance) |
|
262 return; |
|
263 |
|
264 if (this.currentPage && !this._fireEvent(this.currentPage, "pagehide")) |
|
265 return; |
|
266 |
|
267 if (this.currentPage && !this._fireEvent(this.currentPage, "pageadvanced")) |
|
268 return; |
|
269 |
|
270 if (this.onLastPage && !aPageId) { |
|
271 if (this._fireEvent(this, "wizardfinish")) |
|
272 window.setTimeout(function() {window.close();}, 1); |
|
273 } else { |
|
274 if (!this._fireEvent(this, "wizardnext")) |
|
275 return; |
|
276 |
|
277 var page; |
|
278 if (aPageId) |
|
279 page = this.getPageById(aPageId); |
|
280 else { |
|
281 if (this.currentPage) { |
|
282 if (this._accessMethod == "random") |
|
283 page = this.getPageById(this.currentPage.next); |
|
284 else |
|
285 page = this.wizardPages[this.currentPage.pageIndex+1]; |
|
286 } else |
|
287 page = this.wizardPages[0]; |
|
288 } |
|
289 |
|
290 if (page) { |
|
291 this._pageStack.push(page); |
|
292 this.setAttribute("pagestep", this._pageStack.length); |
|
293 |
|
294 this.currentPage = page; |
|
295 } |
|
296 } |
|
297 ]]></body> |
|
298 </method> |
|
299 |
|
300 <method name="goTo"> |
|
301 <parameter name="aPageId"/> |
|
302 <body><![CDATA[ |
|
303 var page = this.getPageById(aPageId); |
|
304 if (page) { |
|
305 this._pageStack[this._pageStack.length-1] = page; |
|
306 this.currentPage = page; |
|
307 } |
|
308 ]]></body> |
|
309 </method> |
|
310 |
|
311 <method name="cancel"> |
|
312 <body><![CDATA[ |
|
313 if (!this._fireEvent(this, "wizardcancel")) |
|
314 return true; |
|
315 |
|
316 window.close(); |
|
317 window.setTimeout(function() {window.close();}, 1); |
|
318 return false; |
|
319 ]]></body> |
|
320 </method> |
|
321 |
|
322 <method name="_setInitialFocus"> |
|
323 <parameter name="aEvent"/> |
|
324 <body> |
|
325 <![CDATA[ |
|
326 document.documentElement._hasLoaded = true; |
|
327 var focusInit = |
|
328 function() { |
|
329 // give focus to the first focusable element in the dialog |
|
330 if (!document.commandDispatcher.focusedElement) |
|
331 document.commandDispatcher.advanceFocusIntoSubtree(document.documentElement); |
|
332 |
|
333 try { |
|
334 var button = |
|
335 document.documentElement._wizardButtons.defaultButton; |
|
336 if (button) |
|
337 window.notifyDefaultButtonLoaded(button); |
|
338 } catch (e) { } |
|
339 }; |
|
340 |
|
341 // Give focus after onload completes, see bug 103197. |
|
342 setTimeout(focusInit, 0); |
|
343 ]]> |
|
344 </body> |
|
345 </method> |
|
346 |
|
347 <method name="_advanceFocusToPage"> |
|
348 <parameter name="aPage"/> |
|
349 <body> |
|
350 <![CDATA[ |
|
351 if (!this._hasLoaded) |
|
352 return; |
|
353 |
|
354 document.commandDispatcher.advanceFocusIntoSubtree(aPage); |
|
355 |
|
356 // if advanceFocusIntoSubtree tries to focus one of our |
|
357 // dialog buttons, then remove it and put it on the root |
|
358 var focused = document.commandDispatcher.focusedElement; |
|
359 if (focused && focused.hasAttribute("dlgtype")) |
|
360 this.focus(); |
|
361 ]]> |
|
362 </body> |
|
363 </method> |
|
364 |
|
365 <method name="_initPages"> |
|
366 <body><![CDATA[ |
|
367 var meth = "sequential"; |
|
368 var pages = this.wizardPages; |
|
369 for (var i = 0; i < pages.length; ++i) { |
|
370 var page = pages[i]; |
|
371 page.pageIndex = i; |
|
372 if (page.next != "") |
|
373 meth = "random"; |
|
374 } |
|
375 this._accessMethod = meth; |
|
376 ]]></body> |
|
377 </method> |
|
378 |
|
379 <method name="_initWizardButton"> |
|
380 <parameter name="aName"/> |
|
381 <body><![CDATA[ |
|
382 var btn = document.getAnonymousElementByAttribute(this._wizardButtons, "dlgtype", aName); |
|
383 if (btn) { |
|
384 btn.addEventListener("command", this["_"+aName+"Func"], false); |
|
385 this["_"+aName+"Button"] = btn; |
|
386 } |
|
387 return btn; |
|
388 ]]></body> |
|
389 </method> |
|
390 |
|
391 <method name="_adjustWizardHeader"> |
|
392 <body><![CDATA[ |
|
393 var label = this.currentPage.getAttribute("label"); |
|
394 if (!label && this.onFirstPage && this._bundle) |
|
395 #ifdef XP_MACOSX |
|
396 label = this._bundle.GetStringFromName("default-first-title-mac"); |
|
397 #else |
|
398 label = this._bundle.formatStringFromName("default-first-title", [this.title], 1); |
|
399 #endif |
|
400 else if (!label && this.onLastPage && this._bundle) |
|
401 #ifdef XP_MACOSX |
|
402 label = this._bundle.GetStringFromName("default-last-title-mac"); |
|
403 #else |
|
404 label = this._bundle.formatStringFromName("default-last-title", [this.title], 1); |
|
405 #endif |
|
406 this._wizardHeader.setAttribute("label", label); |
|
407 this._wizardHeader.setAttribute("description", this.currentPage.getAttribute("description")); |
|
408 ]]></body> |
|
409 </method> |
|
410 |
|
411 <method name="_hitEnter"> |
|
412 <parameter name="evt"/> |
|
413 <body> |
|
414 <![CDATA[ |
|
415 if (!evt.defaultPrevented) |
|
416 this.advance(); |
|
417 ]]> |
|
418 </body> |
|
419 </method> |
|
420 |
|
421 <method name="_fireEvent"> |
|
422 <parameter name="aTarget"/> |
|
423 <parameter name="aType"/> |
|
424 <body> |
|
425 <![CDATA[ |
|
426 var event = document.createEvent("Events"); |
|
427 event.initEvent(aType, true, true); |
|
428 |
|
429 // handle dom event handlers |
|
430 var noCancel = aTarget.dispatchEvent(event); |
|
431 |
|
432 // handle any xml attribute event handlers |
|
433 var handler = aTarget.getAttribute("on"+aType); |
|
434 if (handler != "") { |
|
435 var fn = new Function("event", handler); |
|
436 var returned = fn.apply(aTarget, [event]); |
|
437 if (returned == false) |
|
438 noCancel = false; |
|
439 } |
|
440 |
|
441 return noCancel; |
|
442 ]]> |
|
443 </body> |
|
444 </method> |
|
445 |
|
446 </implementation> |
|
447 |
|
448 <handlers> |
|
449 <handler event="keypress" keycode="VK_RETURN" |
|
450 group="system" action="this._hitEnter(event)"/> |
|
451 <handler event="keypress" keycode="VK_ESCAPE" group="system"> |
|
452 if (!event.defaultPrevented) |
|
453 this.cancel(); |
|
454 </handler> |
|
455 </handlers> |
|
456 </binding> |
|
457 |
|
458 <binding id="wizardpage" extends="chrome://global/content/bindings/wizard.xml#wizard-base"> |
|
459 <implementation> |
|
460 <field name="pageIndex">-1</field> |
|
461 |
|
462 <property name="pageid" onget="return this.getAttribute('pageid');" |
|
463 onset="this.setAttribute('pageid', val);"/> |
|
464 |
|
465 <property name="next" onget="return this.getAttribute('next');" |
|
466 onset="this.setAttribute('next', val); |
|
467 this.parentNode._accessMethod = 'random'; |
|
468 return val;"/> |
|
469 </implementation> |
|
470 </binding> |
|
471 |
|
472 #ifdef XP_MACOSX |
|
473 <binding id="wizard-header" extends="chrome://global/content/bindings/wizard.xml#wizard-base"> |
|
474 <content> |
|
475 <xul:stack class="wizard-header-stack" flex="1"> |
|
476 <xul:vbox class="wizard-header-box-1"> |
|
477 <xul:vbox class="wizard-header-box-text"> |
|
478 <xul:label class="wizard-header-label" xbl:inherits="xbl:text=label"/> |
|
479 </xul:vbox> |
|
480 </xul:vbox> |
|
481 <xul:hbox class="wizard-header-box-icon"> |
|
482 <xul:spacer flex="1"/> |
|
483 <xul:image class="wizard-header-icon" xbl:inherits="src=iconsrc"/> |
|
484 </xul:hbox> |
|
485 </xul:stack> |
|
486 </content> |
|
487 </binding> |
|
488 |
|
489 <binding id="wizard-buttons" extends="chrome://global/content/bindings/wizard.xml#wizard-base"> |
|
490 <content> |
|
491 <xul:vbox flex="1"> |
|
492 <xul:hbox class="wizard-buttons-btm"> |
|
493 <xul:button class="wizard-button" dlgtype="extra1" hidden="true"/> |
|
494 <xul:button class="wizard-button" dlgtype="extra2" hidden="true"/> |
|
495 <xul:button label="&button-cancel-mac.label;" class="wizard-button" dlgtype="cancel"/> |
|
496 <xul:spacer flex="1"/> |
|
497 <xul:button label="&button-back-mac.label;" accesskey="&button-back-mac.accesskey;" |
|
498 class="wizard-button wizard-nav-button" dlgtype="back"/> |
|
499 <xul:button label="&button-next-mac.label;" accesskey="&button-next-mac.accesskey;" |
|
500 class="wizard-button wizard-nav-button" dlgtype="next" |
|
501 default="true" xbl:inherits="hidden=lastpage" /> |
|
502 <xul:button label="&button-finish-mac.label;" class="wizard-button" |
|
503 dlgtype="finish" default="true" xbl:inherits="hidden=hidefinishbutton" /> |
|
504 </xul:hbox> |
|
505 </xul:vbox> |
|
506 </content> |
|
507 |
|
508 <implementation> |
|
509 <method name="onPageChange"> |
|
510 <body><![CDATA[ |
|
511 this.setAttribute("hidefinishbutton", !(this.getAttribute("lastpage") == "true")); |
|
512 ]]></body> |
|
513 </method> |
|
514 </implementation> |
|
515 |
|
516 </binding> |
|
517 |
|
518 #else |
|
519 |
|
520 <binding id="wizard-header" extends="chrome://global/content/bindings/wizard.xml#wizard-base"> |
|
521 <content> |
|
522 <xul:hbox class="wizard-header-box-1" flex="1"> |
|
523 <xul:vbox class="wizard-header-box-text" flex="1"> |
|
524 <xul:label class="wizard-header-label" xbl:inherits="xbl:text=label"/> |
|
525 <xul:label class="wizard-header-description" xbl:inherits="xbl:text=description"/> |
|
526 </xul:vbox> |
|
527 <xul:image class="wizard-header-icon" xbl:inherits="src=iconsrc"/> |
|
528 </xul:hbox> |
|
529 </content> |
|
530 </binding> |
|
531 |
|
532 <binding id="wizard-buttons" extends="chrome://global/content/bindings/wizard.xml#wizard-base"> |
|
533 <content> |
|
534 <xul:vbox class="wizard-buttons-box-1" flex="1"> |
|
535 <xul:separator class="wizard-buttons-separator groove"/> |
|
536 <xul:hbox class="wizard-buttons-box-2"> |
|
537 <xul:button class="wizard-button" dlgtype="extra1" hidden="true"/> |
|
538 <xul:button class="wizard-button" dlgtype="extra2" hidden="true"/> |
|
539 <xul:spacer flex="1" anonid="spacer"/> |
|
540 #ifdef XP_UNIX |
|
541 <xul:button label="&button-cancel-unix.label;" class="wizard-button" |
|
542 dlgtype="cancel" icon="cancel"/> |
|
543 <xul:spacer style="width: 24px"/> |
|
544 <xul:button label="&button-back-unix.label;" accesskey="&button-back-unix.accesskey;" |
|
545 class="wizard-button" dlgtype="back" icon="go-back"/> |
|
546 <xul:deck class="wizard-next-deck" anonid="WizardButtonDeck"> |
|
547 <xul:hbox> |
|
548 <xul:button label="&button-finish-unix.label;" class="wizard-button" |
|
549 dlgtype="finish" default="true" flex="1"/> |
|
550 </xul:hbox> |
|
551 <xul:hbox> |
|
552 <xul:button label="&button-next-unix.label;" accesskey="&button-next-unix.accesskey;" |
|
553 class="wizard-button" dlgtype="next" icon="go-forward" |
|
554 default="true" flex="1"/> |
|
555 </xul:hbox> |
|
556 </xul:deck> |
|
557 #else |
|
558 <xul:button label="&button-back-win.label;" accesskey="&button-back-win.accesskey;" |
|
559 class="wizard-button" dlgtype="back" icon="go-back"/> |
|
560 <xul:deck class="wizard-next-deck" anonid="WizardButtonDeck"> |
|
561 <xul:hbox> |
|
562 <xul:button label="&button-finish-win.label;" class="wizard-button" |
|
563 dlgtype="finish" default="true" flex="1"/> |
|
564 </xul:hbox> |
|
565 <xul:hbox> |
|
566 <xul:button label="&button-next-win.label;" accesskey="&button-next-win.accesskey;" |
|
567 class="wizard-button" dlgtype="next" icon="go-forward" |
|
568 default="true" flex="1"/> |
|
569 </xul:hbox> |
|
570 </xul:deck> |
|
571 <xul:button label="&button-cancel-win.label;" class="wizard-button" |
|
572 dlgtype="cancel" icon="cancel"/> |
|
573 #endif |
|
574 </xul:hbox> |
|
575 </xul:vbox> |
|
576 </content> |
|
577 |
|
578 <implementation> |
|
579 <field name="_wizardButtonDeck" readonly="true"> |
|
580 document.getAnonymousElementByAttribute(this, "anonid", "WizardButtonDeck"); |
|
581 </field> |
|
582 |
|
583 <method name="onPageChange"> |
|
584 <body><![CDATA[ |
|
585 if (this.getAttribute("lastpage") == "true") { |
|
586 this._wizardButtonDeck.setAttribute("selectedIndex", 0); |
|
587 } else { |
|
588 this._wizardButtonDeck.setAttribute("selectedIndex", 1); |
|
589 } |
|
590 ]]></body> |
|
591 </method> |
|
592 |
|
593 <property name="defaultButton" readonly="true"> |
|
594 <getter><![CDATA[ |
|
595 const kXULNS = |
|
596 "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; |
|
597 var buttons = this._wizardButtonDeck.selectedPanel |
|
598 .getElementsByTagNameNS(kXULNS, "button"); |
|
599 for (var i = 0; i < buttons.length; i++) { |
|
600 if (buttons[i].getAttribute("default") == "true" && |
|
601 !buttons[i].hidden && !buttons[i].disabled) |
|
602 return buttons[i]; |
|
603 } |
|
604 return null; |
|
605 ]]></getter> |
|
606 </property> |
|
607 </implementation> |
|
608 </binding> |
|
609 #endif |
|
610 |
|
611 </bindings> |