Hi,
I put your example up here:
http://www.resass.f2s.com/dynapi2/dynapi/Ed_Baxter_Examples/tree.htm
I changed the source a little,(Only for the All_Nets for the moment) NS
still needs some adjustment to recognize CSS for titles though.
I didn't find the reason for NS crashing after a search, all I found I found
was that NS passes a string instead of an object as parameter (anets).
(there's an alert to check for this value now) I don't think this is
tree-specific, as the All_Nets and All_Nodes work ok, it must be something
to do with the value of "anets" which the search passes to NewTree().
Also, It might be better to keep "all nodes", and "all nets" as two trees
(show/hide) to avoid writing *to* many layers, because browser memory is not
freed by deleting the tree.
Although it works nicely (apart from NS search), if you have memory problems
another approach would be to show/hide the nodes you need, or dynamically
add them to an existing tree (although I'm not quite sure how you could do
that).

Cheers,
Richard Bennett

[EMAIL PROTECTED]
www.richardinfo.com
(Everything running on, and ported to the 19/12/2000 snapshot of DynAPI2)
----- Original Message -----
From: "Ed Baxter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 07, 2001 2:26 AM
Subject: Re: [Dynapi-Help] trouble with dynamic rebuild of Ri Fast Tree
widget


> I forgot to mention in the original post that I am using Dynapi2 release
> 1/25/2001
>
>  On Tue, 06 Feb 2001, Ed Baxter wrote:
> >I'm hoping someone can help me with my implementation of Richard
Bennett's Fast
> >Tree Widget. I have included a copy of my code.
> >
> >Basically I am building the Tree dynamically from an array so that I can
alter
> >the data, then pass the new array to a function that builds a new tree
with the
> >new values. The page has a search function that builds the new tree using
only
> >array values that match the search criteria. The search results are the
part
> >that has been giving me trouble for several days now. The tree gives a
> >javascript error when an expand is attempted with Netscape (linux/4.72
and
> >NT4.0/4.76). IE5.5 works fine but has other problems (tree nodes are
blank).
> >
> >    JavaScript Error:
> >     http://[path to dynapi]/src/lib/dynapi/ri/fasttreenode.js, line 188:
> >     this.doc.images[this.id + "sw"] has no properties.
> >
> >To get the error, type "par" (no quotes) in the first search box and
press go,
> >then try to expand the new tree that is drawn.
> >
> >This does not happen when I delete the tree and rebuild using all of the
> >original data (All Nets button). I once added a pop-up and confirmed that
> >this.doc.images.length=1 but I am unable to access any properties and so
> >get the error. Funny thing is, the image IS displayed so it should have
some
> >properties! If I comment out line 188 referred to by the error then
things
> >work.
> >
> >Can anyone tell me what I'm missing? Is there a work around? Am I doing
> >something wrong?
> >
> >TIA,
> >Ed Baxter
> >----------------------- BEGIN Code ------------------------
> ><HTML>
> ><HEAD>
> ><TITLE>Ri Fast Tree Example</TITLE>
> ><SCRIPT language="Javascript" src="src/dynapi.js"></SCRIPT>
> ><SCRIPT language="Javascript">
> >var theme = "src/lib/dynapi/images/common/"
> >
> >DynAPI.setLibraryPath('src/lib/')
> >DynAPI.include('dynapi.api.*')
> >DynAPI.include('dynapi.ri.fasttreenode.js')
> >DynAPI.include('dynapi.util.thread.js');
> >DynAPI.include('dynapi.util.pathanim.js');
> >DynAPI.include('dynapi.gui.dynimage.js');
> >DynAPI.include('dynapi.gui.button.js');
> >DynAPI.include('dynapi.gui.scrollbar.js');
> >DynAPI.include('dynapi.gui.viewport.js');
> >DynAPI.include('dynapi.gui.scrollpane.js');
> >DynAPI.include('dynapi.gui.label.js');
> >DynAPI.include('dynapi.util.debug.js');
> >
> >function DrawMain() {
> >  // Get document width and height
> >   w = this.getDocument().getWidth()
> >   h = this.getDocument().getHeight()
> >   D = DynAPI.document
> >
> >   L1=new DynLayer(null,0,0,w,100,'#ffffff','hidden')
> >   L3=new DynLayer(null,0,101,w,40,'lightgreen','hidden')
> >   L5=new DynLayer(null,0,h-100,w,100,'#ffffff','hidden')
> >   L6=new DynLayer(null,0,150,w,100,'#ffffff','hidden')
> >
> >   D.addChild(L1);
> >   D.addChild(L3);
> >   D.addChild(L5);
> >   D.addChild(L6);
> >   L1.setVisible(true)
> >   L3.setVisible(true)
> >   L5.setVisible(true)
> >   L6.setVisible(true)
> >
> >   FillLayers();
> >   NewTree(ar,1);
> >}
> >function AllNets() {
> >  DelTree()
> >  NewTree(ar,1)
> >}
> >function AllNodes() {
> >  DelTree()
> >  NewTree(ar,2)
> >}
> >function FindNets(obj) {
> >  var chk = ""
> >  var k = -1
> >  anets = new Array()
> >  for (i=0;i<ar.length;i++) {
> >     chk =
ar[i].desc.toLowerCase().indexOf(obj.form[2].value.toLowerCase())
> >     if (chk >= 0) {
> >        k++
> >        anets[k] = ar[i]
> >     }
> >  }
> >  if (k < 0) {
> >     alert("No Match Found")
> >  } else {
> >     DelTree()
> >     NewTree(anets,1)
> >  }
> >}
> >function FindNodes(obj) {
> >  DelTree()
> >  NewTree(ar,1)
> >//    alert(obj.form[4].value);
> >}
> >function DelTree() {
> >   L4.deleteAllChildren()
> >   L4.deleteFromParent()
> >//alert(L4.debug())
> >}
> >
> >function NewTree(a,f) {
> >  alert("entering NewTree");
> >  L6.setHTML("<HTML><BODY> &nbsp <b>Loading Data...<IMG
SRC=src/lib/dynapi/images/common/busy.gif WIDTH=15
HEIGHT=15></BODY></HTML>")
> >  var node = new Array()
> >  if (f==1) {
> >     myTree = new RiFastSkinTreenode(0,0,600,'Nets',theme,16)
> >     myTree.setColor("lightblue")
> >      //  myTree.setBgColor("beige")      //Don't set anything for
transparent background
> >     tmp = "<TABLE WIDTH=100% BORDER=0 width=600><TR><TD><IMG
SRC=src/lib/dynapi/images/common/blank.gif WIDTH=16 HEIGHT=1></TD><TD NOWRAP
WIDTH=35%><b>Net Name</b></TD><TD NOWRAP WIDTH=25%><b>Total
Length</b></TD><TD NOWRAP WIDTH=20%><b>% Manhattan</b></TD><TD NOWRAP
WIDTH=10%><b>#Vias</b></TD><TD NOWRAP
WIDTH=10%><b>#Nodes</b></TD></TR></TABLE>"
> >     head=myTree.add(tmp)
> >     for (i=0;i<a.length;i++) {
> >       tmp = "<TABLE WIDTH=95%
BORDER=0><TR><TD>"+a[i].desc+"</TD></TR></TABLE>"
> >       node[i]=myTree.add(tmp)
> >       tmp2 = a[i].nodes
> >       tmp3 = tmp2.split("|")
> >       node[i].addNodeContent('<TABLE BORDER=0 WIDTH=500><TR><TD
WIDTH=30%><b>Node Name</b></TD><TD WIDTH=30%><b>Node Length</b></TD><TD
WIDTH=10%><b>#Vias</b></TD><TD WIDTH=30%><b>Net
Name</b></TD></TR></TABLE>','javascript:false()',theme+'blank.gif')
> >       for (x=0;x<tmp3.length;x++) {
> >          node[i].addNodeContent('<TABLE BORDER=1
WIDTH=500>'+tmp3[x]+'</TABLE>','javascript:alert(\'Hey\')',theme+'blue-doubl
e-dot.gif')
> >       }
> >       node[i].closeContent()
> >     }
> >  } else {
> >     myTree = new RiFastSkinTreenode(0,0,600,'Nodes',theme,16)
> >     myTree.setColor("lightblue")
> >      //  myTree.setBgColor("beige")      //Don't set anything for
transparent background
> >     tmp = "<TABLE BORDER=0 WIDTH=500><TR><TD WIDTH=30%><b>Node
Name</b></TD><TD WIDTH=30%><b>Node Length</b></TD><TD
WIDTH=10%><b>#Vias</b></TD><TD WIDTH=30%><b>Net Name</b></TD></TR></TABLE>"
> >     head=myTree.add(tmp)
> >     for (i=0;i<a.length;i++) {
> >       tmp2 = a[i].nodes
> >       tmp3 = tmp2.split("|")
> >       for (x=0;x<tmp3.length;x++) {
> >          myTree.addNodeContent('<TABLE BORDER=1
WIDTH=500>'+tmp3[x]+'</TABLE>','javascript:alert(\'Hey\')',theme+'blue-doubl
e-dot.gif')
> >       }
> >     }
> >    myTree.closeContent()
> >  }
> >  L4 = new ScrollPane(myTree)
> >  L4.setVisible(false)
> >  L4.moveTo(0,143)
> >  L4.setSize(w,h-250)
> >  L4.setBgColor('#ffffff')
> >  D.addChild(L4)
> >  L4.setVisible(true)
> >  myTree.setVisible(true)
> >//  myTree.openNode()     //call this to open first level on load
> >}
> >
> >var ar = new Array();
> >ar[0]=new Net("C_HLA_PAR</TD><TD WIDTH=30%>10444.76</TD><TD
WIDTH=20%>174.6</TD><TD WIDTH=10%>1</TD><TD WIDTH=5%>3","","","B40.59 &nbsp
3302.02 &nbsp 0 &nbsp C_HLA_PAR|J4.A105 &nbsp 1942.71 &nbsp 0 &nbsp
C_HLA_PAR|J40.59 &nbsp 5200.03 &nbsp 1 &nbsp C_HLA_PAR","","Node Label")
> >ar[1]=new Net("C_HLA_PD0</TD><TD WIDTH=30%>7458.28</TD><TD
WIDTH=20%>248.45</TD><TD WIDTH=10%>2</TD><TD WIDTH=5%>2","","","J4.A128
&nbsp 2561.72 &nbsp 1 &nbsp C_HLA_PD0|J40.27 &nbsp 4896.56 &nbsp 1 &nbsp
C_HLA_PD0","","Node Label")
> >ar[2]=new Net("C_HLA_PD1</TD><TD WIDTH=30%>6805.41</TD><TD
WIDTH=20%>219.55</TD><TD WIDTH=10%>2</TD><TD WIDTH=5%>2","","","J4.B128
&nbsp 1910.39 &nbsp 1 &nbsp C_HLA_PD1|J40.25 &nbsp 4895.02 &nbsp 1 &nbsp
C_HLA_PD1","","Node Label")
> >ar[3]=new Net("C_HLA_PD10</TD><TD WIDTH=30%>5579.76</TD><TD
WIDTH=20%>119.05</TD><TD WIDTH=10%>2</TD><TD WIDTH=5%>2","","","J4.B116
&nbsp 684.74 &nbsp 1 &nbsp C_HLA_PD10|J40.53 &nbsp 4895.02 &nbsp 1 &nbsp
C_HLA_PD10","","Node Label")
> >ar[4]=new Net("C_HLA_PD11</TD><TD WIDTH=30%>6716.67</TD><TD
WIDTH=20%>193</TD><TD WIDTH=10%>2</TD><TD WIDTH=5%>2","","","J4.A114 &nbsp
1821.65 &nbsp 1 &nbsp C_HLA_PD11|J40.51 &nbsp 4895.02 &nbsp 1 &nbsp
C_HLA_PD11","","Node Label")
> >ar[5]=new Net("C_HLA_PD12</TD><TD WIDTH=30%>5821.84</TD><TD
WIDTH=20%>133.3</TD><TD WIDTH=10%>2</TD><TD WIDTH=5%>2","","","J4.B112 &nbsp
926.82 &nbsp 1 &nbsp C_HLA_PD12|J40.41 &nbsp 4895.02 &nbsp 1 &nbsp
C_HLA_PD12","","Node Label")
> >
> >function FillLayers() {
> >L1.setHTML("Header")
> >L5.setHTML("Diagram Viewer")
> >L3.setHTML("<CENTER><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD
NOWRAP><FORM NAME=search><INPUT TYPE=button VALUE='All Nets'
onClick=javascript:AllNets()> &nbsp <INPUT TYPE=button VALUE='All Nodes'
onClick=javascript:AllNodes()> &nbsp <INPUT TYPE=text NAME=node
SIZE=30><INPUT TYPE=button VALUE='Go' onClick=javascript:FindNets(this)>
&nbsp <INPUT TYPE=text NAME=net SIZE=30><INPUT TYPE=button VALUE='Go'
onClick=javascript:FindNodes(this)></FORM></TD></TR></TABLE>")
> >}
> >function Net(d,p,l,n,np,npl) {
> >   this.desc = d;
> >   this.pict = p;
> >   this.lab = l;
> >   this.nodes = n;
> >   this.npict = np;
> >   this.nlabel = npl;
> >   return this;
> >}
> >DynAPI.onLoad=DrawMain;
> ></SCRIPT>
> ></HEAD>
> ><BODY BGCOLOR="#ffffff" onResize="document.location.href =
document.location.href">
> ></BODY>
> ></HTML>
> >---------------- END Code -----------------------------
> >
> >
> >_______________________________________________
> >Dynapi-Help mailing list
> >[EMAIL PROTECTED]
> >http://lists.sourceforge.net/lists/listinfo/dynapi-help
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help
> ____________________________________________________________
> Get your free domain name and domain-based e-mail from
> Namezero.com. New!  Namezero Plus domains now available.
> Find out more at: http://www.namezero.com
>


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to