https://mindfusion.org/_temp/customtypes.zipNow there are two methods you could use to let the user draw custom items.
1. Using the CustomNodeType and CustomLinkType properties, e.g.
fc.setBehavior(BehaviorType.Custom);
fc.setCustomNodeType(MyNode.class);
2. Inherit from the NodeLinkBehavior class, implement its createLink() and createNode() methods, and call
fc.setCustomBehavior(new YourBehaviorClass());
The custom type could look like
public class MyNode extends Box
{
public MyNode(FlowChart fc)
{
super(fc);
}
protected void draw(Graphics2D g, boolean shadow)
{
super.draw(g, shadow);
if (!shadow)
{
g.setFont(getFont());
g.drawString(test, (float)bounds.getX(), (float)bounds.getY());
}
}
private String test = "test";
}
Note that in the first case the control uses the reflection API to create item instances, and in that case you should always provide a constructor that a single parameter of type FlowChart. In addition, you cannot use nested classes, since the compiler implicitly inserts an additional parameter to nested class constructors.
We haven't ported everything related to custom classes yet. For example you cannot yet derive directly from the base Node class (as possible in Flowchart.NET), but will have to derive from either Box or Table.
I hope that helps,
Stoyan