102241 - [XUL 1.0] use selectedIndex on deck and tabpanels, r=blake, sr=hyatt

This commit is contained in:
hewitt%netscape.com 2001-10-21 03:59:20 +00:00
parent 47c604d7e4
commit 7e10018204
28 changed files with 271 additions and 256 deletions

View File

@ -296,3 +296,4 @@ XUL_ATOM(properties, "properties")
XUL_ATOM(sort, "sort")
XUL_ATOM(sortDirection, "sortDirection")
XUL_ATOM(sortActive, "sortActive")
XUL_ATOM(selectedIndex, "selectedIndex")

View File

@ -1337,7 +1337,7 @@ function SetDisplayMode(mode)
if (mode == DisplayModeSource)
{
// Switch to the sourceWindow (second in the deck)
gContentWindowDeck.setAttribute("index","1");
gContentWindowDeck.setAttribute("selectedIndex","1");
//Hide the formatting toolbar if not already hidden
gFormatToolbarHidden = gFormatToolbar.getAttribute("hidden");
@ -1351,7 +1351,7 @@ function SetDisplayMode(mode)
else
{
// Switch to the normal editor (first in the deck)
gContentWindowDeck.setAttribute("index","0");
gContentWindowDeck.setAttribute("selectedIndex","0");
// Restore menus and toolbars
if (gFormatToolbarHidden != "true")

View File

@ -237,7 +237,7 @@
<splitter id="sidebar-splitter" class="chromeclass-extrachrome" hidden="true"/>
<vbox id="appcontent" flex="1">
<deck id="ContentWindowDeck" index="0" flex="1">
<deck id="ContentWindowDeck" selectedIndex="0" flex="1">
<!-- KLUDGE: Temporary fix for bug 34414:
The current editor tag doesn't have a view,
which breaks deck frame-hiding mechanism

View File

@ -215,7 +215,7 @@ function onInputHTMLAttributeName()
var listLen = 0;
// Index to which widget we were using to edit the value
var deckIndex = gDialog.AddHTMLAttributeValueDeck.getAttribute("index");
var deckIndex = gDialog.AddHTMLAttributeValueDeck.getAttribute("selectedIndex");
if (valueListName in gHTMLAttr)
{
@ -235,7 +235,7 @@ function onInputHTMLAttributeName()
{
// Switch to using editable menulist
gDialog.AddHTMLAttributeValueInput = gDialog.AddHTMLAttributeValueMenulist;
gDialog.AddHTMLAttributeValueDeck.setAttribute("index", "1");
gDialog.AddHTMLAttributeValueDeck.setAttribute("selectedIndex", "1");
}
// Rebuild the list
for (var i = 0; i < listLen; i++)
@ -261,7 +261,7 @@ function onInputHTMLAttributeName()
{
// No list: Use textbox for input instead
gDialog.AddHTMLAttributeValueInput = gDialog.AddHTMLAttributeValueTextbox;
gDialog.AddHTMLAttributeValueDeck.setAttribute("index", "0");
gDialog.AddHTMLAttributeValueDeck.setAttribute("selectedIndex", "0");
}
// If attribute already exists in tree, use associated value,

View File

@ -117,7 +117,7 @@
<menulist id="AddHTMLAttributeNameInput" editable="true" flex="1"
oninput="onInputHTMLAttributeName();"
onchange="onChangeHTMLAttribute();"/>
<deck id="AddHTMLAttributeValueDeck" flex="1" index="0">
<deck id="AddHTMLAttributeValueDeck" flex="1" selectedIndex="0">
<textbox id="AddHTMLAttributeValueTextbox" flex="1"
oninput="onInputHTMLAttributeValue();"/>
<menulist id="AddHTMLAttributeValueMenulist" editable="true" flex="1"

View File

@ -184,7 +184,7 @@ function Startup()
currentPanel = CellPanel;
//Set index for starting panel on the <tabpanels> element
TabPanels.setAttribute("index", CellPanel);
TabPanels.setAttribute("selectedIndex", CellPanel);
// Trigger setting of style for the tab widgets
CellTab.setAttribute("selected", "true");
@ -763,7 +763,7 @@ function SwitchToValidatePanel()
if (currentPanel != validatePanel)
{
//Set index for starting panel on the <tabpanels> element
TabPanels.setAttribute("index", validatePanel);
TabPanels.setAttribute("selectedIndex", validatePanel);
if (validatePanel == CellPanel)
{
// Trigger setting of style for the tab widgets

View File

@ -27,13 +27,13 @@
function onStopPicking()
{
var stk = document.getElementById("dkStartStop");
stk.setAttribute("index", 0);
stk.setAttribute("selectedIndex", 0);
}
function startPicking()
{
var stk = document.getElementById("dkStartStop");
stk.setAttribute("index", 1);
stk.setAttribute("selectedIndex", 1);
viewer.startPickColor(window);
}
@ -41,7 +41,7 @@
function stopPicking()
{
var stk = document.getElementById("dkStartStop");
stk.setAttribute("index", 0);
stk.setAttribute("selectedIndex", 0);
viewer.stopPickColor();
}

View File

@ -135,7 +135,7 @@ FindDialog.prototype =
setLabel1: function(aIndex)
{
var deck = document.getElementById("rwRow1Text");
deck.setAttribute("index", aIndex);
deck.setAttribute("selectedIndex", aIndex);
},
showRow2: function(aTruth)

View File

@ -266,9 +266,9 @@
if (purposeDeck) {
var selectedItem = categoryTree.selectedItems.length ? categoryTree.selectedItems[0] : null;
if (selectedItem) {
purposeDeck.setAttribute('index', selectedItem.getAttribute('index'));
purposeDeck.setAttribute('selectedIndex', selectedItem.getAttribute('selectedIndex'));
} else {
purposeDeck.setAttribute('index', '0');
purposeDeck.setAttribute('selectedIndex', '0');
}
}
}"

View File

@ -91,8 +91,6 @@ function Startup()
if (tab == "0") {
element = document.getElementById("cookiesTab");
element2.selectedTab = element;
element = document.getElementById("panel");
element.setAttribute("index","0" );
element = document.getElementById("imagesTab");
element.setAttribute("hidden","true" );
} else {
@ -100,8 +98,6 @@ function Startup()
element.setAttribute("title", bundle.GetStringFromName("imageTitle"));
element = document.getElementById("imagesTab");
element2.selectedTab = element;
element = document.getElementById("panel");
element.setAttribute("index","2" );
element = document.getElementById("serversTab");
element.setAttribute("hidden","true" );
element = document.getElementById("cookiesTab");

View File

@ -86,10 +86,8 @@ function Startup()
var tab = window.arguments[0];
if (tab == "S") {
element = document.getElementById("signonTab");
element.setAttribute("selected", "true");
element = document.getElementById("panel");
element.setAttribute("index","0" );
element = document.getElementById("signonTabbox");
element.selectedIndex = 0;
// hide non-used tabs
element = document.getElementById("nopreview");
@ -104,16 +102,14 @@ function Startup()
element = document.getElementById("signonviewer");
element.setAttribute("title", element.getAttribute("alttitle"));
element = document.getElementById("signonTabbox");
element.selectedIndex = 2;
// hide non-used tabs
element = document.getElementById("nopreview");
element.selected = true;
element = document.getElementById("signonTab");
element.setAttribute("hidden", "true");
element = document.getElementById("signonSitesTab");
element.setAttribute("hidden", "true");
element = document.getElementById("panel");
element.setAttribute("index","2" );
LoadNopreview();
LoadNocapture();
} else {

View File

@ -44,7 +44,7 @@
<keyset id="dialogKeys"/>
<tabbox flex="1">
<tabbox id="signonTabbox" flex="1">
<tabs>
<tab id="signonTab" label="&tab.signonsstored.label;"/>
<tab id="signonSitesTab" label="&tab.signonsnotstored.label;"/>

View File

@ -194,7 +194,7 @@ nsDeckFrame::AttributeChanged(nsIPresContext* aPresContext,
// if the index changed hide the old element and make the now element visible
if (aAttribute == nsHTMLAtoms::index) {
if (aAttribute == nsXULAtoms::selectedIndex) {
IndexChanged(aPresContext);
}
@ -285,7 +285,7 @@ nsDeckFrame::GetSelectedIndex()
// get the index attribute
nsAutoString value;
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None, nsXULAtoms::index, value))
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None, nsXULAtoms::selectedIndex, value))
{
PRInt32 error;

View File

@ -123,7 +123,7 @@ function folderPropsOnLoad()
if (window.arguments[0].tabID) {
// set index for starting panel on the <tabpanel> element
var folderPropTabPanel = document.getElementById("folderPropTabPanel");
folderPropTabPanel.setAttribute("index", window.arguments[0].tabIndex);
folderPropTabPanel.setAttribute("selectedIndex", window.arguments[0].tabIndex);
try {
var tab = document.getElementById(window.arguments[0].tabID);

View File

@ -347,13 +347,13 @@
// we inherit from a deck, so just use it's index attribute
// to hide/show widgets
if (val == Components.interfaces.nsMsgSearchAttrib.Priority)
this.setAttribute("index", "1");
this.setAttribute("selectedIndex", "1");
else if (val == Components.interfaces.nsMsgSearchAttrib.MsgStatus)
this.setAttribute("index", "2");
this.setAttribute("selectedIndex", "2");
else if (val == Components.interfaces.nsMsgSearchAttrib.Date)
this.setAttribute("index", "3");
this.setAttribute("selectedIndex", "3");
else
this.setAttribute("index", "0");
this.setAttribute("selectedIndex", "0");
return val;
]]>
</setter>

View File

@ -300,7 +300,7 @@ function StateChanged(name,state)
function InSearchMode()
{
// search is the second card in the deck
return (gSubscribeDeck.getAttribute("index") == "1");
return (gSubscribeDeck.getAttribute("selectedIndex") == "1");
}
function SearchOnClick(event)
@ -470,13 +470,13 @@ function InvalidateSearchOutliner()
function SwitchToNormalView()
{
// the first card in the deck is the "normal" view
gSubscribeDeck.setAttribute("index","0");
gSubscribeDeck.setAttribute("selectedIndex","0");
}
function SwitchToSearchView()
{
// the second card in the deck is the "search" view
gSubscribeDeck.setAttribute("index","1");
gSubscribeDeck.setAttribute("selectedIndex","1");
}
function Search()

View File

@ -94,7 +94,7 @@ Rights Reserved.
<spacer/>
</row>
<row flex="1">
<deck id="subscribedeck" index="0">
<deck id="subscribedeck" selectedIndex="0">
<hbox id="normalview">
<tree class="inset" flex="1"
id="subscribetree"

View File

@ -279,7 +279,7 @@ function showActionElementFor(menuitem)
if (!menuitem) return;
var indexValue = menuitem.getAttribute("actionvalueindex");
gActionValueDeck.setAttribute("index", indexValue);
gActionValueDeck.setAttribute("selectedIndex", indexValue);
// Disable the "New Folder..." button if any other action than MoveToFolder is chosen
document.getElementById("newFolderButton").setAttribute("disabled", indexValue == "0" ? "false" : "true");

View File

@ -66,19 +66,19 @@ function Startup()
{
case msgCompConvertible.Plain:
// We shouldn't be here at all
labeldeck.setAttribute("index", 1);
labeldeck.setAttribute("selectedIndex", 1);
// No icon
break;
case msgCompConvertible.Yes:
labeldeck.setAttribute("index", 1);
labeldeck.setAttribute("selectedIndex", 1);
icon.setAttribute("id", "convertYes");
break;
case msgCompConvertible.Altering:
labeldeck.setAttribute("index", 2);
labeldeck.setAttribute("selectedIndex", 2);
icon.setAttribute("id", "convertAltering");
break;
case msgCompConvertible.No:
labeldeck.setAttribute("index", 3);
labeldeck.setAttribute("selectedIndex", 3);
icon.setAttribute("id", "convertNo");
break;
}

View File

@ -180,7 +180,7 @@ function ImportDialogOKButton()
progressStatusEl.setAttribute("label", "");
progressTitleEl.setAttribute("label", meterText);
deck.setAttribute("index", "2");
deck.setAttribute("selectedIndex", "2");
progressInfo.progressWindow = top.window;
progressInfo.intervalState = setInterval("ContinueImportCallback()", 100);
return( true);
@ -220,7 +220,7 @@ function ImportDialogOKButton()
progressStatusEl.setAttribute("label", "");
progressTitleEl.setAttribute("label", meterText);
deck.setAttribute("index", "2");
deck.setAttribute("selectedIndex", "2");
progressInfo.progressWindow = top.window;
progressInfo.intervalState = setInterval("ContinueImportCallback()", 100);
@ -328,7 +328,7 @@ function ContinueImport( info) {
clearInterval( info.intervalState);
if (info.progressWindow != null) {
deck = document.getElementById("stateDeck");
deck.setAttribute("index", "3");
deck.setAttribute("selectedIndex", "3");
info.progressWindow = null;
}
@ -357,7 +357,7 @@ function ContinueImport( info) {
info.importSuccess = true;
if (info.progressWindow) {
deck = document.getElementById("stateDeck");
deck.setAttribute("index", "3");
deck.setAttribute("selectedIndex", "3");
info.progressWindow = null;
}
@ -389,7 +389,7 @@ function ShowResults(doesWantProgress, result)
progressStatusEl.setAttribute("label", "");
progressTitleEl.setAttribute("label", meterText);
deck.setAttribute("index", "2");
deck.setAttribute("selectedIndex", "2");
progressInfo.progressWindow = top.window;
progressInfo.intervalState = setInterval("ContinueImportCallback()", 100);
}
@ -433,7 +433,7 @@ function ShowImportResultsRaw(title, results, good)
dump("*** results = " + results + "\n");
attachStrings("results", results);
var deck = document.getElementById("stateDeck");
deck.setAttribute("index", "3");
deck.setAttribute("selectedIndex", "3");
var nextButton = document.getElementById("forward");
nextButton.label = nextButton.getAttribute("finishedval");
nextButton.removeAttribute("disabled");
@ -769,7 +769,7 @@ function ImportAddress( module, success, error) {
if (selectedModuleName == gImportMsgsBundle.getString('Comm4xImportName'))
{
var deck = document.getElementById("stateDeck");
deck.setAttribute("index", "4");
deck.setAttribute("selectedIndex", "4");
var isHomeRadioGroup = document.getElementById("homeorwork");
isHomeRadioGroup.selectedItem = document.getElementById("workRadio");
var forwardButton = document.getElementById("forward");
@ -832,14 +832,14 @@ function SwitchType( newType)
function next()
{
var deck = document.getElementById("stateDeck");
var index = deck.getAttribute("index");
var index = deck.getAttribute("selectedIndex");
switch (index) {
case "0":
var backButton = document.getElementById("back");
backButton.removeAttribute("disabled");
var radioGroup = document.getElementById("importFields");
SwitchType(radioGroup.value);
deck.setAttribute("index", "1");
deck.setAttribute("selectedIndex", "1");
enableAdvance();
break;
case "1":
@ -888,12 +888,12 @@ function enableAdvance()
function back()
{
var deck = document.getElementById("stateDeck");
if (deck.getAttribute("index") == "1") {
if (deck.getAttribute("selectedIndex") == "1") {
var backButton = document.getElementById("back");
backButton.setAttribute("disabled", "true");
var nextButton = document.getElementById("forward");
nextButton.label = nextButton.getAttribute("nextval");
nextButton.removeAttribute("disabled");
deck.setAttribute("index", "0");
deck.setAttribute("selectedIndex", "0");
}
}

View File

@ -45,7 +45,7 @@ Rights Reserved.
title="&importTitle.label;"
description="&importDesc.label;"/>
<deck id="stateDeck" index="0">
<deck id="stateDeck" selectedIndex="0">
<vbox class="wizard-box">
<html>&importDescription.label;</html>
<html>&importDescription2.label;</html>

View File

@ -34,11 +34,10 @@
%prefMousewheelDTD;
]>
<window xmlns:html="http://www.w3.org/1999/xhtml"
<page xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="color-dialog"
onload="parent.initPanel('chrome://communicator/content/pref/pref-mousewheel.xul');"
orient="vertical">
orient="vertical"
onload="parent.initPanel('chrome://communicator/content/pref/pref-mousewheel.xul');">
<script type="application/x-javascript">
<![CDATA[
@ -50,7 +49,7 @@
function switchPage( aElement )
{
var deck = document.getElementById( "modifierDeck" );
deck.setAttribute( "index", aElement.selectedItem.value );
deck.setAttribute( "selectedIndex", aElement.selectedItem.value );
}
function doEnableElement( aEventTarget, aElementID )
@ -207,5 +206,5 @@
</groupbox>
</window>
</page>

View File

@ -842,7 +842,7 @@ function OpenSearch(aSearchStr, engineURIs)
function switchTab(aPageIndex)
{
var deck = document.getElementById("advancedDeck");
deck.setAttribute("index", aPageIndex);
deck.setAttribute("selectedIndex", aPageIndex);
// decide whether to show/hide/enable/disable save search query button
if (aPageIndex != 0)

View File

@ -82,7 +82,7 @@ var progressListener = {
// right now, all that supports restarting downloads is ftp (rfc959)
ftpChannel = aRequest.QueryInterface(Components.interfaces.nsIFTPChannel);
if (ftpChannel) {
dialog.pauseResumeDeck.setAttribute("index", "1");
dialog.pauseResumeDeck.setAttribute("selectedIndex", "1");
}
}
catch (ex) {}
@ -475,14 +475,14 @@ function doPauseButton() {
{
// resume
dialog.downloadPaused = false;
dialog.pauseResumeDeck.setAttribute("index", "1");
dialog.pauseResumeDeck.setAttribute("selectedIndex", "1");
dialog.request.resume()
}
else
{
// suspend
dialog.downloadPaused = true;
dialog.pauseResumeDeck.setAttribute("index", "2");
dialog.pauseResumeDeck.setAttribute("selectedIndex", "2");
dialog.request.suspend()
}
}

View File

@ -241,5 +241,43 @@
</implementation>
</binding>
<binding id="deck">
<implementation>
<property name="selectedIndex"
onget="return this.getAttribute('selectedIndex');">
<setter>
<![CDATA[
if (this.selectedIndex == val)
return val;
this.setAttribute("selectedIndex", val);
var event = document.createEvent('Events');
event.initEvent('select', false, true);
this.dispatchEvent(event);
return val;
]]>
</setter>
</property>
<property name="selectedPanel">
<getter>
<![CDATA[
return this.childNodes[this.selectedIndex];
]]>
</getter>
<setter>
<![CDATA[
var selectedIndex = -1;
for (var panel = val; panel != null; panel = panel.previousSibling)
++selectedIndex;
this.selectedIndex = selectedIndex;
return val;
]]>
</setter>
</property>
</implementation>
</binding>
</bindings>

View File

@ -239,7 +239,7 @@
<method name="updateCurrentBrowser">
<body>
<![CDATA[
var newBrowser = this.mPanelContainer.childNodes[this.mPanelContainer.index];
var newBrowser = this.mPanelContainer.childNodes[this.mPanelContainer.selectedIndex];
if (this.mCurrentBrowser)
this.mCurrentBrowser.setAttribute("type", "content");
@ -431,7 +431,7 @@
var index = -1;
if (this.mCurrentTab == aTab)
index = this.mPanelContainer.index;
index = this.mPanelContainer.selectedIndex;
else {
// Find and locate the tab in our list.
for (var i = 0; i < l; i++)
@ -451,7 +451,7 @@
oldBrowser.setAttribute("type", "content");
// Now select the new tab before nuking the old one.
var currentIndex = this.mPanelContainer.index;
var currentIndex = this.mPanelContainer.selectedIndex;
var newIndex = -1;
if (currentIndex > index)

View File

@ -14,7 +14,7 @@
<content width="500" height="380" persist="x y width height">
<xul:hbox class="wizard-header" anonid="Header"/>
<xul:deck class="wizard-page-box" deck="true" flex="1" anonid="Deck">
<xul:deck class="wizard-page-box" flex="1" anonid="Deck">
<children includes="wizardpage"/>
</xul:deck>
<children/>
@ -30,13 +30,12 @@
onset="this._canAdvance=val; this._nextButton.disabled=!val;"/>
<property name="canRewind" onget="return this._canRewind;"
onset="this._canRewind=val; this._backButton.disabled=!val;"/>
<property name="canCancel"/>
<property name="accessMethod" onget="return this._accessMethod"/>
<property name="pageCount">0</property>
<field name="pageCount">0</field>
<property name="pageStack">null</property>
<field name="pageStack">null</field>
<property name="pageStep" onget="return this.pageStack.length"/>
@ -60,13 +59,13 @@
this.setAttribute("lastpage", "false");
}
this._deck.setAttribute("index", val.pageIndex);
this._deck.setAttribute("selectedIndex", val.pageIndex);
document.commandDispatcher.advanceFocusIntoSubtree(val);
this.adjustWizardHeader();
this._adjustWizardHeader();
this._wizardButtons.onPageChange();
val.fireShow();
this._fireEvent(val, "pageshow");
return val;
]]>
@ -95,109 +94,36 @@
]]></getter>
</property>
<property name="_canAdvance"/>
<property name="_canRewind"/>
<property name="_onBack"/>
<property name="_onNext"/>
<property name="_onCancel"/>
<property name="_wizardHeader"/>
<property name="_wizardButtons"/>
<property name="_deck"/>
<property name="_backButton"/>
<property name="_nextButton"/>
<property name="_cancelButton"/>
<method name="getButton">
<parameter name="aDlgType"/>
<body>
<![CDATA[
var btns = this.getElementsByAttribute("dlgtype", aDlgType);
return btns.length > 0 ? btns[0] : document.getAnonymousElementByAttribute(this, "dlgtype", aDlgType);
]]>
</body>
</method>
<property name="_backFunc">(function() { this._wizard.rewind(); })</property>
<property name="_nextFunc">(function() { this._wizard.advance(); })</property>
<property name="_finishFunc">(function() { this._wizard.advance(); })</property>
<property name="_cancelFunc">(function() { this._wizard.cancel(); })</property>
<field name="_canAdvance"/>
<field name="_canRewind"/>
<field name="_wizardHeader"/>
<field name="_wizardButtons"/>
<field name="_deck"/>
<field name="_backButton"/>
<field name="_nextButton"/>
<field name="_cancelButton"/>
<!-- functions to be added as oncommand listeners to the wizard buttons -->
<field name="_backFunc">(function() { document.documentElement.rewind(); })</field>
<field name="_nextFunc">(function() { document.documentElement.advance(); })</field>
<field name="_finishFunc">(function() { document.documentElement.advance(); })</field>
<field name="_cancelFunc">(function() { document.documentElement.cancel(); })</field>
<field name="_closeHandler">(function(event) {
if (document.documentElement.cancel())
event.preventDefault();
})</field>
<constructor><![CDATA[
this._canAdvance = true;
this._canRewind = false;
this.canCancel = true;
this.pageStack = [];
// need to create string bundle manually instead of using <xul:stringbundle/>
// see bug 63370 for details
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
.getService(Components.interfaces.nsILocaleService);
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
var bundleURL = "chrome://global-platform/locale/wizard.properties";
this._bundle = stringBundleService.createBundle(bundleURL, localeService.GetApplicationLocale());
// get anonymous content references
this._wizardHeader = document.getAnonymousElementByAttribute(this, "anonid", "Header");
this._wizardButtons = document.getAnonymousElementByAttribute(this, "anonid", "Buttons");
this._deck = document.getAnonymousElementByAttribute(this, "anonid", "Deck");
this.initWizardButton("back");
this.initWizardButton("next");
this.initWizardButton("finish");
this.initWizardButton("cancel");
this.initPages();
// get wizard event handlers
var back = this.getAttribute("onwizardback");
if (back)
this._onBack = new Function("wizard", back);
var next = this.getAttribute("onwizardnext");
if (next)
this._onNext = new Function("wizard", next);
var cancel = this.getAttribute("onwizardcancel");
if (cancel)
this._onCancel = new Function("wizard", cancel);
var finish = this.getAttribute("onwizardfinish");
if (finish)
this._onFinish = new Function("wizard", finish);
window.addEventListener("close", this._cancelFunc, false);
this.pageCount = this.childNodes.length;
this.advance(this.childNodes[0].pageid);
]]></constructor>
<method name="initPages">
<body><![CDATA[
var meth = "sequential";
for (var i = 0; i < this.childNodes.length; ++i) {
var page = this.childNodes[i];
page._pageIndex = i;
if (page.next != "")
meth = "random";
}
this._accessMethod = meth;
]]></body>
</method>
<method name="initWizardButton">
<parameter name="aName"/>
<body><![CDATA[
var btn = document.getAnonymousElementByAttribute(this._wizardButtons, "wizardbutton", aName);
if (btn) {
btn.addEventListener("command", this["_"+aName+"Func"], false);
btn.setAttribute("label", this._bundle.GetStringFromName("button-"+aName));
btn._wizard = this;
this["_"+aName+"Button"] = btn;
}
return btn;
]]></body>
</method>
<method name="adjustWizardHeader">
<body><![CDATA[
var label = this.currentPage.getAttribute("label");
if (!label && this.onFirstPage)
label = this._bundle.formatStringFromName("default-first-title", [this.title], 1);
else if (!label && this.onLastPage)
label = this._bundle.formatStringFromName("default-last-title", [this.title], 1);
this._wizardHeader.setAttribute("label", label);
this._wizardHeader.setAttribute("description", this.currentPage.getAttribute("description"));
]]></body>
</method>
<method name="getPageById">
<parameter name="aPageId"/>
<body><![CDATA[
@ -206,12 +132,6 @@
]]></body>
</method>
<method name="isPageLoaded">
<parameter name="aPageId"/>
<body><![CDATA[
]]></body>
</method>
<method name="rewind">
<body><![CDATA[
if (!this.canRewind)
@ -220,7 +140,7 @@
if (this.currentPage && !this.currentPage.fireHide())
return;
if (this._onBack && !this._onBack(this))
if (!this._fireEvent(this, "wizardback"))
return;
this.pageStack.pop();
@ -239,10 +159,10 @@
return;
if (this.onLastPage) {
if (!this._onFinish || this._onFinish(this))
if (!this._fireEvent(this, "wizardfinish"))
window.close();
} else {
if (this._onNext && !this._onNext(this))
if (!this._fireEvent(this, "wizardnext"))
return;
var page;
@ -276,35 +196,126 @@
<method name="cancel">
<body><![CDATA[
if (this._onCancel && !this._onCancel(this))
return;
if (!this._fireEvent(this, "wizardcancel"))
return true;
window.close();
window.close();
]]></body>
</method>
<constructor><![CDATA[
this._canAdvance = true;
this._canRewind = false;
this.pageStack = [];
// need to create string bundle manually instead of using <xul:stringbundle/>
// see bug 63370 for details
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
.getService(Components.interfaces.nsILocaleService);
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
var bundleURL = "chrome://global-platform/locale/wizard.properties";
this._bundle = stringBundleService.createBundle(bundleURL, localeService.GetApplicationLocale());
// get anonymous content references
this._wizardHeader = document.getAnonymousElementByAttribute(this, "anonid", "Header");
this._wizardButtons = document.getAnonymousElementByAttribute(this, "anonid", "Buttons");
this._deck = document.getAnonymousElementByAttribute(this, "anonid", "Deck");
this._initWizardButton("back");
this._initWizardButton("next");
this._initWizardButton("finish");
this._initWizardButton("cancel");
this._initPages();
window.addEventListener("close", this._closeHandler, false);
this.pageCount = this.childNodes.length;
this.advance(this.childNodes[0].pageid);
]]></constructor>
<method name="_initPages">
<body><![CDATA[
var meth = "sequential";
for (var i = 0; i < this.childNodes.length; ++i) {
var page = this.childNodes[i];
page._pageIndex = i;
if (page.next != "")
meth = "random";
}
this._accessMethod = meth;
]]></body>
</method>
<method name="_initWizardButton">
<parameter name="aName"/>
<body><![CDATA[
var btn = document.getAnonymousElementByAttribute(this._wizardButtons, "dlgtype", aName);
if (btn) {
btn.addEventListener("command", this["_"+aName+"Func"], false);
btn.setAttribute("label", this._bundle.GetStringFromName("button-"+aName));
this["_"+aName+"Button"] = btn;
}
return btn;
]]></body>
</method>
<method name="_adjustWizardHeader">
<body><![CDATA[
var label = this.currentPage.getAttribute("label");
if (!label && this.onFirstPage)
label = this._bundle.formatStringFromName("default-first-title", [this.title], 1);
else if (!label && this.onLastPage)
label = this._bundle.formatStringFromName("default-last-title", [this.title], 1);
this._wizardHeader.setAttribute("label", label);
this._wizardHeader.setAttribute("description", this.currentPage.getAttribute("description"));
]]></body>
</method>
<method name="_hitEnter">
<body>
<![CDATA[
// if a button is focused, dispatch its command instead
// of advancing the wizard
var focused = document.commandDispatcher.focusedElement;
if (!(focused.localName == "button" && focused.hasAttribute("dlgtype")))
this.advance();
]]>
</body>
</method>
<method name="_fireEvent">
<parameter name="aTarget"/>
<parameter name="aType"/>
<body>
<![CDATA[
var event = document.createEvent("Events");
event.initEvent(aType, false, true);
// handle dom event handlers
var noCancel = aTarget.dispatchEvent(event);
// handle any xml attribute event handlers
var handler = aTarget.getAttribute("on"+aType);
if (handler != "") {
var fn = new Function("event", handler);
var returned = fn.apply(aTarget, [event]);
if (returned == false)
noCancel = false;
}
return noCancel;
]]>
</body>
</method>
</implementation>
<handlers>
<handler event="keypress" keycode="VK_ENTER"
action="var c = document.commandDispatcher.focusedElement;
if (c == this._cancelButton)
this.cancel();
else if (c == this._backButton)
this.rewind();
else
this.advance();"/>
<handler event="keypress" keycode="VK_RETURN"
action="var c = document.commandDispatcher.focusedElement;
if (c == this._cancelButton)
this.cancel();
else if (c == this._backButton)
this.rewind();
else
this.advance();"/>
<handler event="keypress" keycode="VK_ESCAPE" action="document.firstChild.cancel();"/>
<handler event="keypress" keycode="VK_ENTER" action="this._hitEnter()"/>
<handler event="keypress" keycode="VK_RETURN" action="this._hitEnter()"/>
<handler event="keypress" keycode="VK_ESCAPE" action="this.cancel();"/>
</handlers>
</binding>
@ -318,38 +329,6 @@
<property name="next" onget="return this.getAttribute('next');"
onset="this.setAttribute('next', val);
this.parentNode._accessType = 'random';"/>
<constructor><![CDATA[
var onpageshow = this.getAttribute("onpageshow");
var onpagehide = this.getAttribute("onpagehide");
try {
if (onpageshow)
this.onpageshow = new Function(onpageshow);
if (onpagehide)
this.onpagehide = new Function(onpagehide);
} catch (ex) {}
]]></constructor>
<method name="fireShow">
<body><![CDATA[
if (this.onpageshow) {
var result = this.onpageshow();
return result == undefined ? true : result;
}
return true;
]]></body>
</method>
<method name="fireHide">
<body><![CDATA[
if (this.onpagehide) {
var result = this.onpagehide();
return result == undefined ? true : result;
}
return true;
]]></body>
</method>
</implementation>
</binding>
@ -357,8 +336,8 @@
<content>
<xul:hbox class="wizard-header-box-1" flex="1">
<xul:vbox class="wizard-header-box-text" flex="1">
<xul:text class="wizard-header-label" inherits="value=label"/>
<xul:text class="wizard-header-description" inherits="value=description"/>
<xul:label class="wizard-header-label" inherits="value=label"/>
<xul:label class="wizard-header-description" inherits="value=description"/>
</xul:vbox>
<xul:image class="wizard-header-icon" inherits="src=iconsrc"/>
</xul:hbox>
@ -371,12 +350,12 @@
<xul:separator class="wizard-buttons-separator groove"/>
<xul:hbox class="wizard-buttons-box-2">
<xul:spacer flex="1"/>
<xul:button class="wizard-button" wizardbutton="back"/>
<xul:button class="wizard-button" dlgtype="back"/>
<xul:deck class="wizard-next-deck" anonid="WizardButtonDeck">
<xul:button class="wizard-button" wizardbutton="finish" default="true"/>
<xul:button class="wizard-button" wizardbutton="next" default="true"/>
<xul:button class="wizard-button" dlgtype="finish" default="true"/>
<xul:button class="wizard-button" dlgtype="next" default="true"/>
</xul:deck>
<xul:button class="wizard-button" wizardbutton="cancel"/>
<xul:button class="wizard-button" dlgtype="cancel"/>
</xul:hbox>
</xul:vbox>
</content>
@ -389,9 +368,9 @@
<method name="onPageChange">
<body><![CDATA[
if (this.getAttribute("lastpage") == "true") {
this._wizardButtonDeck.setAttribute("index", 0);
this._wizardButtonDeck.setAttribute("selectedIndex", 0);
} else {
this._wizardButtonDeck.setAttribute("index", 1);
this._wizardButtonDeck.setAttribute("selectedIndex", 1);
}
]]></body>
</method>
@ -404,7 +383,7 @@
<xul:vbox class="wizard-header-box-1">
<xul:vbox class="wizard-header-box-2">
<xul:vbox class="wizard-header-box-text">
<xul:text class="wizard-header-label" inherits="value=label"/>
<xul:label class="wizard-header-label" inherits="value=label"/>
</xul:vbox>
</xul:vbox>
</xul:vbox>
@ -421,17 +400,17 @@
<xul:vbox flex="1">
<xul:hbox class="wizard-buttons-top" inherits="hidden=hidetoprow">
<xul:spacer flex="1"/>
<xul:button class="wizard-button" wizardbutton="cancel"/>
<xul:button class="wizard-button" wizardbutton="finish" default="true"/>
<xul:button class="wizard-button" dlgtype="cancel"/>
<xul:button class="wizard-button" dlgtype="finish" default="true"/>
</xul:hbox>
<xul:separator class="wizard-buttons-separator groove"/>
<xul:hbox class="wizard-buttons-btm">
<xul:spacer flex="1"/>
<xul:button class="wizard-button wizard-nav-button" wizardbutton="back"/>
<xul:button class="wizard-button wizard-nav-button" dlgtype="back"/>
<xul:hbox class="wizard-label-box" align="center">
<xul:text class="wizard-page-label" inherits="value=pagestep"/>
<xul:label class="wizard-page-label" inherits="value=pagestep"/>
</xul:hbox>
<xul:button class="wizard-button wizard-nav-button" wizardbutton="next" default="true" inherits="disabled=lastpage"/>
<xul:button class="wizard-button wizard-nav-button" dlgtype="next" default="true" inherits="disabled=lastpage"/>
</xul:hbox>
</xul:vbox>
</content>

View File

@ -66,9 +66,10 @@ radiogroup {
-moz-user-focus: normal;
}
/******** window ******/
/******** window & page ******/
window {
window,
page {
overflow: hidden;
}
@ -272,6 +273,10 @@ tooltip {
-moz-binding: url("chrome://global/content/bindings/popup.xml#tooltips");
}
.titletip {
-moz-binding: url("chrome://global/content/bindings/outliner.xml#titletip");
}
/********** floating popups **********/
titlebar {
@ -424,6 +429,7 @@ outlinercol[hidden="true"] {
deck {
display: -moz-deck;
-moz-binding: url("chrome://global/content/bindings/general.xml#deck");
}
stack, bulletinboard {