Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Cant Serialise to XML (Read 3402 times)
karljj1
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Feb 23rd, 2010
Cant Serialise to XML
Feb 23rd, 2010 at 12:06pm
Print Post  
Hi,

I have created a custom node called ComputerNode, just like the IconNode example.
When i call save to xml i get:

java.lang.IllegalArgumentException: netDiagram.ComputerNode@1cac6db cannot be serialized because its class hasn't been registered for serialization. Use RegisterItemClass to do that.

I have called
Diagram.registerItemClass(ComputerNode.class.getClass(), "ComputerNode", 1);
in the constructor yet it still does not work. Do i need to do something else?

Thanks

Karl
  
Back to top
 
IP Logged
 
karljj1
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Feb 23rd, 2010
Re: Cant Serialise to XML
Reply #1 - Feb 23rd, 2010 at 1:17pm
Print Post  
I have fxed the problem:

Diagram.registerItemClass(ComputerNode.class.getClass(), "ComputerNode", 1);


should be

Diagram.registerItemClass(ComputerNode.class, "ComputerNode", 1);
  
Back to top
 
IP Logged
 
karljj1
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Feb 23rd, 2010
Re: Cant Serialise to XML
Reply #2 - Mar 1st, 2010 at 8:55am
Print Post  
Hi,

It seems i have not fixed the problem.

I am able to save to xml but when i try to load the xml file i get the error message:


com.mindfusion.diagramming.XmlException: java.security.InvalidParameterException: Failed to instantiate item of type 'netDiagram.ComputerNode'.



Computer node is my cutsom node, it inherits from shapenode.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Cant Serialise to XML
Reply #3 - Mar 1st, 2010 at 9:24am
Print Post  
Hi,

Try adding public ComputerNode(Diagram) or ComputerNode() constructor to your class.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
karljj1
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Feb 23rd, 2010
Re: Cant Serialise to XML
Reply #4 - Mar 1st, 2010 at 9:39am
Print Post  
Thanks Stoyo,

I added a ComputerNode(Diagram) and it now works

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