Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Recusive Layout arrange issue (Read 3595 times)
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Recusive Layout arrange issue
Aug 4th, 2010 at 5:35am
Print Post  
Hi Stoyo

Please find the sample on following link
https://cid-2b9bf77533900b84.office.live.com/self.aspx/.Public/SilverlightApplic...

In this sample, I am using "RecursiveTreeLayout" samples code for DeepArrange code. In the sample, I have one xml file from which data needs to be displayed. At the same time I have a class hierachy ( NodeTemplate) which decides what data to be displayed and how it should be displayed.

With one (NodeTemplate) layout, container node and its child elements are arranged properly. With another (NodeTemplate)layout child of container nodes are not displayed within a container.

In the sample, the nodes in second diagram are not arranged properly.

Will you please have a look in the issue and help me.

Regards
Rajesh

  
Back to top
WWW  
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Recusive Layout arrange issue
Reply #1 - Aug 4th, 2010 at 12:13pm
Print Post  
I have sent you a private message with a download link for an updated version of DiagramLite. Check it out and see if the problem has been resolved.

Regards,
Meppy

P.S.: On a side note, for the sake of correctness, on line 173 in MainPage.xaml.cs of your sample you probably intended:

Code
Select All
node = new ShapeNode(this.diagram); 


instead of:

Code
Select All
node = new ShapeNode(this.diagram1); 

  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Recusive Layout arrange issue
Reply #2 - Aug 4th, 2010 at 12:33pm
Print Post  
Hi Meppy

Thanks for the new version. With new version it is working as expected.

One more question related to this : Is it possible to assing a text for container node ( Either on top side or bottom side ) Or possibility to divide my container node is two regions - where childs can be added in both region but child of one region can not moveed in child of another region.

Or child nodes can not be moved on the position where container node text is displayed.

-Rajesh
  
Back to top
WWW  
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Recusive Layout arrange issue
Reply #3 - Aug 4th, 2010 at 1:03pm
Print Post  
You can position the text within the container by using a custom Shape with an explicitly specified TextRectangle. The following code defines a rectangular shape with text displayed below the node.

Code
Select All
container.Shape = new Shape(new ElementTemplate[]
      {
            new LineTemplate(0, 0, 100, 0),
            new LineTemplate(100, 0, 100, 100),
            new LineTemplate(100, 100, 0, 100),
            new LineTemplate(0, 100, 0, 0),
      },
      null, // decorations
      new Rect(0, 100, 100, 20),
      FillRule.Nonzero); 


Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Recusive Layout arrange issue
Reply #4 - Aug 4th, 2010 at 1:07pm
Print Post  
Hi Meepy

With this code we can have a textbox explicitly but any child nodes can be moved on that area also.. i want to prevent this situation.

-Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Recusive Layout arrange issue
Reply #5 - Aug 5th, 2010 at 5:06am
Print Post  
You can do that as shown below.

Code
Select All
private void OnNodeModifying(object sender, NodeValidationEventArgs e)
{
	var container = e.Node.Container;
	if (container != null)
	{
		var nr = e.Node.Bounds;
		var cr = container.Bounds;
		// reserve caption area at the top
		cr.Y += 20;
		cr.Height -= 20;

		if (nr.Y < cr.Y)
			nr.Y = cr.Y;
		if (nr.X < cr.X)
			nr.X = cr.X;
		if (nr.Right > cr.Right)
			nr.X = cr.Right - nr.Width;
		if (nr.Bottom > cr.Bottom)
			nr.Y = cr.Bottom - nr.Height;

		if (e.Node.Bounds != nr)
			e.Node.Bounds = nr;
	}
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint