Cycles in intermediate trees

asked 2013-02-28 14:06:17 +0800

avidD gravatar image avidD
166 2

updated 2013-02-28 14:08:20 +0800

Hello, we have several trees in our application, they can be thought of as explorers. Moreover, the application allows concurrent editing of the same trees. That is, two or more users can insert, delete, link, or move nodes in a tree. We also have the requirement that updates in one session are only done at certain points in time, namely, when the user decides to do so. Now, due to the situation described here (http://forum.zkoss.org/question/82354/faulty-tree-models/) we have to issue each single change as an event to ZK. A short version of this question is that I find the int[]-oriented event interface very problematic as the ints can change if nodes are moved. Another consequence of this situation now is that the tree can have intermediate states where there exists a cycle! Please note, that we would not have this situation if the event-interface and tree traversal were object-oriented. So this is the situation: The current tree for Alice is this:


Now Alice moves c under the root and a under d leading to this tree


When Bob requests the update we traverse the queue of pending tree updates and update each collection (list of children) as a whole because multiple operations by Alice (or even Charly) may have changed that collection. The problem is that ZK is now very sensitive to the order of events. For some reason each event causes ZK to traverse the paths even if more changes are pending (Probably because it is expected that paths may change before the nodes are redrawn?). So I now regularly run into this situation

root-a-b-c-d-a-b... (note the cycle that causes Bob's session to crash).

Can the traversal of the tree be somehow postponed until the point where the tree is actually redrawn? That is when all events are issued and the GUI-thread is ready to finish?

Greetings, David

delete flag offensive retag edit
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2013-02-28 14:06:17 +0800

Seen: 5 times

Last updated: Feb 28 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More