Interface GraphShape


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");
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    void
    outline(GeneralPath path, float x, float y, float w, float h)
    Adds the closed outline, inside the given bounds, to an empty path.
  • Method Details

    • outline

      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

      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.