Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public interface GraphShape
The outline of a node: what GraphNode.setShape names.
One outline serves three purposes that have to agree. It is filled and stroked to paint the node, a tap counts as on the node only inside it, and an edge without a port ends where it crosses it.
GraphShapeRegistry.register("triangle", new GraphShape() {
public void outline(GeneralPath p, float x, float y, float w, float h) {
p.moveTo(x + w / 2, y);
p.lineTo(x + w, y + h);
p.lineTo(x, y + h);
p.closePath();
}
public void detail(GeneralPath p, float x, float y, float w, float h) {
}
});
GraphNode node = new GraphNode("t", "Warning", 20, 20, 120, 90);
node.setShape("triangle");Methods
public abstract void outline(GeneralPath path, float x, float y, float w, float h) | Adds the closed outline, inside the given bounds, to an empty path. |
public abstract void detail(GeneralPath path, float x, float y, float w, float h) | Adds lines drawn inside the outline but not filled, such as the bars of a predefined process, to an empty path. |
Method details
outline
public abstract void outline(GeneralPath path, float x, float y, float w, float h)Adds the closed outline, inside the given bounds, to an empty path.
The centre of the bounds must lie inside the outline.
detail
public abstract void detail(GeneralPath path, float x, float y, float w, float h)Adds lines drawn inside the outline but not filled, such as the bars
of a predefined process, to an empty path. May add nothing.