Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Missing documentation (Read 3859 times)
Rennie
Full Member
***
Offline


I Love MindFusion!

Posts: 108
Location: Copenhagen, Denmark
Joined: Jul 17th, 2012
Missing documentation
Oct 29th, 2013 at 12:11pm
Print Post  
For the .Net product the CHM file contains a section "Tutorials" which contains "Creating Custom Node Types". I can't find any corresponding information in the CHM for the Android product. I'm still very new to Java, so even if the Java requirements are about the same as the .Net requirements I'm still at a loss as to how to define the custom nodes in Java.

Edit: Specifically, I'm getting the following exception:
com.mindfusion.diagramming.XmlException: java.security.InvalidParameterException: Failed to instantiate item of type 'com.Merlinia.OutBack_Client.CustomNodes.NodeOfficeArea'.
at com.mindfusion.diagramming.Diagram.loadFromXml(Diagram.java:1623)
at com.mindfusion.diagramming.Diagram.loadFromXml(Diagram.java:1488)

I've tried to add a constructor with one argument, as is needed for .Net, but the Java version constructor does not accept any arguments.

Edit 2: Sorry, the thing about the constructor not accepting an argument was my mistake. But I still miss the "Creating Custom Node Types" tutorial in Java.
« Last Edit: Oct 29th, 2013 at 2:17pm by Rennie »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Missing documentation
Reply #1 - Oct 29th, 2013 at 4:56pm
Print Post  
Does loadFromXml work now? We'll add several tutorials for the next release.
  
Back to top
 
IP Logged
 
Rennie
Full Member
***
Offline


I Love MindFusion!

Posts: 108
Location: Copenhagen, Denmark
Joined: Jul 17th, 2012
Re: Missing documentation
Reply #2 - Oct 29th, 2013 at 8:01pm
Print Post  
Thanks for answering. Yes, I'm now able to load the XML serializations from the Windows system.

Next problem is to render the custom things. I've downloaded your Java Swing product to look at the sample programs there, but I can see that the drawLocal() methods in Android and Java are different - Canvas vs. Graphics2D.

Do you have a sample program for Android that demonstrates custom nodes?
  
Back to top
 
IP Logged
 
Rennie
Full Member
***
Offline


I Love MindFusion!

Posts: 108
Location: Copenhagen, Denmark
Joined: Jul 17th, 2012
Re: Missing documentation
Reply #3 - Oct 30th, 2013 at 8:48am
Print Post  
Actually, I've got most of it working now. One more question that I'll post on a separate thread.

I'm really pleased! This is great (or is it "awesome" now?) functionality - create a diagram on Windows, ship it over to an Android client, and there it is, same diagram. Beautiful!

This compatibility and multi-platform capability of MindFusion diagramming is a real benefit for a mixed-platform system.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Missing documentation
Reply #4 - Oct 30th, 2013 at 11:26am
Print Post  
Here is a sample node class drawing rectangular shape with a horizontal line in the middle:

Code
Select All
class MyNode extends DiagramNode
{
	Paint background;
	Paint border;

	@Override
	protected void drawLocal(Canvas g, RenderOptions options)
	{
		if (background == null)
		{
			background = new Paint();
			background.setStyle(Paint.Style.FILL);
			background.setColor(android.graphics.Color.WHITE);
		}
		g.drawRect(0, 0, bounds.width(), bounds.height(), background);

		if (border == null)
		{
			border = new Paint();
			border.setStyle(Paint.Style.STROKE);
			border.setColor(android.graphics.Color.BLACK);
			border.setStrokeWidth(0.3f);
		}

		g.drawRect(0, 0, bounds.width(), bounds.height(), border);
		g.drawLine(0, bounds.height() / 2, bounds.width(), bounds.height() / 2, border);
	}
} 



I'm just learning Android's drawing API and it looks closer to .NET's GDI+ than Java Swing to me. In Swing you set current paint and stroke objects on the graphics and next draw calls use them. In Android you pass stroke or fill objects (both represented via Paint class) to each method call as in GDI+, and there are some similar classes like regions and paths.

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