Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsLayouting a large number of draw2d widgets in a Canvas
https://www.eclipse.org/forums/index.php/mv/msg/489133/1064029/#msg_1064029
I am attaching a part of one of our diagrams in Image:
The problem is this: the nodes in the tree can be collapsed or expanded. When the number of Nodes in the Tree are of the order of 1000-2000, then the Collapse/Expand takes place momentarily. However, when the node count goes higher, it takes more and more time to Collapse/Expand any particular node, which is irritating.
I have written some sample code to see, if the problem is with our code, or, that draw2d performance degrades in general with more number of widgets. The same problem exists within the sample application, which indicates that we may have to do some optimizations within the draw2d codebase itself. I made a View in Eclipse to demonstrate that. The code of the same is attached as an Eclipse RCP Project.
Try to expand/collapse figures in the View (by clicking on the "x" or ">" buttons), it'll take time (won't occur instantaneously). Can anyone please provide some pointers as to how this problem can be solved?
Thanks in advance.]]>Saurabh Srivastava2013-06-17T10:59:57-00:00Re: Layouting a large number of draw2d widgets in a Canvas
https://www.eclipse.org/forums/index.php/mv/msg/489133/1064058/#msg_1064058
looking at the TreeTest I think the problem is that all nodes have the same parent.
When you do a change in any of the node or its children, the whole branch of the figure tree is revalidated.
So the contentPanel figure layouts all its children (all nodes) and that is very slow.
I'm not sure I'm capable of providing a solution for you. You could separate the tree to rows,
where every row would be an independent Figure with the GridLayout. So when you collapse/expand it, all other rows don't need to revalidate (layout).
You could also experiment with overriding isValidationRoot() method where revalidate chain stops.]]>Jan Krakora2013-06-17T13:07:47-00:00Re: Layouting a large number of draw2d widgets in a Canvas
https://www.eclipse.org/forums/index.php/mv/msg/489133/1064065/#msg_1064065
Thanks for the link, it was surely helpful. Yes I know there is no direct solution probably. I'll need to do some experimentation. Thanks for the suggestion. It is bound to be at least as good as what the current application is, performance wise.
I will post my observations here in case they may help anyone else.]]>Saurabh Srivastava2013-06-17T13:34:03-00:00Re: Layouting a large number of draw2d widgets in a Canvas
https://www.eclipse.org/forums/index.php/mv/msg/489133/1064195/#msg_1064195
Thanks a lot for the suggestion. The performance has improved significantly, and it will work for now.
If anyone faces a similar situation, it is therefore suggested to "group" figures into higher level figures. This will surely make the layouting much better.
I am also attaching the Sample Modified Code, which compares two approaches, side by side.