mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
bug 213228: new toolkit independence bug, part 6.
fork and obsolete files
This commit is contained in:
parent
cabdc7c5ba
commit
ad4fc16ba2
@ -45,6 +45,15 @@ toolkit.jar:
|
||||
+ content/global/buildconfig.html (content/buildconfig.html)
|
||||
*+ content/global/dialogOverlay.xul (obsolete/content/dialogOverlay.xul)
|
||||
*+ content/global/dialogOverlay.js (obsolete/content/dialogOverlay.js)
|
||||
+ content/global/strres.js (obsolete/content/strres.js)
|
||||
+ content/global/wizardHandlerSet.js (obsolete/content/wizardHandlerSet.js)
|
||||
+ content/global/wizardManager.js (obsolete/content/wizardManager.js)
|
||||
+ content/global/wizardOverlay.js (obsolete/content/wizardOverlay.js)
|
||||
+ content/global/wizardOverlay.xul (obsolete/content/wizardOverlay.xul)
|
||||
+ content/global/nsTreeController.js (obsolete/content/nsTreeController.js)
|
||||
+ content/global/nsTreeSorting.js (obsolete/content/nsTreeSorting.js)
|
||||
+ content/global/nsClipboard.js (obsolete/content/nsClipboard.js)
|
||||
+ content/global/nsUserSettings.js (obsolete/content/nsUserSettings.js)
|
||||
|
||||
en-US.jar:
|
||||
+ locale/en-US/global/charset.dtd (locale/charset.dtd)
|
||||
@ -61,3 +70,9 @@ en-US.jar:
|
||||
+ locale/en-US/global/textcontext.dtd (locale/widgets/textcontext.dtd)
|
||||
+ locale/en-US/global/build.dtd (locale/build.dtd)
|
||||
*+ locale/en-US/global/dialogOverlay.dtd (obsolete/locale/dialogOverlay.dtd)
|
||||
+ locale/en-US/global/wizardManager.properties (obsolete/locale/wizardManager.properties)
|
||||
+ locale/en-US/global/wizardOverlay.dtd (obsolete/locale/wizardOverlay.dtd)
|
||||
+ locale/en-US/global/nsTreeSorting.properties (obsolete/locale/nsTreeSorting.properties)
|
||||
|
||||
classic.jar:
|
||||
+ skin/classic/global/wizardOverlay.css (obsolete/skin/wizardOverlay.css)
|
97
toolkit/obsolete/content/nsClipboard.js
Normal file
97
toolkit/obsolete/content/nsClipboard.js
Normal file
@ -0,0 +1,97 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Matthew Goodger <ben@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* nsClipboard - wrapper around nsIClipboard and nsITransferable
|
||||
* that simplifies access to the clipboard.
|
||||
**/
|
||||
var nsClipboard = {
|
||||
_CB: null,
|
||||
get mClipboard()
|
||||
{
|
||||
if (!this._CB)
|
||||
{
|
||||
const kCBContractID = "@mozilla.org/widget/clipboard;1";
|
||||
const kCBIID = Components.interfaces.nsIClipboard;
|
||||
this._CB = Components.classes[kCBContractID].getService(kCBIID);
|
||||
}
|
||||
return this._CB;
|
||||
},
|
||||
|
||||
currentClipboard: null,
|
||||
/**
|
||||
* Array/Object read (Object aFlavourList, long aClipboard, Bool aAnyFlag) ;
|
||||
*
|
||||
* returns the data in the clipboard
|
||||
*
|
||||
* @param FlavourSet aFlavourSet
|
||||
* formatted list of desired flavours
|
||||
* @param long aClipboard
|
||||
* the clipboard to read data from (kSelectionClipboard/kGlobalClipboard)
|
||||
* @param Bool aAnyFlag
|
||||
* should be false.
|
||||
**/
|
||||
read: function (aFlavourList, aClipboard, aAnyFlag)
|
||||
{
|
||||
this.currentClipboard = aClipboard;
|
||||
var data = nsTransferable.get(aFlavourList, this.getClipboardTransferable, aAnyFlag);
|
||||
return data.first.first; // only support one item
|
||||
},
|
||||
|
||||
/**
|
||||
* nsISupportsArray getClipboardTransferable (Object aFlavourList) ;
|
||||
*
|
||||
* returns a nsISupportsArray of the item on the clipboard
|
||||
*
|
||||
* @param Object aFlavourList
|
||||
* formatted list of desired flavours.
|
||||
**/
|
||||
getClipboardTransferable: function (aFlavourList)
|
||||
{
|
||||
const supportsContractID = "@mozilla.org/supports-array;1";
|
||||
const supportsIID = Components.interfaces.nsISupportsArray;
|
||||
var supportsArray = Components.classes[supportsContractID].createInstance(supportsIID);
|
||||
var trans = nsTransferable.createTransferable();
|
||||
for (var flavour in aFlavourList)
|
||||
trans.addDataFlavor(flavour);
|
||||
nsClipboard.mClipboard.getData(trans, nsClipboard.currentClipboard)
|
||||
supportsArray.AppendElement(trans);
|
||||
return supportsArray;
|
||||
}
|
||||
};
|
||||
|
91
toolkit/obsolete/content/nsJSComponentManager.js
Normal file
91
toolkit/obsolete/content/nsJSComponentManager.js
Normal file
@ -0,0 +1,91 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Matthew Goodger <ben@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var nsJSComponentManager = {
|
||||
createInstance: function (aContractID, aIID)
|
||||
{
|
||||
try
|
||||
{
|
||||
var iid = Components.interfaces[aIID];
|
||||
return Components.classes[aContractID].createInstance(iid);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
createInstanceByID: function (aID, aIID)
|
||||
{
|
||||
try
|
||||
{
|
||||
var iid = Components.interfaces[aIID];
|
||||
return Components.classesByID[aID].createInstance(iid);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
getService: function (aContractID, aIID)
|
||||
{
|
||||
try
|
||||
{
|
||||
var iid = Components.interfaces[aIID];
|
||||
return Components.classes[aContractID].getService(iid);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
getServiceByID: function (aID, aIID)
|
||||
{
|
||||
try
|
||||
{
|
||||
var iid = Components.interfaces[aIID];
|
||||
return Components.classesByID[aID].getService(iid);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
59
toolkit/obsolete/content/nsJSSupportsUtils.js
Normal file
59
toolkit/obsolete/content/nsJSSupportsUtils.js
Normal file
@ -0,0 +1,59 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Matthew Goodger <ben@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var nsJSSupportsUtils = {
|
||||
|
||||
createSupportsArray: function ()
|
||||
{
|
||||
return Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
},
|
||||
|
||||
createSupportsWString: function ()
|
||||
{
|
||||
return Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
},
|
||||
|
||||
createSupportsString: function ()
|
||||
{
|
||||
return Components.classes["@mozilla.org/supports-cstring;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsCString);
|
||||
}
|
||||
|
||||
};
|
321
toolkit/obsolete/content/nsTreeController.js
Normal file
321
toolkit/obsolete/content/nsTreeController.js
Normal file
@ -0,0 +1,321 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Blake Ross <blaker@netscape.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// helper routines, for doing rdf-based cut/copy/paste/etc
|
||||
// this needs to be more generic!
|
||||
|
||||
const nsTransferable_contractid = "@mozilla.org/widget/transferable;1";
|
||||
const clipboard_contractid = "@mozilla.org/widget/clipboard;1";
|
||||
const rdf_contractid = "@mozilla.org/rdf/rdf-service;1";
|
||||
const supportswstring_contractid = "@mozilla.org/supports-string;1";
|
||||
const rdfc_contractid = "@mozilla.org/rdf/container;1";
|
||||
|
||||
const nsISupportsString = Components.interfaces.nsISupportsString;
|
||||
const nsIClipboard = Components.interfaces.nsIClipboard;
|
||||
const nsITransferable = Components.interfaces.nsITransferable;
|
||||
const nsIRDFLiteral = Components.interfaces.nsIRDFLiteral;
|
||||
const nsIRDFContainer = Components.interfaces.nsIRDFContainer;
|
||||
|
||||
var gRDF;
|
||||
var gClipboard;
|
||||
|
||||
function isContainer(tree, index)
|
||||
{
|
||||
return tree.treeBoxObject.view.isContainer(index);
|
||||
}
|
||||
|
||||
function isContainerOpen(tree, index)
|
||||
{
|
||||
return tree.treeBoxObject.view.isContainerOpen(index);
|
||||
}
|
||||
|
||||
function nsTreeController_SetTransferData(transferable, flavor, text)
|
||||
{
|
||||
if (!text)
|
||||
return;
|
||||
var textData = Components.classes[supportswstring_contractid].createInstance(nsISupportsString);
|
||||
textData.data = text;
|
||||
|
||||
transferable.addDataFlavor(flavor);
|
||||
transferable.setTransferData(flavor, textData, text.length*2);
|
||||
}
|
||||
|
||||
function nsTreeController_copy()
|
||||
{
|
||||
var rangeCount = this.treeSelection.getRangeCount();
|
||||
if (rangeCount < 1)
|
||||
return false;
|
||||
|
||||
// Build a url that encodes all the select nodes
|
||||
// as well as their parent nodes
|
||||
var url = "";
|
||||
var text = "";
|
||||
var html = "";
|
||||
var min = new Object();
|
||||
var max = new Object();
|
||||
|
||||
for (var i = rangeCount - 1; i >= 0; --i) {
|
||||
this.treeSelection.getRangeAt(i, min, max);
|
||||
for (var k = max.value; k >= min.value; --k) {
|
||||
// If one of the selected items is
|
||||
// a container, ignore it.
|
||||
if (isContainer(this.tree, k))
|
||||
continue;
|
||||
var pageUrl = this.treeView.getCellText(k, "URL");
|
||||
var pageName = this.treeView.getCellText(k, "Name");
|
||||
|
||||
url += "ID:{" + pageUrl + "};";
|
||||
url += "NAME:{" + pageName + "};";
|
||||
|
||||
text += pageUrl + "\r";
|
||||
html += "<a href='" + pageUrl + "'>";
|
||||
if (pageName) html += pageName;
|
||||
html += "</a><p>";
|
||||
}
|
||||
}
|
||||
|
||||
if (!url)
|
||||
return false;
|
||||
|
||||
// get some useful components
|
||||
var trans = Components.classes[nsTransferable_contractid].createInstance(nsITransferable);
|
||||
|
||||
if (!gClipboard)
|
||||
gClipboard = Components.classes[clipboard_contractid].getService(Components.interfaces.nsIClipboard);
|
||||
|
||||
gClipboard.emptyClipboard(nsIClipboard.kGlobalClipboard);
|
||||
|
||||
this.SetTransferData(trans, "text/unicode", text);
|
||||
this.SetTransferData(trans, "moz/bookmarkclipboarditem", url);
|
||||
this.SetTransferData(trans, "text/html", html);
|
||||
|
||||
gClipboard.setData(trans, null, nsIClipboard.kGlobalClipboard);
|
||||
return true;
|
||||
}
|
||||
|
||||
function nsTreeController_cut()
|
||||
{
|
||||
if (this.copy()) {
|
||||
this.doDelete();
|
||||
return true; // copy succeeded, don't care if delete failed
|
||||
}
|
||||
return false; // copy failed, so did cut
|
||||
}
|
||||
|
||||
function nsTreeController_selectAll()
|
||||
{
|
||||
this.treeSelection.selectAll();
|
||||
}
|
||||
|
||||
function nsTreeController_delete()
|
||||
{
|
||||
var rangeCount = this.treeSelection.getRangeCount();
|
||||
if (rangeCount < 1)
|
||||
return false;
|
||||
|
||||
var datasource = this.tree.database;
|
||||
var dsEnum = datasource.GetDataSources();
|
||||
dsEnum.getNext();
|
||||
var ds = dsEnum.getNext()
|
||||
.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
||||
|
||||
var count = this.treeSelection.count;
|
||||
|
||||
// XXX 9 is a random number, just looking for a sweetspot
|
||||
// don't want to rebuild tree content for just a few items
|
||||
if (count > 9) {
|
||||
ds.beginUpdateBatch();
|
||||
}
|
||||
|
||||
var min = new Object();
|
||||
var max = new Object();
|
||||
var dirty = false;
|
||||
for (var i = rangeCount - 1; i >= 0; --i) {
|
||||
this.treeSelection.getRangeAt(i, min, max);
|
||||
for (var k = max.value; k >= min.value; --k) {
|
||||
if (!gRDF)
|
||||
gRDF = Components.classes[rdf_contractid].getService(Components.interfaces.nsIRDFService);
|
||||
|
||||
var IDRes = this.treeBuilder.getResourceAtIndex(k);
|
||||
if (!IDRes)
|
||||
continue;
|
||||
|
||||
var root = this.tree.getAttribute('ref');
|
||||
var parentIDRes;
|
||||
try {
|
||||
parentIDRes = this.treeBuilder.getResourceAtIndex(this.treeView.getParentIndex(k));
|
||||
}
|
||||
catch(ex) {
|
||||
parentIDRes = gRDF.GetResource(root);
|
||||
}
|
||||
if (!parentIDRes)
|
||||
continue;
|
||||
|
||||
// otherwise remove the parent/child assertion then
|
||||
var containment = gRDF.GetResource("http://home.netscape.com/NC-rdf#child");
|
||||
ds.Unassert(parentIDRes, containment, IDRes);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (count > 9) {
|
||||
ds.endUpdateBatch();
|
||||
}
|
||||
|
||||
if (dirty) {
|
||||
try {
|
||||
var remote = datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
|
||||
remote.Flush();
|
||||
} catch (ex) {
|
||||
}
|
||||
}
|
||||
if (max.value) {
|
||||
var newIndex = max.value - (max.value - min.value);
|
||||
if (newIndex >= this.treeView.rowCount)
|
||||
--newIndex;
|
||||
this.treeSelection.select(newIndex);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function nsTreeController(tree)
|
||||
{
|
||||
this._tree = tree;
|
||||
tree.controllers.appendController(this);
|
||||
}
|
||||
|
||||
nsTreeController.prototype =
|
||||
{
|
||||
_treeSelection: null,
|
||||
_treeView: null,
|
||||
_treeBuilder: null,
|
||||
_treeBoxObject: null,
|
||||
_tree: null,
|
||||
get tree()
|
||||
{
|
||||
return this._tree;
|
||||
},
|
||||
get treeBoxObject()
|
||||
{
|
||||
if (this._treeBoxObject)
|
||||
return this._treeBoxObject;
|
||||
return this._treeBoxObject = this.tree.treeBoxObject;
|
||||
},
|
||||
get treeView()
|
||||
{
|
||||
if (this._treeView)
|
||||
return this._treeView;
|
||||
return this._treeView = this.tree.treeBoxObject.view;
|
||||
},
|
||||
get treeSelection()
|
||||
{
|
||||
if (this._treeSelection)
|
||||
return this._treeSelection;
|
||||
return this._treeSelection = this.tree.treeBoxObject.view.selection;
|
||||
},
|
||||
get treeBuilder()
|
||||
{
|
||||
if (this._treeBuilder)
|
||||
return this._treeBuilder;
|
||||
return this._treeBuilder = this.tree.builder.
|
||||
QueryInterface(Components.interfaces.nsIXULTreeBuilder);
|
||||
},
|
||||
SetTransferData : nsTreeController_SetTransferData,
|
||||
|
||||
supportsCommand: function(command)
|
||||
{
|
||||
switch(command)
|
||||
{
|
||||
case "cmd_cut":
|
||||
case "cmd_copy":
|
||||
case "cmd_delete":
|
||||
case "cmd_selectAll":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
isCommandEnabled: function(command)
|
||||
{
|
||||
var haveCommand;
|
||||
switch (command)
|
||||
{
|
||||
// commands which do not require selection
|
||||
case "cmd_selectAll":
|
||||
var treeView = this.treeView;
|
||||
return (treeView.rowCount != treeView.selection.count);
|
||||
|
||||
// these commands require selection
|
||||
case "cmd_cut":
|
||||
haveCommand = (this.cut != undefined);
|
||||
break;
|
||||
case "cmd_copy":
|
||||
haveCommand = (this.copy != undefined);
|
||||
break;
|
||||
case "cmd_delete":
|
||||
haveCommand = (this.doDelete != undefined);
|
||||
break;
|
||||
}
|
||||
|
||||
// if we get here, then we have a command that requires selection
|
||||
var haveSelection = (this.treeSelection.count);
|
||||
return (haveCommand && haveSelection);
|
||||
},
|
||||
|
||||
doCommand: function(command)
|
||||
{
|
||||
switch(command)
|
||||
{
|
||||
case "cmd_cut":
|
||||
return this.cut();
|
||||
case "cmd_copy":
|
||||
return this.copy();
|
||||
case "cmd_delete":
|
||||
return this.doDelete();
|
||||
case "cmd_selectAll":
|
||||
return this.selectAll();
|
||||
}
|
||||
return false;
|
||||
},
|
||||
copy: nsTreeController_copy,
|
||||
cut: nsTreeController_cut,
|
||||
doDelete: nsTreeController_delete,
|
||||
selectAll: nsTreeController_selectAll
|
||||
}
|
||||
|
194
toolkit/obsolete/content/nsTreeSorting.js
Normal file
194
toolkit/obsolete/content/nsTreeSorting.js
Normal file
@ -0,0 +1,194 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
* Blake Ross <blakeross@telocity.com>
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
// utility routines for sorting
|
||||
|
||||
// re-does a sort based on the current state
|
||||
function RefreshSort()
|
||||
{
|
||||
var current_column = find_sort_column();
|
||||
SortColumn(current_column.id);
|
||||
}
|
||||
|
||||
// set the sort direction on the currently sorted column
|
||||
function SortInNewDirection(direction)
|
||||
{
|
||||
var current_column = find_sort_column();
|
||||
if (direction == "ascending")
|
||||
direction = "natural";
|
||||
else if (direction == "descending")
|
||||
direction = "ascending";
|
||||
else if (direction == "natural")
|
||||
direction = "descending";
|
||||
current_column.setAttribute("sortDirection", direction);
|
||||
SortColumn(current_column.id);
|
||||
}
|
||||
|
||||
function SortColumn(columnID)
|
||||
{
|
||||
var column = document.getElementById(columnID);
|
||||
column.parentNode.parentNode.treeBoxObject.view.cycleHeader(columnID, column);
|
||||
}
|
||||
|
||||
// search over the columns to find the first one with an active sort
|
||||
function find_sort_column()
|
||||
{
|
||||
var columns = document.getElementsByTagName('treecol');
|
||||
var i = 0;
|
||||
var column;
|
||||
while ((column = columns.item(i++)) != null) {
|
||||
if (column.getAttribute('sortDirection'))
|
||||
return column;
|
||||
}
|
||||
return columns.item(0);
|
||||
}
|
||||
|
||||
// get the sort direction for the given column
|
||||
function find_sort_direction(column)
|
||||
{
|
||||
var sortDirection = column.getAttribute('sortDirection');
|
||||
return (sortDirection ? sortDirection : "natural");
|
||||
}
|
||||
|
||||
// set up the menu items to reflect the specified sort column
|
||||
// and direction - put check marks next to the active ones, and clear
|
||||
// out the old ones
|
||||
// - disable ascending/descending direction if the tree isn't sorted
|
||||
// - disable columns that are not visible
|
||||
function update_sort_menuitems(column, direction)
|
||||
{
|
||||
var unsorted_menuitem = document.getElementById("unsorted_menuitem");
|
||||
var sort_ascending = document.getElementById('sort_ascending');
|
||||
var sort_descending = document.getElementById('sort_descending');
|
||||
|
||||
// as this function may be called from various places, including the
|
||||
// bookmarks sidebar panel (which doesn't have any menu items)
|
||||
// ensure that the document contains the elements
|
||||
if ((!unsorted_menuitem) || (!sort_ascending) || (!sort_descending))
|
||||
return;
|
||||
|
||||
if (direction == "natural") {
|
||||
unsorted_menuitem.setAttribute('checked','true');
|
||||
sort_ascending.setAttribute('disabled','true');
|
||||
sort_descending.setAttribute('disabled','true');
|
||||
sort_ascending.removeAttribute('checked');
|
||||
sort_descending.removeAttribute('checked');
|
||||
} else {
|
||||
sort_ascending.removeAttribute('disabled');
|
||||
sort_descending.removeAttribute('disabled');
|
||||
if (direction == "ascending") {
|
||||
sort_ascending.setAttribute('checked','true');
|
||||
} else {
|
||||
sort_descending.setAttribute('checked','true');
|
||||
}
|
||||
|
||||
var columns = document.getElementsByTagName('treecol');
|
||||
var i = 0;
|
||||
var column_node = columns[i];
|
||||
var column_name = column.id;
|
||||
var menuitem = document.getElementById('fill_after_this_node');
|
||||
menuitem = menuitem.nextSibling
|
||||
while (1) {
|
||||
var name = menuitem.getAttribute('column_id');
|
||||
if (!name) break;
|
||||
if (column_name == name) {
|
||||
menuitem.setAttribute('checked', 'true');
|
||||
break;
|
||||
}
|
||||
menuitem = menuitem.nextSibling;
|
||||
column_node = columns[++i];
|
||||
if (column_node && column_node.tagName == "splitter") {
|
||||
column_node = columns[++i];
|
||||
}
|
||||
}
|
||||
}
|
||||
enable_sort_menuitems();
|
||||
}
|
||||
|
||||
function enable_sort_menuitems()
|
||||
{
|
||||
var columns = document.getElementsByTagName('treecol');
|
||||
var menuitem = document.getElementById('fill_after_this_node');
|
||||
menuitem = menuitem.nextSibling
|
||||
for (var i = 0; (i < columns.length) && menuitem; ++i) {
|
||||
var column_node = columns[i];
|
||||
if (column_node.getAttribute("hidden") == "true")
|
||||
menuitem.setAttribute("disabled", "true");
|
||||
else
|
||||
menuitem.removeAttribute("disabled");
|
||||
menuitem = menuitem.nextSibling;
|
||||
}
|
||||
}
|
||||
|
||||
function fillViewMenu(popup)
|
||||
{
|
||||
var fill_after = document.getElementById('fill_after_this_node');
|
||||
var fill_before = document.getElementById('fill_before_this_node');
|
||||
var strBundle = document.getElementById('sortBundle');
|
||||
var sortString;
|
||||
if (strBundle)
|
||||
sortString = strBundle.getString('SortMenuItems');
|
||||
if (!sortString)
|
||||
sortString = "Sorted by %COLNAME%";
|
||||
|
||||
var firstTime = (fill_after.nextSibling == fill_before);
|
||||
if (firstTime) {
|
||||
var columns = document.getElementsByTagName('treecol');
|
||||
for (var i = 0; i < columns.length; ++i) {
|
||||
var column = columns[i];
|
||||
// Construct an entry for each cell in the row.
|
||||
var column_name = column.getAttribute("label");
|
||||
var item = document.createElement("menuitem");
|
||||
item.setAttribute("type", "radio");
|
||||
item.setAttribute("name", "sort_column");
|
||||
if (column_name == "")
|
||||
column_name = column.getAttribute("display");
|
||||
var name = sortString.replace(/%COLNAME%/g, column_name);
|
||||
item.setAttribute("label", name);
|
||||
item.setAttribute("oncommand", "SortColumn('" + column.id + "');");
|
||||
item.setAttribute("column_id", column.id);
|
||||
popup.insertBefore(item, fill_before);
|
||||
}
|
||||
}
|
||||
var sort_column = find_sort_column();
|
||||
var sort_direction = find_sort_direction(sort_column);
|
||||
update_sort_menuitems(sort_column, sort_direction);
|
||||
}
|
104
toolkit/obsolete/content/nsUserSettings.js
Normal file
104
toolkit/obsolete/content/nsUserSettings.js
Normal file
@ -0,0 +1,104 @@
|
||||
|
||||
/**
|
||||
* nsPreferences - a wrapper around nsIPrefService. Provides built in
|
||||
* exception handling to make preferences access simpler.
|
||||
**/
|
||||
var nsPreferences = {
|
||||
get mPrefService()
|
||||
{
|
||||
return Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
},
|
||||
|
||||
setBoolPref: function (aPrefName, aPrefValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.mPrefService.setBoolPref(aPrefName, aPrefValue);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
},
|
||||
|
||||
getBoolPref: function (aPrefName, aDefVal)
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.mPrefService.getBoolPref(aPrefName);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
return aDefVal != undefined ? aDefVal : null;
|
||||
}
|
||||
return null; // quiet warnings
|
||||
},
|
||||
|
||||
setUnicharPref: function (aPrefName, aPrefValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
var str = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
str.data = aPrefValue;
|
||||
this.mPrefService.setComplexValue(aPrefName,
|
||||
Components.interfaces.nsISupportsString, str);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
},
|
||||
|
||||
copyUnicharPref: function (aPrefName, aDefVal)
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.mPrefService.getComplexValue(aPrefName,
|
||||
Components.interfaces.nsISupportsString).data;
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
return aDefVal != undefined ? aDefVal : null;
|
||||
}
|
||||
return null; // quiet warnings
|
||||
},
|
||||
|
||||
setIntPref: function (aPrefName, aPrefValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.mPrefService.setIntPref(aPrefName, aPrefValue);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
},
|
||||
|
||||
getIntPref: function (aPrefName, aDefVal)
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.mPrefService.getIntPref(aPrefName);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
return aDefVal != undefined ? aDefVal : null;
|
||||
}
|
||||
return null; // quiet warnings
|
||||
},
|
||||
|
||||
getLocalizedUnicharPref: function (aPrefName, aDefVal)
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.mPrefService.getComplexValue(aPrefName,
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
return aDefVal != undefined ? aDefVal : null;
|
||||
}
|
||||
return null; // quiet warnings
|
||||
}
|
||||
};
|
||||
|
24
toolkit/obsolete/content/strres.js
Normal file
24
toolkit/obsolete/content/strres.js
Normal file
@ -0,0 +1,24 @@
|
||||
var strBundleService = null;
|
||||
|
||||
function srGetStrBundle(path)
|
||||
{
|
||||
var strBundle = null;
|
||||
|
||||
if (!strBundleService) {
|
||||
try {
|
||||
strBundleService =
|
||||
Components.classes["@mozilla.org/intl/stringbundle;1"].getService();
|
||||
strBundleService =
|
||||
strBundleService.QueryInterface(Components.interfaces.nsIStringBundleService);
|
||||
} catch (ex) {
|
||||
dump("\n--** strBundleService failed: " + ex + "\n");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
strBundle = strBundleService.createBundle(path);
|
||||
if (!strBundle) {
|
||||
dump("\n--** strBundle createInstance failed **--\n");
|
||||
}
|
||||
return strBundle;
|
||||
}
|
198
toolkit/obsolete/content/wizardHandlerSet.js
Normal file
198
toolkit/obsolete/content/wizardHandlerSet.js
Normal file
@ -0,0 +1,198 @@
|
||||
/* -*- Mode: Java; tab-width: 2; c-basic-offset: 2; -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben "Count XULula" Goodger <rgoodger@ihug.co.nz>
|
||||
*/
|
||||
|
||||
/** class WizardHandlerSet( WidgetStateManager sMgr, WizardManager wMgr ) ;
|
||||
* purpose: class for managing wizard navigation functions
|
||||
* in: WidgetStateManager sMgr WSM object created by WizardManager
|
||||
* WizardManager wMgr WM object created by WizardManager
|
||||
* out: nothing.
|
||||
**/
|
||||
function WizardHandlerSet( sMgr, wMgr )
|
||||
{
|
||||
// data mambers
|
||||
// wizard buttons
|
||||
this.backButton = document.getElementById("wiz-back-button");
|
||||
this.nextButton = document.getElementById("wiz-next-button");
|
||||
this.finishButton = document.getElementById("wiz-finish-button");
|
||||
this.cancelButton = document.getElementById("wiz-cancel-button");
|
||||
// wizard handlers
|
||||
this.nextButtonFunc = null;
|
||||
this.backButtonFunc = null;
|
||||
this.cancelButtonFunc = null;
|
||||
this.finishButtonFunc = null;
|
||||
this.pageLoadFunc = null;
|
||||
this.enablingFunc = null;
|
||||
|
||||
this.SM = sMgr;
|
||||
this.WM = wMgr;
|
||||
|
||||
// member functions
|
||||
this.SetHandlers = WHS_SetHandlers;
|
||||
|
||||
// construction (points member functions to right functions)
|
||||
this.SetHandlers( this.nextButtonFunc, this.backButtonFunc, this.finishButtonFunc,
|
||||
this.cancelButtonFunc, this.pageLoadFunc, this.enablingFunc );
|
||||
}
|
||||
|
||||
// default handler for next page in page sequence
|
||||
function DEF_onNext()
|
||||
{
|
||||
var oParent = this.WHANDLER;
|
||||
if( oParent.nextButton.getAttribute("disabled") == "true" )
|
||||
return;
|
||||
|
||||
// make sure page is valid!
|
||||
if (!oParent.SM.PageIsValid())
|
||||
return;
|
||||
|
||||
oParent.SM.SavePageData( this.currentPageTag, null, null, null ); // persist data
|
||||
if (this.wizardMap[this.currentPageTag]) {
|
||||
var nextPageTag = this.wizardMap[this.currentPageTag].next;
|
||||
this.LoadPage( nextPageTag, false ); // load the next page
|
||||
this.ProgressUpdate( ++this.currentPageNumber );
|
||||
} else {
|
||||
dump("Error: Missing an entry in the wizard map for " +
|
||||
this.currentPageTag + "\n");
|
||||
}
|
||||
}
|
||||
// default handler for previous page in sequence
|
||||
function DEF_onBack()
|
||||
{
|
||||
var oParent = this.WHANDLER;
|
||||
if( oParent.backButton.getAttribute("disabled") == "true" )
|
||||
return;
|
||||
oParent.SM.SavePageData( this.currentPageTag, null, null, null ); // persist data
|
||||
previousPageTag = this.wizardMap[this.currentPageTag].previous;
|
||||
this.LoadPage( previousPageTag, false ); // load the preivous page
|
||||
this.ProgressUpdate( --this.currentPageNumber );
|
||||
}
|
||||
// default handler for cancelling wizard
|
||||
function DEF_onCancel()
|
||||
{
|
||||
if( top.window.opener )
|
||||
window.close();
|
||||
}
|
||||
// default finish handler
|
||||
function DEF_onFinish()
|
||||
{
|
||||
var oParent = this.WHANDLER;
|
||||
if( !this.wizardMap[this.currentPageTag].finish )
|
||||
return;
|
||||
oParent.SM.SavePageData( this.currentPageTag, null, null, null );
|
||||
dump("WizardButtonHandlerSet Warning:\n");
|
||||
dump("===============================\n");
|
||||
dump("You must provide implementation for onFinish, or else your data will be lost!\n");
|
||||
}
|
||||
|
||||
// default button enabling ** depends on map, see doc
|
||||
function DEF_DoEnabling( nextButton, backButton, finishButton )
|
||||
{
|
||||
var oParent = this.WHANDLER;
|
||||
// make sure we're on a valid page
|
||||
if( !this.currentPageTag )
|
||||
return;
|
||||
// "next" button enabling
|
||||
var nextTag = this.wizardMap[this.currentPageTag].next;
|
||||
if( nextTag && oParent.nextButton.getAttribute("disabled") ) {
|
||||
oParent.nextButton.removeAttribute( "disabled" );
|
||||
}
|
||||
else if( !nextTag && !oParent.nextButton.getAttribute("disabled") ) {
|
||||
oParent.nextButton.setAttribute( "disabled", "true" );
|
||||
}
|
||||
// "finish" button enabling
|
||||
var finishTag = this.wizardMap[this.currentPageTag].finish;
|
||||
if( finishTag && oParent.finishButton.getAttribute("disabled") ) {
|
||||
oParent.finishButton.removeAttribute( "disabled" );
|
||||
}
|
||||
else if( !finishTag && !oParent.finishButton.getAttribute("disabled") ) {
|
||||
oParent.finishButton.setAttribute( "disabled", "true" );
|
||||
}
|
||||
// "back" button enabling
|
||||
var prevTag = this.wizardMap[this.currentPageTag].previous;
|
||||
if( prevTag && oParent.backButton.getAttribute("disabled") ) {
|
||||
oParent.backButton.removeAttribute("disabled");
|
||||
}
|
||||
else if( !prevTag && !oParent.backButton.getAttribute("disabled") ) {
|
||||
oParent.backButton.setAttribute("disabled", "true");
|
||||
}
|
||||
}
|
||||
|
||||
/** void PageLoaded( string tag, string frame_id ) ;
|
||||
* purpose: perform initial button enabling and call Startup routines.
|
||||
* in: string page tag referring to the file name of the current page
|
||||
* string frame_id optional supply of page frame, if content_frame is not
|
||||
* defined
|
||||
* out: nothing.
|
||||
**/
|
||||
function DEF_onPageLoad( tag )
|
||||
{
|
||||
var oParent = this.WHANDLER;
|
||||
this.currentPageTag = tag;
|
||||
if( this.DoButtonEnabling ) // if provided, call user-defined button
|
||||
this.DoButtonEnabling(); // enabling function
|
||||
if( this.content_frame ) {
|
||||
oParent.SM.SetPageData( tag, true ); // set page data in content frame
|
||||
|
||||
// set the focus to the first focusable element
|
||||
var doc = window.frames[0].document;
|
||||
if ("controls" in doc && doc.controls.length > 0) {
|
||||
var controls = doc.controls;
|
||||
for (var i=0; i< controls.length; i++) {
|
||||
if (controls[i].focus) {
|
||||
controls[i].focus();
|
||||
break; // stop when focus has been set
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dump("Widget Data Manager Error:\n");
|
||||
dump("==========================\n");
|
||||
dump("content_frame variable not defined. Please specify one as an argument to Startup();\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/** void SetHandlers( string nextFunc, string backFunc, string finishFunc, string cancelFunc,
|
||||
* string pageLoadFunc, string enablingFunc ) ;
|
||||
* purpose: allow user to assign button handler function names
|
||||
* in: strings referring to the names of the functions for each button
|
||||
* out: nothing.
|
||||
**/
|
||||
function WHS_SetHandlers( nextFunc, backFunc, finishFunc, cancelFunc, pageLoadFunc, enablingFunc )
|
||||
{
|
||||
// var oParent = this.WHANDLER;
|
||||
this.nextButtonFunc = nextFunc ;
|
||||
this.backButtonFunc = backFunc ;
|
||||
this.cancelButtonFunc = cancelFunc ;
|
||||
this.finishButtonFunc = finishFunc ;
|
||||
this.pageLoadFunc = pageLoadFunc ;
|
||||
this.enablingFunc = enablingFunc ;
|
||||
|
||||
// assign handlers to parent object
|
||||
// (handler functions are assigned to parent object)
|
||||
this.WM.onNext = ( !this.nextButtonFunc ) ? DEF_onNext : nextFunc ;
|
||||
this.WM.onBack = ( !this.backButtonFunc ) ? DEF_onBack : backFunc ;
|
||||
this.WM.onCancel = ( !this.cancelButtonFunc ) ? DEF_onCancel : cancelFunc ;
|
||||
this.WM.onFinish = ( !this.finishButtonFunc ) ? DEF_onFinish : finishFunc ;
|
||||
this.WM.onPageLoad = ( !this.pageLoadFunc ) ? DEF_onPageLoad : pageLoadFunc ;
|
||||
this.WM.DoButtonEnabling = ( !this.enablingFunc ) ? DEF_DoEnabling : enablingFunc ;
|
||||
}
|
171
toolkit/obsolete/content/wizardManager.js
Normal file
171
toolkit/obsolete/content/wizardManager.js
Normal file
@ -0,0 +1,171 @@
|
||||
/* -*- Mode: Java; tab-width: 4; c-basic-offset: 4; -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben "Count XULula" Goodger <rgoodger@ihug.co.nz>
|
||||
*/
|
||||
|
||||
/** class WizardManager( string frame_id, string tagURLPrefix,
|
||||
* string tagURLPostfix, object wizardMap ) ;
|
||||
* purpose: class for managing the state of a generic wizard
|
||||
* in: string frame_id content frame id/name
|
||||
* string tagURLPrefix prefix root of wizard pages
|
||||
* string tagURLPostfix extension suffix of wizard pages (e.g. ".xul")
|
||||
* object wizardMap navigation map object
|
||||
* out: nothing.
|
||||
**/
|
||||
function WizardManager( frame_id, tagURLPrefix, tagURLPostfix, wizardMap )
|
||||
{
|
||||
// current page
|
||||
this.currentPageTag = null;
|
||||
// data grid of navigable pages
|
||||
this.wizardMap = ( wizardMap ) ? wizardMap : null;
|
||||
// current page
|
||||
this.currentPageNumber = 0;
|
||||
// flag to signify no page-change occurred.
|
||||
this.firstTime = true; // was false, let's see what this does. o_O
|
||||
// frame which holds data
|
||||
this.content_frame = document.getElementById( frame_id );
|
||||
// wizard state manager
|
||||
this.WSM = new WidgetStateManager( frame_id );
|
||||
// wizard button handler set
|
||||
this.WHANDLER = new WizardHandlerSet( this.WSM, this );
|
||||
|
||||
// url handling
|
||||
this.URL_PagePrefix = ( tagURLPrefix ) ? tagURLPrefix : null;
|
||||
this.URL_PagePostfix = ( tagURLPostfix ) ? tagURLPrefix : null;
|
||||
|
||||
// string bundle
|
||||
this.bundle = srGetStrBundle("chrome://global/locale/wizardManager.properties");
|
||||
|
||||
this.LoadPage = WM_LoadPage;
|
||||
this.GetURLFromTag = WM_GetURLFromTag;
|
||||
this.GetTagFromURL = WM_GetTagFromURL;
|
||||
this.SetHandlers = WM_SetHandlers;
|
||||
this.SetPageData = WM_SetPageData;
|
||||
this.SavePageData = WM_SavePageData;
|
||||
this.ProgressUpdate = WM_ProgressUpdate;
|
||||
this.GetMapLength = WM_GetMapLength;
|
||||
|
||||
// set up handlers from wizard overlay
|
||||
// #include chrome://global/content/wizardOverlay.js
|
||||
doSetWizardButtons( this );
|
||||
}
|
||||
|
||||
/** void LoadPage( string page ) ;
|
||||
* purpose: loads a page into the content frame
|
||||
* in: string page tag referring to the complete file name of the current page
|
||||
* string frame_id optional supply of page frame, if content_frame is not
|
||||
* defined
|
||||
* out: boolean success indicator.
|
||||
**/
|
||||
function WM_LoadPage( pageURL, absolute )
|
||||
{
|
||||
if( pageURL != "" )
|
||||
{
|
||||
if ( this.firstTime && !absolute )
|
||||
this.ProgressUpdate( this.currentPageNumber );
|
||||
|
||||
// 1.1: REMOVED to fix no-field-page-JS error bug. reintroduce if needed.
|
||||
// if ( !this.firstTime )
|
||||
// this.WSM.SavePageData( this.content_frame );
|
||||
|
||||
// build a url from a tag, or use an absolute url
|
||||
if( !absolute ) {
|
||||
var src = this.GetURLFromTag( pageURL );
|
||||
} else {
|
||||
src = pageURL;
|
||||
}
|
||||
if( this.content_frame )
|
||||
this.content_frame.setAttribute("src", src);
|
||||
else
|
||||
return false;
|
||||
|
||||
this.firstTime = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/** string GetUrlFromTag( string tag ) ;
|
||||
* - purpose: creates a complete URL based on a tag.
|
||||
* - in: string tag representing the specific page to be loaded
|
||||
* - out: string url representing the complete location of the page.
|
||||
**/
|
||||
function WM_GetURLFromTag( tag )
|
||||
{
|
||||
return this.URL_PagePrefix + tag + this.URL_PagePostfix;
|
||||
}
|
||||
/** string GetTagFromURL( string tag ) ;
|
||||
* - purpose: fetches a tag from a URL
|
||||
* - in: string url representing the complete location of the page.
|
||||
* - out: string tag representing the specific page to be loaded
|
||||
**/
|
||||
function WM_GetTagFromURL( url )
|
||||
{
|
||||
return url.substring(this.URL_PagePrefix.length, this.URL_PagePostfix.length);
|
||||
}
|
||||
|
||||
// SetHandlers pass-through for setting wizard button handlers easily
|
||||
function WM_SetHandlers( onNext, onBack, onFinish, onCancel, onPageLoad, enablingFunc )
|
||||
{
|
||||
this.WHANDLER.SetHandlers( onNext, onBack, onFinish, onCancel, onPageLoad, enablingFunc );
|
||||
}
|
||||
// SetPageData pass-through
|
||||
function WM_SetPageData()
|
||||
{
|
||||
this.WSM.SetPageData();
|
||||
}
|
||||
// SavePageData pass-through
|
||||
function WM_SavePageData()
|
||||
{
|
||||
this.WSM.SavePageData();
|
||||
}
|
||||
|
||||
/** int GetMapLength()
|
||||
* - purpose: returns the number of pages in the wizardMap
|
||||
* - in: nothing
|
||||
* - out: integer number of pages in wizardMap
|
||||
**/
|
||||
function WM_GetMapLength()
|
||||
{
|
||||
var count = 0;
|
||||
for ( i in this.wizardMap )
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
/** void ProgressUpdate ( int currentPageNumber );
|
||||
* - purpose: updates the "page x of y" display if available
|
||||
* - in: integer representing current page number.
|
||||
* - out: nothing
|
||||
**/
|
||||
function WM_ProgressUpdate( currentPageNumber )
|
||||
{
|
||||
var statusbar = document.getElementById ( "status" );
|
||||
if ( statusbar ) {
|
||||
var string;
|
||||
try {
|
||||
string = this.bundle.formatStringFromName("oflabel",
|
||||
[currentPageNumber+1,
|
||||
this.GetMapLength()], 2);
|
||||
} catch (e) {
|
||||
string = "";
|
||||
}
|
||||
statusbar.setAttribute( "progress", string );
|
||||
}
|
||||
}
|
||||
|
69
toolkit/obsolete/content/wizardOverlay.js
Normal file
69
toolkit/obsolete/content/wizardOverlay.js
Normal file
@ -0,0 +1,69 @@
|
||||
/**
|
||||
* Wizard button controllers.
|
||||
* - Note:
|
||||
* - less infrastructure is provided here than for dialog buttons, as
|
||||
* - closing is not automatically desirable for many wizards (e.g. profile
|
||||
* - creation) where proper application shutdown is required. thus these
|
||||
* - functions simply pass this responsibility on to the wizard designer.
|
||||
* -
|
||||
* - Use: Include this JS file in your wizard XUL and the accompanying
|
||||
* - wizardOverlay.xul file as an overlay. Then set the overlay handlers
|
||||
* - with doSetWizardButtons(). It is recommended you use this overlay
|
||||
* - with the WizardManager wizard infrastructure. If you do that, you
|
||||
* - don't need to do anything here. Otherwise, use doSetWizardButtons()
|
||||
* - with false or null passed in as the first parameter, and the names
|
||||
* - of your functions passed in as the remaining parameters, see below.
|
||||
* -
|
||||
* - Ben Goodger (04/11/99)
|
||||
**/
|
||||
|
||||
var doNextFunction = null;
|
||||
var doBackFunction = null;
|
||||
var doFinishFunction = null;
|
||||
var doCancelFunction = null;
|
||||
|
||||
// call this from dialog onload() to allow buttons to call your code.
|
||||
function doSetWizardButtons( wizardManager, nextFunc, backFunc, finishFunc, cancelFunc )
|
||||
{
|
||||
if(wizardManager) {
|
||||
doNextFunction = wizardManager.onNext;
|
||||
doBackFunction = wizardManager.onBack;
|
||||
doFinishFunction = wizardManager.onFinish;
|
||||
doCancelFunction = wizardManager.onCancel;
|
||||
} else {
|
||||
doNextFunction = nextFunc;
|
||||
doBackFunction = backFunc;
|
||||
doFinishFunction = finishFunc;
|
||||
doCancelFunction = cancelFunc;
|
||||
}
|
||||
}
|
||||
|
||||
// calls function specified for "next" button click.
|
||||
function doNextButton()
|
||||
{
|
||||
if ( doNextFunction )
|
||||
doNextFunction();
|
||||
}
|
||||
|
||||
// calls function specified for "back" button click.
|
||||
function doBackButton()
|
||||
{
|
||||
if ( doBackFunction )
|
||||
doBackFunction();
|
||||
}
|
||||
|
||||
// calls function specified for "finish" button click.
|
||||
function doFinishButton()
|
||||
{
|
||||
if ( doFinishFunction )
|
||||
doFinishFunction();
|
||||
}
|
||||
|
||||
// calls function specified for "cancel" button click.
|
||||
function doCancelButton()
|
||||
{
|
||||
if ( doCancelFunction )
|
||||
doCancelFunction();
|
||||
}
|
||||
|
||||
|
22
toolkit/obsolete/content/wizardOverlay.xul
Normal file
22
toolkit/obsolete/content/wizardOverlay.xul
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE overlay SYSTEM "chrome://global/locale/wizardOverlay.dtd">
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/wizardOverlay.css" type="text/css"?>
|
||||
|
||||
<overlay id="wizardOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- Wizard Buttons -->
|
||||
<hbox id="wizardButtons">
|
||||
<spacer flex="100%"/>
|
||||
<button id="wiz-cancel-button" label="&cancelButton.label;" oncommand="wizardManager.onCancel();" />
|
||||
<spacer flex="20%"/>
|
||||
<button id="wiz-back-button" label="&backButton.label;" oncommand="wizardManager.onBack();"/>
|
||||
<button class="right" id="wiz-next-button" label="&nextButton.label;" oncommand="wizardManager.onNext();"/>
|
||||
<spacer flex="5%"/>
|
||||
<button id="wiz-finish-button" label="&finishButton.label;" oncommand="wizardManager.onFinish();" />
|
||||
<spacer flex="5%"/>
|
||||
</hbox>
|
||||
|
||||
</overlay>
|
1
toolkit/obsolete/locale/nsTreeSorting.properties
Normal file
1
toolkit/obsolete/locale/nsTreeSorting.properties
Normal file
@ -0,0 +1 @@
|
||||
SortMenuItems=Sorted by %COLNAME%
|
3
toolkit/obsolete/locale/wizardManager.properties
Normal file
3
toolkit/obsolete/locale/wizardManager.properties
Normal file
@ -0,0 +1,3 @@
|
||||
finishButtonLabel=Finish
|
||||
nextButtonLabel=Next
|
||||
oflabel=%S of %S
|
6
toolkit/obsolete/locale/wizardOverlay.dtd
Normal file
6
toolkit/obsolete/locale/wizardOverlay.dtd
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
<!ENTITY cancelButton.label "Cancel">
|
||||
<!ENTITY backButton.label "Back">
|
||||
<!ENTITY nextButton.label "Next">
|
||||
<!ENTITY finishButton.label "Finish">
|
||||
|
27
toolkit/obsolete/skin/wizardOverlay.css
Normal file
27
toolkit/obsolete/skin/wizardOverlay.css
Normal file
@ -0,0 +1,27 @@
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
#wiz-back-button {
|
||||
list-style-image : url("chrome://global/skin/scroll-left.gif");
|
||||
}
|
||||
#wiz-back-button[disabled] {
|
||||
list-style-image : url("chrome://global/skin/scroll-left-disabled.gif");
|
||||
}
|
||||
#wiz-next-button {
|
||||
list-style-image : url("chrome://global/skin/scroll-right.gif");
|
||||
}
|
||||
#wiz-next-button[disabled] {
|
||||
list-style-image : url("chrome://global/skin/scroll-right-disabled.gif");
|
||||
}
|
||||
|
||||
#wizardButtons
|
||||
{
|
||||
margin-bottom : 0.4em;
|
||||
}
|
||||
|
||||
.box-wizardcontent
|
||||
{
|
||||
margin-left : 44px;
|
||||
margin-right : 44px;
|
||||
width : 30em;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user