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 Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    A circle.
    static final int
    A diamond.
    static final int
    A filled arrowhead.
    static final int
    No mark at an end of the edge.
    static final int
    An arrowhead of two open strokes.
    static final int
    A line of dashes.
    static final int
    A line of dots.
    static final int
    An unbroken line, the default.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GraphEdge(String id, String sourceId, String targetId)
    An edge between two nodes.
    GraphEdge(String id, String sourceId, String sourcePortId, String targetId, String targetPortId)
    An edge between two ports.
  • Method Summary

    Modifier and Type
    Method
    Description
    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 id, unique within the model.
    The text painted at the middle of the edge, or null.
    int
    How the line is drawn: LINE_SOLID, LINE_DASHED or LINE_DOTTED.
    double[]
    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.
    int
    The mark at the source end, one of the ARROW_ constants; ARROW_NONE by default.
    The id of the node the edge leaves.
    The id of the output port the edge leaves, or null.
    A key a renderer may map to a colour or a dash, or null.
    int
    The mark at the target end, one of the ARROW_ constants.
    The id of the node the edge enters.
    The id of the input port the edge enters, or null.
    The text a NodeGraph shows beside the pointer while it rests on this edge, or null for none.
    Anything the application keeps with the edge.
    boolean
    True, the default, when the edge is painted with an arrowhead.
    boolean
    True when setTargetArrow chose the target mark, so that it no longer follows isDirected.
    void
    setDirected(boolean directed)
    Paints the edge with or without an arrowhead.
    void
    Sets the label.
    void
    setLineStyle(int lineStyle)
    Sets how the line is drawn.
    void
    setRoute(double[] route)
    Sets the bend points; null removes them.
    void
    setSourceArrow(int sourceArrow)
    Sets the mark at the source end.
    void
    setStyleKey(String styleKey)
    Sets the style key.
    void
    setTargetArrow(int targetArrow)
    Sets the mark at the target end; a negative value goes back to following isDirected.
    void
    setTooltip(String tooltip)
    Sets the hover text; null removes it.
    void
    setUserData(Object userData)
    Sets the application's data.
    boolean
    touches(String nodeId)
    True when the edge touches the node with this id.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.
    • getTooltip

      public String getTooltip()
      The text a NodeGraph shows beside the pointer while it rests on this edge, or null for none. Desktop and other hovering pointers only; a touch screen never shows it.
    • setTooltip

      public void setTooltip(String tooltip)
      Sets the hover text; null removes it.