Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Implementing custom DiagramLink (Read 1987 times)
cpmjones
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Aug 4th, 2008
Implementing custom DiagramLink
Jun 30th, 2009 at 9:37am
Print Post  
Hi,

I am implementing my own class derived from the DiagramLink class, called DependencyLink.

I setup my diagram as follows:

Diagram.registerItemClass(DependencyLink.class, "DependencyLink", 1);
       diagramView.setCustomLinkType(DependencyLink.class);
diagramView.setBehavior(Behavior.Custom);

The problem is when creating a link using the mouse, results in:

java.lang.NullPointerException
       at com.mindfusion.diagramming.DiagramLink.startCreate(Unknown Source)

Any help is greatly appreciated,

thanks,

Chris
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Implementing custom DiagramLink
Reply #1 - Jun 30th, 2009 at 11:54am
Print Post  
Hi,

Have you called the DiagramLink constructor that takes a Diagram instance as argument? If you omit this, Java will call the no-args constructor, which is used only for serialization and many fields of the class will remain uninitialized.

Stoyan
  
Back to top
 
IP Logged
 
cpmjones
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Aug 4th, 2008
Re: Implementing custom DiagramLink
Reply #2 - Jun 30th, 2009 at 12:20pm
Print Post  
Hi Stoyo,

thanks for your quick response.

I was only providing the constructor passing the diagram with src and dest nodes also.

After adding the constructor for just the diagram, this now works.

Regards,

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