Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic limit one link per node (Read 1652 times)
tmtton
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: May 9th, 2008
limit one link per node
May 4th, 2009 at 2:52am
Print Post  
For some ShapeNode, I want to prevent users from creating more than one link. I have the following, but new link still gets created. I use JDiagram 2.1.

public void linkCreating(LinkValidationEvent e) {
DiagramLink link = e.getLink();
DiagramNode fromNode = link.getOrigin();
if (fromNode.getOutgoingLinks().isEmpty() == false) {
      diagram.getLinks().remove(link);
   }
}
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: limit one link per node
Reply #1 - May 4th, 2009 at 9:23am
Print Post  
The link is not added to the Diagram.Links list until you release the mouse button. You should call LinkValidationEvent.cancelDrag() to stop the link creation.

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