Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Custom nodes? (Read 2815 times)
Rennie
Full Member
***
Offline


I Love MindFusion!

Posts: 108
Location: Copenhagen, Denmark
Joined: Jul 17th, 2012
Custom nodes?
Jul 12th, 2013 at 4:25pm
Print Post  
This is an amazing coincidence - I'm finally finished with the WinForms part of my program and I'm just starting to get into Android programming. And now MindFusion releases this viewer program! Great!

But - I worry about one thing. My program is very much based on a lot of custom nodes, both custom composite nodes and custom nodes derived directly from DiagramNode. Is this a problem? Is there any workaround?

Thanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom nodes?
Reply #1 - Jul 13th, 2013 at 11:16am
Print Post  
Hi,

You will have to port the drawing and XML deserialization part of your nodes to Java, e.g.:

Code
Select All
Diagram.registerItemClass(MyNode.class, "MyNode", 1);

public class MyNode extends DiagramNode
{
    protected void drawLocal(Canvas graphics, RenderOptions options)
    {
        // use Canvas API to draw node's elements
    }

    protected void loadFromXml(Element xmlElement, XmlPersistContext context)
    {
        super.loadFromXml(xmlElement, context);

        // use XmlPersistContext API to load properties
    }
} 



Composite nodes are not supported at this time. You could still load them using a custom class registered with same ID, and render some representation of their components using Canvas methods.

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