[SWINGX-1442] Fix scalability when expanding a very large treetable Created: 03/May/11 Updated: 26/Aug/11 Resolved: 20/Aug/11
|Remaining Estimate:||Not Specified|
|Time Spent:||Not Specified|
|Original Estimate:||Not Specified|
Mac OS X,
I fixed a problem with expanding all of the nodes in a very large JXTreeTable. The problem is that JXTreeTable.expandAll() ends up calling TreeTableCellRenderer.getExpandedDescendants() for every expanded node; and it is recursive which make it very expensive. It takes a couple of minutes to open 25K nodes with four levels of descendents.
The fix is to override getExpandedDescendants() so that it does nothing during an expandAll()
+ public boolean skipExpandedDescendants = false;
+ return super.getExpandedDescendants(parent); //To change body of overridden methods use File | Settings | File Templates.
|Comment by kleopatra [ 20/Aug/11 ]|
thanks for your contribution
Tend to not apply it, though, as it is kind of hackish and might prevent proper state synch between the tree and its state as kept in the ui-delegate.
The method by itself is not meant for handling large and/or deep trees (note to myself: better document) - in such a case application code needs to take special care to not block the ui by doing the expand in the background and reporting back to the ui as appropriate.
A long standing task (don't recall if we ever formally opened an issue for it) is to support that background expansion somehow: however long it takes, the user only sees a small viewport of the total tree. So the task would imply some "intelligent" expanding near the current scroll position.
|Comment by permeable [ 21/Aug/11 ]|
I did not expect my change to be accepted for the same reasons you mention. My manager asked me to contribute my change back to the project. It is the simplest solution, not the most-correct. I look forward to the completion of the long standing task to support background expansion. Thanks.
|Comment by kleopatra [ 24/Aug/11 ]|
fair enough, and thanks again for bringing it up and providing a hack
BTW, started a discussion at swinglabs forum