Class GraphPort

java.lang.Object
com.codename1.graph.GraphPort

public class GraphPort extends Object

A place on a GraphNode where edges attach, as in a node editor.

A node with no ports is connected node to node, as in a system diagram. Ports are ordered on their side of the node in the order they were added.

  • Field Details

    • INPUT

      public static final int INPUT
      The port takes incoming edges and sits on the leading side of the node.
      See Also:
    • OUTPUT

      public static final int OUTPUT
      The port starts outgoing edges and sits on the trailing side.
      See Also:
  • Constructor Details

    • GraphPort

      public GraphPort(String id, int direction, String label, String type)

      A port.

      Parameters
      • id: unique within its node
      • direction: INPUT or OUTPUT
      • label: painted beside the port, may be null
      • type: compared by ConnectionValidator; null accepts any type
  • Method Details

    • getId

      public String getId()
      The id, unique within the node.
    • getDirection

      public int getDirection()
      INPUT or OUTPUT.
    • isInput

      public boolean isInput()
      True for an INPUT port.
    • getLabel

      public String getLabel()
      The label, or null.
    • setLabel

      public void setLabel(String label)
      Sets the label.
    • getType

      public String getType()
      The data type edges must agree on, or null for any.
    • setType

      public void setType(String type)
      Sets the data type.
    • getMaxConnections

      public int getMaxConnections()
      How many edges may attach, or -1 for any number.
    • setMaxConnections

      public void setMaxConnections(int maxConnections)
      Limits the edges that may attach; -1 for any number.
    • getNode

      public GraphNode getNode()
      The node the port belongs to, or null before it is added to one.