I added the following code and it correctly refreshed the node: DefaultTreeModel model = (DefaultTreeModel)tree.getModelObject(); int[] changes = new int[]{model.getIndexOfChild(parentNode, newNode)}; model.nodesWereInserted((TreeNode)parentNode, changes);
The time difference seemed close to invalidateAll(). invalidateAll() took about 24 seconds while the new method took 23 seconds. It is likely that they are the same speed as I was counting in my head and only ran the test once. The test was with 875 nodes open in the tree...so that is about 1 second for every 35 nodes. I think a typical user will have about 90 nodes in the tree at the most and 30 on average, so between 2.5 and 1 second(s) to wait for the node to display after clicking save. The speed I am seeing may just be the time it takes to render in the browser. If that is the case, then I am fine with it. I just want to make sure I am correctly updating the tree and not making it work harder than it needs to. I also tried tree.updateTree() after I added the node and found that it did not solve the refresh problem. When you said call update() on the model what function should I be calling (I don't see update in the API)? Thanks for your help! Matej Knopp-2 wrote: > > Make sure your tree model fires the appropriate events when your tree > is modified. The Tree implementation should properly update the > changed portions of tree (assuming you call the update() method). > > -Matej > > On Fri, Mar 14, 2008 at 1:27 AM, jeredm <[EMAIL PROTECTED]> > wrote: >> >> I have a LinkTree where am adding new nodes via AJAX where the node is >> not >> visually refreshing until I call myLinkTree.invalidateAll();. The >> problem >> is that the tree refresh takes too long when I have a bunch of nodes >> displayed. AbstractTree.invalidateAll() appears to "redraw" the whole >> tree, >> but I only need to "redraw" the single node (I may be wrong on this and >> it >> may be working exactly as I need it to, but it is slow). >> >> My basic setup is a tree on the left that dynamically swaps out panels >> via >> AJAX on the right based on the node selected. The tree itself only >> starts >> with the root and first children. All first children load their child >> nodes >> via an AJAX call on expand. These nodes will correctly refresh as the >> nodes >> are added and then the parent is expanded. I cannot collapse and >> re-expand >> the parent node in this case as expanding a node would cause the tree to >> close nodes the user has already opened. What I need is to be able to >> insert a node like so... >> >> - My Root >> |--First Child >> |-- First Grandchild >> |-- NEW NODE >> |-- Last Grandchild >> >> I need the First Grandchild and Last Grandchild to already be expanded >> and >> displaying before I add NEW NODE. >> >> -- >> View this message in context: >> http://www.nabble.com/LinkTree-Node-Refresh-tp16041813p16041813.html >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > > -- > Resizable and reorderable grid components. > http://www.inmethod.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/LinkTree-Node-Refresh-tp16041813p16048613.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]