This was ridiculously difficult and is probably still broken in many ways.
Here’s the simple explanation of what is supposed to happen:
1) You join two models together (as explained in my previous post.)
2) The parentChanged boolean field is set in the child.
3) OurGraphicalController detects this change in the child and fires off a message that contains the child’s parent’s name — as a string.
4) The server gets this message, finds the child about whom it refers, and changes the child’s parent to the Wicket referenced by the parent name string contained in the message.
5) The server sends the same message out to all clients. The same parent/child joining occurs.
5) All is well.
Unfortunately, step 4 requires corresponding Wickets on the server and each client to have the same name. Otherwise, sending the name of a child’s intended new parent will be useless. So I did a fair amount of work to be certain that Wicket names are synchronized. They are now named according to the SyncWrapper id that they happen to end up wrapped in. The problem with this is that the SyncWrapper id always starts out as -1 until it is set (via some back-and-forth message passing.) So for a short time the Wicket will have a weird name, like “tree.obj#-1.” But this name is changed fairly quickly. Hopefully there will never be a time when two Wickets have the same name. But I am not yet prepared to certify that this is the case until we do further testing.
To make a long story short, when everything goes properly, Wicket joining now works. In a perfect world, you can join two objects, move them around, log out, come back, and they will still be where you left them. And they will still be joined.
But the world is not perfect. I will blog about the current problematic issues momentarily.