Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Potential ShapeNode.AttachTo Issue (Read 2980 times)
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Potential ShapeNode.AttachTo Issue
Oct 3rd, 2013 at 4:03pm
Print Post  
Hi,

I have attached a screenshot which illustrates my issue.
The text to the upper left of the diamond - Exclusive Gateway - was placed there using the following code:

Code
Select All
Factory factory = diagram.Factory;
                Shape gatewayShape;

                if (GatewayType == "Exclusive")
                    gatewayShape = Shapes.BpmnDataBasedXor;
                else if (GatewayType == "Parallel")
                    gatewayShape = Shapes.BpmnParallelFork;
                else
                    gatewayShape = Shapes.Decision;

                ShapeNode gatewayNode = factory.CreateShapeNode(0, 0, 20, 20, gatewayShape);
                gatewayNode.Tag = "Gateway;" + GatewayID + ";" + GatewayName + ";" + GatewayType + ";" + taskID.ToString() + ";" + Link_Image_ID + ";" + Link_Image_Placement_ID + ";" + Link_Image_Segment_ID + ";" + LinkText + ";" + GatewayDecisionText;
                gatewayNode.Id = "Gateway" + GatewayID;
                gatewayNode.ToolTip = GatewayDesc;
                gatewayNode.Font = new Font("Arial", 7, System.Drawing.FontStyle.Regular);
                gatewayNode.TextFormat.Alignment = StringAlignment.Center;
                gatewayNode.TextFormat.LineAlignment = StringAlignment.Center;
                if (GatewayType == "Decision")
                    gatewayNode.Text = GatewayDecisionText;
                else
                    gatewayNode.Text = GatewayName;
                gatewayNode.LayoutTraits[SwimlaneLayoutTraits.Lane] = laneNumber;
                gatewayNode.LayoutTraits[SwimlaneLayoutTraits.SortOrder] = nodeNumber;
                nodeNumber++;
                gatewayNode.AnchorPattern = GatewayAnchors;
                float angle = 90;
                gatewayNode.Brush = new MindFusion.Drawing.LinearGradientBrush(Color.WhiteSmoke, Color.LightBlue, angle);

                // Now we'll place the gateway name to the upper left of the above shape

                ShapeNode label = factory.CreateShapeNode(0, 0, 20, 8, Shapes.Rectangle);
                label.Text = GatewayName;
                label.Font = new Font("Arial", 8, System.Drawing.FontStyle.Regular);
                label.TextFormat.Alignment = StringAlignment.Center;
                label.TextFormat.LineAlignment = StringAlignment.Center;
                label.IgnoreLayout = true; // Ensures that this shape remains with the parent shape
                label.Transparent = true; // Don't show the shape itself, just the image
                label.Pen = new Pen(Color.Black, 0F); // Don't show any border around the shape
                label.Move(gatewayNode.Bounds.Left - 13, gatewayNode.Bounds.Top - 2);
                label.AttachTo(gatewayNode, AttachToNode.TopLeft); 



I also have code that places text on the links - in this example Yes and No.  That works as well.

The issue is the text (and/or the shape) that is placed to the upper left of the diamond is being shown at the bottom of that shape as well.
I can see no where in my code where I could be doing this.

Any ideas?

I have also attached an xml export of the diagram.

Thanks in advance.

Jim
  

Gateway_Name_Duplication_Issue_-_03Oct2013.png (Attachment deleted)
CFFD_002.zip (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Potential ShapeNode.AttachTo Issue
Reply #1 - Oct 4th, 2013 at 5:54am
Print Post  
Hi,

Bpmn* shapes display their Text below the node, so most likely that's the main node's label. Check this code:

Code
Select All
if (GatewayType == "Decision")
    gatewayNode.Text = GatewayDecisionText;
else
    gatewayNode.Text = GatewayName;
....
label.Text = GatewayName; 



It assigns the same label "Exclusive GW" to both the main and attached nodes, either because GatewayType != "Decision", or both GatewayName and GatewayDecisionText contain the same string.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Re: Potential ShapeNode.AttachTo Issue
Reply #2 - Oct 4th, 2013 at 10:51am
Print Post  
Hi,

I was not aware that the text would appear under BPMN shapes.
I'm now setting the text to "" for such shapes.

Thanks a lot.

Jim
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint