Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic DiagramItem (Read 4600 times)
Silvia88
Full Member
***
Offline


I Love MindFusion!

Posts: 121
Joined: Aug 31st, 2015
DiagramItem
Sep 7th, 2015 at 12:12pm
Print Post  
Hi,
Is there a way to distinguish if the added item is a node or a link, in the method ItemAdded?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: DiagramItem
Reply #1 - Sep 7th, 2015 at 12:23pm
Print Post  
Hi,

You could use the instanceof operator:

Code
Select All
@Override
public void itemAdded(ItemEvent e)
{
	if (e.getItem() instanceof DiagramNode)
	{
		// ...
	}
} 



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


I Love MindFusion!

Posts: 121
Joined: Aug 31st, 2015
Re: DiagramItem
Reply #2 - Sep 7th, 2015 at 1:38pm
Print Post  
Ok, thank you..
Is there a way to take the coordinate of the start point of a link?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: DiagramItem
Reply #3 - Sep 7th, 2015 at 1:46pm
Print Post  
Try this:

Code
Select All
PointList linkPoints = link.getControlPoints();
PointF startPoint = linkPoints.get(0); 



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


I Love MindFusion!

Posts: 121
Joined: Aug 31st, 2015
Re: DiagramItem
Reply #4 - Sep 7th, 2015 at 2:11pm
Print Post  
Ok, thank you...
Is there a way to decide the length of a link? Or a way to move a node i.e. give other coordinates to a node?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: DiagramItem
Reply #5 - Sep 7th, 2015 at 2:55pm
Print Post  
You can find link's length by calling its getLength() method; move a node by calling moveTo or setBounds method.

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


I Love MindFusion!

Posts: 121
Joined: Aug 31st, 2015
Re: DiagramItem
Reply #6 - Sep 7th, 2015 at 3:35pm
Print Post  
ok, thank you.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint