Changes for new tree widget landed last night.

This commit is contained in:
hangas%netscape.com 1999-06-23 23:49:19 +00:00
Родитель 035f124138
Коммит 0f353109c3
6 изменённых файлов: 11 добавлений и 101 удалений

Просмотреть файл

@ -47,7 +47,6 @@ function OnLoadAddressBook()
function ChangeDirectoryByDOMNode(dirNode)
{
dump("-----------------ChangeDirectoryByDOMNode----------------\n");
var uri = dirNode.getAttribute('id');
dump(uri + "\n");
ChangeDirectoryByURI(uri);
@ -56,7 +55,7 @@ function ChangeDirectoryByDOMNode(dirNode)
function ChangeDirectoryByURI(uri)
{
var tree = frames[0].frames[1].document.getElementById('resultTree');
dump("tree = " + tree + "\n");
//dump("tree = " + tree + "\n");
var treechildrenList = tree.getElementsByTagName('treechildren');
if ( treechildrenList.length == 1 )
@ -64,7 +63,6 @@ function ChangeDirectoryByURI(uri)
var body = treechildrenList[0];
body.setAttribute('id', uri);// body no longer valid after setting id.
}
dump("------------end--ChangeDirectoryByDOMNode---end----------\n");
}
@ -78,7 +76,7 @@ function saChangeDirectoryByDOMNode(dirNode)
function saChangeDirectoryByURI(uri)
{
var tree = frames["browser.selAddrResultPane"].document.getElementById('resultTree');
dump("tree = " + tree + "\n");
//dump("tree = " + tree + "\n");
var treechildrenList = tree.getElementsByTagName('treechildren');
if ( treechildrenList.length == 1 )
@ -314,15 +312,15 @@ function AddSelectedAddressesIntoBucket(prefix)
AddAddressIntoBucket(bucketDoc, address);
}
}
DumpDOM(bucketDoc.documentElement);
}
function AddAddressIntoBucket(doc, address)
{
var tree = doc.getElementById('addressBucket');
var body = doc.getElementById("bucketBody");
var item = doc.getElementById("bucketItem");
var item = doc.createElement('treeitem');
//newitem.setAttribute("rowID", num);
//newitem.setAttribute("rowName", name);
@ -333,7 +331,6 @@ function AddAddressIntoBucket(doc, address)
cell.appendChild(text);
row.appendChild(cell);
item.appendChild(row);
body.appendChild(item);
}
function RemoveSelectedFromBucket()
@ -351,78 +348,3 @@ function RemoveSelectedFromBucket()
}
}
}
// ----------------------
// DumpDOM(node)
// FIX ME!
// This code should be removed when we land in the tip, it has been replaced by DumpDOM.js
// ----------------------
function DumpDOM(node)
{
dump("--------------------- DumpDOM ---------------------\n");
DumpNodeAndChildren(node, "");
dump("------------------- End DumpDOM -------------------\n");
}
// This function does the work of DumpDOM by recursively calling itself to explore the tree
function DumpNodeAndChildren(node, prefix)
{
dump(prefix + "<" + node.nodeName);
if ( node.nodeType == 1 )
{
// id
var text = node.getAttribute('id');
if ( text && text[0] != '$' )
dump(" id=\"" + text + "\"");
DumpAttribute(node, "name");
DumpAttribute(node, "class");
DumpAttribute(node, "style");
DumpAttribute(node, "flex");
DumpAttribute(node, "value");
DumpAttribute(node, "src");
DumpAttribute(node, "onclick");
DumpAttribute(node, "onchange");
}
if ( node.nodeName == "#text" )
dump(" = \"" + node.data + "\"");
dump(">\n");
// dump IFRAME && FRAME DOM
if ( node.nodeName == "IFRAME" || node.nodeName == "FRAME" )
{
if ( node.name )
{
var wind = top.frames[node.name];
if ( wind && wind.document && wind.document.documentElement )
{
dump(prefix + "----------- " + node.nodeName + " -----------\n");
DumpNodeAndChildren(wind.document.documentElement, prefix + " ");
dump(prefix + "--------- End " + node.nodeName + " ---------\n");
}
}
}
// children of nodes (other than frames)
else
{
var child = 0;
while ( node.childNodes && child < node.childNodes.length )
{
DumpNodeAndChildren(node.childNodes[child], prefix + " ");
child++;
}
}
}
function DumpAttribute(node, attribute)
{
var text = node.getAttribute(attribute);
if ( text )
dump(" " + attribute + "=\"" + text + "\"");
}

Просмотреть файл

@ -111,6 +111,7 @@
onload="OnLoadAddressBook()">
<html:script language="JavaScript" src="chrome://addressbook/content/addressbook.js"/>
<html:script language="JavaScript" src="resource://res/samples/DumpDOM.js"/>
<menubar>
<menu name="&fileMenu.label;">

Просмотреть файл

@ -18,7 +18,7 @@
<treecol style="width:100%"/>
<treechildren id="bucketBody">
<treeitem>
<treeitem id="bucketItem">
<treerow>
<treecell/>
</treerow>

Просмотреть файл

@ -38,11 +38,10 @@
</treerow>
</treehead>
<treechildren rdf:containment="http://home.netscape.com/NC-rdf#child" rdf:ignore="http://home.netscape.com/NC-rdf#CardChild">
<treechildren rdf:containment="http://home.netscape.com/NC-rdf#child"
rdf:ignore="http://home.netscape.com/NC-rdf#CardChild"
open="true">
<treeitem ref="abdirectory:/" open="true">
<treerow>
<treecell/>
</treerow>
</treeitem>
</treechildren>
</tree>

Просмотреть файл

@ -71,16 +71,7 @@
</treerow>
</treehead>
<treechildren id="" name="cardTreeBody">
<treeitem>
<treerow><treecell/></treerow>
<treerow><treecell/></treerow>
<treerow><treecell/></treerow>
<treerow><treecell/></treerow>
<treerow><treecell/></treerow>
<treerow><treecell/></treerow>
</treeitem>
</treechildren>
<treechildren id="" name="cardTreeBody" open="true"/>
</tree>
</window>

Просмотреть файл

@ -59,7 +59,7 @@ Rights Reserved.
style="width:100%; height:100%; padding:0px">
<html:script language="JavaScript" src="chrome://addressbook/content/addressbook.js"/>
<html:script language="JavaScript" src="resource://res/samples/DumpDOM.js"/>
<box align="vertical" style="width:100%; height:100%">
<!-- Thin box across top, show names containing & stop, search buttons -->
@ -95,9 +95,6 @@ Rights Reserved.
<treechildren rdf:containment="http://home.netscape.com/NC-rdf#child" rdf:ignore="http://home.netscape.com/NC-rdf#CardChild">
<treeitem ref="abdirectory:/" open="true">
<treerow>
<treecell/>
</treerow>
</treeitem>
</treechildren>
</tree>