Menu

#138 TreeLayout doesn't layout later-added vertexes correctly

open
nobody
5
2009-11-17
2009-11-17
Eric Kok
No

The TreeLayout does a 1 time rendering of the vertexes of a tree. So every vertex that is in the tree the first time it is rendered is placed okay.

However, childs that are added later on ARE rendered but NOT at the correct place. Rather, the layout should re-calculate the placing of all vertexes. (Or alternatively only the newly added child.)

A simple demo is attahed showing the problem. (New nodes get added every 2 seconds, which are then incorrectly placed.)

Discussion

  • Eric Kok

    Eric Kok - 2009-11-17

    Test app showing the bug

     
  • Andre Holzner

    Andre Holzner - 2010-10-03

    As I workaround, I wrote a small class inheriting from TreeLayout which implements the following method:

    public void updateLayout()
    {
    this.alreadyDone.clear();
    this.buildTree();
    }

    Not sure whether this 100% correct, but it seems to work.

    Caveats:
    - I have to call this method by hand after modifying the tree to be displayed
    - the positions of previously existing nodes (e.g. the root) on the display move with respect to the situation before adding/removing edges/vertices.

    Obviously, it would be nicer if the layout would listen to changes of the tree content and update itself...

     

Log in to post a comment.

MongoDB Logo MongoDB