Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic node layout (Read 4107 times)
superNova
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Aug 5th, 2011
node layout
Aug 6th, 2011 at 10:47am
Print Post  
how to add multiples shapenodes in each other as a parent child relationship. if parent node has 3 childs so all three nodes must be attach on parentnode (shape node obj ) . how to set its layout ,provide good suggestion.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: node layout
Reply #1 - Aug 7th, 2011 at 8:10am
Print Post  
I'm not completely sure what you are asking for. If you want to programmatically connect the nodes, you can use the createDiagramLink method of the diagram's factory. Let's say you have existing nodes node1, node2 and node3 and you want to link them to an existing parent node - parent. Then use the following code:

Code
Select All
diagram.getFactory().createDiagramLink(parent, node1);
diagram.getFactory().createDiagramLink(parent, node2);
diagram.getFactory().createDiagramLink(parent, node3); 


Regards,
Meppy
  
Back to top
 
IP Logged
 
superNova
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Aug 5th, 2011
node hierarchy
Reply #2 - Aug 8th, 2011 at 8:12am
Print Post  
Actully I have  parent & childs nodes . I m aware about link node but i do not want to link them instead link i want to attach child node to its particular parent.I mean I want to draw a blockHierarchy. I m unable to fix a runtime dimension. for ex. If i have 3 initial parent p1 p2 p3, and p1 has 3 child p2 has 2 child & p3 has 1 child so using attach to method i want to attch p1's child on first block and 2 childs on p2 and so on. I hope u would have understand my probem now .
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: node layout
Reply #3 - Aug 8th, 2011 at 10:19am
Print Post  
You can attach nodes to one another using the DiagramNode.attachTo method. In the context of the above example, to attach the three nodes to the parent, use the following code:

Code
Select All
node1.attachTo(parent, AttachToNode.BottomLeft);
node2.attachTo(parent, AttachToNode.BottomLeft);
node3.attachTo(parent, AttachToNode.BottomLeft); 


Moving the parent node now will automatically adjust the attached nodes so that their position relative to the parent node is unchanged.

Does this answer your question?

Regards,
Meppy
  
Back to top
 
IP Logged
 
superNova
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Aug 5th, 2011
block diagram
Reply #4 - Aug 9th, 2011 at 10:12am
Print Post  
Still i m looking for my solution.I know about attchto method , I want to build a blockHierarchy at three level. grandfather node (gn), parent node(pn), child node(cn).  if there are 3 gn each of has 2 pn, & each pn has 3 cn. like this
              gn1 -                    gn 2                   gn 3
              /    \                      /    \                    /    \
          pn 1   pn2             pn1   pn2           pn1   pn2
       /  |  \     /  |  \           /  |  \                  / | \      /  \
     cn cn cn  cn cn cn     cn cn cn            cn cn cn cn cn

now i hope u would understand that what i want . Each diagram must contain two parent and each parent must have three child.

all nodes are coming but i m unable to fix its layout.
so pls provide solution.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: node layout
Reply #5 - Aug 9th, 2011 at 11:02am
Print Post  
If you want to automatically arrange your diagram, you can use the built-in TreeLayout algorithm - it is perfect for arranging hierarchical structures. To apply the tree layout to a diagram, do the following:

Code
Select All
TreeLayout layout = new TreeLayout();
layout.setType(TreeLayoutType.Centered);
layout.arrange(diagram); 


I hope this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint