Adding Existing Items During Creating (Create and Move) [message #644145] |
Thu, 09 December 2010 16:52 |
Erik Englund Messages: 49 Registered: July 2009 |
Member |
|
|
In my diagram I have a NodeA that can be by itself or contained within NodeB.
I would like to be able to create a NodeB with the palette and click and drag a box around some existing NodeA's. And then during the creation process move those Nodes into NodeB.
Here is what I've tried:
In the diagram SematicEditPolicy override the GetCommand for CreateViewAndElementsRequest. Find the NodeA's that are within the target area and add them as a list to the request parameter map. And then at the end return a composite command of the super.getCommand(), which is usually null, and a delete View command for each NodeA that is going to be moved.
Also, I override the NodeB edit helper getConfigureCommand to return a MoveCommand to move the items from the root container into the sub container.
This seems to work. However, I am occasionally getting a NullPointer during the getOrphan request. It seems the GetParent is returning null. This may be unrelated.
So this method deletes the current View of NodeA so it also deletes any settings on that Node. I would have preferred to use the AddCommand, however, I can't return an add command until after the new view for NodeB is already created.
Thanks for all the help.
|
|
|
Powered by
FUDForum. Page generated in 0.01954 seconds