Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How do I load xml into ContainerNode?? (Read 1836 times)
JH.Chen
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Mar 17th, 2017
How do I load xml into ContainerNode??
Mar 17th, 2017 at 3:57am
Print Post  
I created a new diagram,and load xml into this diagram.

Then I add items from new diagram into my mainDiagram one by one.

But if new diagram has group, and node in mainDiagram, the MasterGroup will be gone(null).

It will be ungroup.

So how can I do ????????
Please tall me~~
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 1935
Joined: Oct 19th, 2005
Re: How do I load xml into ContainerNode??
Reply #1 - Mar 17th, 2017 at 6:39am
Print Post  
If you are calling node's copy constructor and adding the copy to main diagram, that won't automatically copy group object and child nodes. You could copy the child nodes separately in a loop and attach them again to master copy. If doing that on server side, you could select all items from the group and call CopySelection and PasteSelection methods with copyGroups argument set to true.
  
Back to top
 
IP Logged
 
JH.Chen
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Mar 17th, 2017
Re: How do I load xml into ContainerNode??
Reply #2 - Mar 17th, 2017 at 10:26am
Print Post  
Thanks you,Slavcho.

I'll try this way.

If it works, I'll tall you. Smiley

  
Back to top
 
IP Logged
 
JH.Chen
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Mar 17th, 2017
Re: How do I load xml into ContainerNode??
Reply #3 - Mar 22nd, 2017 at 12:50am
Print Post  
Slavcho wrote on Mar 17th, 2017 at 6:39am:
If you are calling node's copy constructor and adding the copy to main diagram, that won't automatically copy group object and child nodes. You could copy the child nodes separately in a loop and attach them again to master copy. If doing that on server side, you could select all items from the group and call CopySelection and PasteSelection methods with copyGroups argument set to true.


Hi,Slavcho.
Do this way can copy customize object (nodes,links etc.) ??
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 1935
Joined: Oct 19th, 2005
Re: How do I load xml into ContainerNode??
Reply #4 - Mar 22nd, 2017 at 6:33am
Print Post  
Do you mean copying your own properties for custom item classes? Diagram.CopySelection calls items' Clone method, and default Clone implementation calls copy constructor of the class. So for custom properties support you must either add a copy constructor or override Clone method in the derived class.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
JH.Chen
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Mar 17th, 2017
Re: How do I load xml into ContainerNode??
Reply #5 - Mar 22nd, 2017 at 6:38am
Print Post  
Thank you,Slavcho.

I got it.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint