Class GraphEdge

java.lang.Object
com.codename1.graph.GraphEdge

public class GraphEdge extends Object
A connection from one node to another, optionally from a port to a port.
  • Field Details

  • Constructor Details

    • GraphEdge

      public GraphEdge(String id, String sourceId, String targetId)
      An edge between two nodes.
    • GraphEdge

      public GraphEdge(String id, String sourceId, String sourcePortId, String targetId, String targetPortId)
      An edge between two ports. Either port id may be null to attach to the node itself.
  • Method Details

    • getId

      public String getId()
      The id, unique within the model.
    • getSourceId

      public String getSourceId()
      The id of the node the edge leaves.
    • getSourcePortId

      public String getSourcePortId()
      The id of the output port the edge leaves, or null.
    • getTargetId

      public String getTargetId()
      The id of the node the edge enters.
    • getTargetPortId

      public String getTargetPortId()
      The id of the input port the edge enters, or null.
    • getLabel

      public String getLabel()
      The text painted at the middle of the edge, or null.
    • setLabel

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

      public boolean isDirected()
      True, the default, when the edge is painted with an arrowhead.
    • setDirected

      public void setDirected(boolean directed)
      Paints the edge with or without an arrowhead.
    • getStyleKey

      public String getStyleKey()
      A key a renderer may map to a colour or a dash, or null.
    • setStyleKey

      public void setStyleKey(String styleKey)
      Sets the style key.
    • getUserData

      public Object getUserData()
      Anything the application keeps with the edge.
    • setUserData

      public void setUserData(Object userData)
      Sets the application's data.
    • getRoute

      public double[] getRoute()
      The bend points an arrangement routed the edge through, as x, y pairs in world units, or null for a direct line between its ends.
    • setRoute

      public void setRoute(double[] route)
      Sets the bend points; null removes them.
    • getLineStyle

      public int getLineStyle()
      How the line is drawn: LINE_SOLID, LINE_DASHED or LINE_DOTTED.
    • setLineStyle

      public void setLineStyle(int lineStyle)
      Sets how the line is drawn.
    • getSourceArrow

      public int getSourceArrow()
      The mark at the source end, one of the ARROW_ constants; ARROW_NONE by default.
    • setSourceArrow

      public void setSourceArrow(int sourceArrow)
      Sets the mark at the source end.
    • getTargetArrow

      public int getTargetArrow()
      The mark at the target end, one of the ARROW_ constants. Until setTargetArrow is called it follows isDirected: ARROW_FILLED for a directed edge and ARROW_NONE otherwise.
    • setTargetArrow

      public void setTargetArrow(int targetArrow)
      Sets the mark at the target end; a negative value goes back to following isDirected.
    • isTargetArrowSet

      public boolean isTargetArrowSet()
      True when setTargetArrow chose the target mark, so that it no longer follows isDirected.
    • copy

      public GraphEdge copy(String newId, String newSourceId, String newTargetId)
      An edge like this one under another id and between other nodes, with the same ports, label, line and arrows. The route is not copied: it was laid for where the original nodes are.
    • touches

      public boolean touches(String nodeId)
      True when the edge touches the node with this id.