Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Swim Lanes (Read 1581 times)
donalmeida
Junior Member
**
Offline


Yay...

Posts: 65
Joined: Oct 6th, 2009
Swim Lanes
Oct 27th, 2009 at 9:02pm
Print Post  
We have to create Swimlanes as part of our application. To do so I went through the Demo sample provided and also looked at the sample code provided as part of another forum Thread.

The Swimlanes come up as required. We need to now allow the user to increase or decrease the height of the Swimlane. However, if we have 4 swim lanes we need to change the height of the immediate Swimlane below/above it.

The swimlanes needs to fit 100% of the available bounds (height) of the diagram.  What would I need to change in the Code to fit the swim lanes 100% and at the same time automaticaly change the heights of the other swim lanes next to it when a user changes the height of the Swimlane. 



private void ShowLanes()
       {
           List<Brush> brushes = new List<Brush> { Brushes.Yellow, Brushes.White, Brushes.Gray, Brushes.Yellow };
           CreateLanes(140, new[] { "Administrative", "Accounting", "Sales", "HR" }, brushes);
       }

       void CreateLanes(double laneHeight, string[] laneLabels, IList<Brush> brushes)
       {
           for (int i = 0; i < laneLabels.Length; ++i)
           {
               var lane = diagram.Factory.CreateShapeNode(
                   0, i * laneHeight, diagram.Width, laneHeight);

               lane.Locked = true;
               lane.ZIndex = 0; // 1000;
               lane.Shape = Shapes.Rectangle;
               lane.Text = laneLabels[i];
               lane.TextFormat = new StringFormat(StringAlignment.Near, StringAlignment.Near);
               lane.Brush = brushes[i];
               lane.FontSize *= 1.5;
               lane.FontStretch = FontStretches.Normal;
           }
           UpdateLayout();
       }
  

Don Almeida.
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Swim Lanes
Reply #1 - Oct 28th, 2009 at 7:23am
Print Post  
Hi Don,

You could disable all adjustment handles but the bottom-center one to let users resize the lanes only vertically. Handle NodeModifying, and if the node being modified is a lane, offset the next lanes with the same delta. E.g. you could keep all lanes in a List<DiagramNode>, in NodeModifying call IndexOf(e.Node) to find out the lane index, and then move the lanes with higher index up or down. Or as a convention you might always keep the lanes as the first 4 nodes in diagram.Items, to avoid using an additional list.

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