omadawn / njord

Java iRule Editor
2 stars 1 forks source link

Don't load the contents of a branch node until you expand it. #7

Open omadawn opened 12 years ago

omadawn commented 12 years ago

See http://docs.oracle.com/javase/tutorial/uiswing/events/treeexpansionlistener.html

omadawn commented 12 years ago

A great discussion of Lazy node expansion http://www.cs.oswego.edu/~lqiu/class/csc520-projectexamples/email/JTree_As_Directory.htm Which only builds the tree for the visible stuff. But it has issues, read the article for details.

For rebuilding the tree I will need to use treeNode.removeAllChildren() before repopulating Ultimately rebuilding the tree on an expansion event will involve extending defaultTreeNode or defaultMutableTreeNode to hold some state information like hasBeenExpanded to decide if I need to get the iRules or whatever.

omadawn commented 12 years ago

I might not need to do the whole fill in thing swing now has a tree will expand later listener so your non-leaf nodes will still have expanders even though they don't have leaf nodes. http://docs.oracle.com/javase/tutorial/uiswing/events/treewillexpandlistener.html

omadawn commented 12 years ago

I finally figured out the treeWillExpand issue. So even with treeWillExpand it still only shows an expansion widget if you have leaf nodes. The demo works because the node above the one that they wanted to expand lazily starts out closed. I still need to do the thing in the lazy node expansion article I referenced in the first comment.

omadawn commented 12 years ago

Moving to 1.0 since the current system is working very well.