Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public class GraphEdge

  1. Object
  2. GraphEdge
A connection from one node to another, optionally from a port to a port.

Fields

public static final int LINE_SOLID = 0An unbroken line, the default.
public static final int LINE_DASHED = 1A line of dashes.
public static final int LINE_DOTTED = 2A line of dots.
public static final int ARROW_NONE = 0No mark at an end of the edge.
public static final int ARROW_FILLED = 1A filled arrowhead.
public static final int ARROW_OPEN = 2An arrowhead of two open strokes.
public static final int ARROW_DIAMOND = 3A diamond.
public static final int ARROW_CIRCLE = 4A circle.

Constructors

public GraphEdge(String id, String sourceId, String targetId)An edge between two nodes.
public GraphEdge(String id, String sourceId, String sourcePortId, String targetId, String targetPortId)An edge between two ports.

Methods

public String getId()The id, unique within the model.
public String getSourceId()The id of the node the edge leaves.
public String getSourcePortId()The id of the output port the edge leaves, or null.
public String getTargetId()The id of the node the edge enters.
public String getTargetPortId()The id of the input port the edge enters, or null.
public String getLabel()The text painted at the middle of the edge, or null.
public void setLabel(String label)Sets the label.
public boolean isDirected()True, the default, when the edge is painted with an arrowhead.
public void setDirected(boolean directed)Paints the edge with or without an arrowhead.
public String getStyleKey()A key a renderer may map to a colour or a dash, or null.
public void setStyleKey(String styleKey)Sets the style key.
public Object getUserData()Anything the application keeps with the edge.
public void setUserData(Object userData)Sets the application’s data.
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.
public void setRoute(double[] route)Sets the bend points; null removes them.
public int getLineStyle()How the line is drawn: LINE_SOLID, LINE_DASHED or LINE_DOTTED.
public void setLineStyle(int lineStyle)Sets how the line is drawn.
public int getSourceArrow()The mark at the source end, one of the ARROW_ constants; ARROW_NONE by default.
public void setSourceArrow(int sourceArrow)Sets the mark at the source end.
public int getTargetArrow()The mark at the target end, one of the ARROW_ constants.
public void setTargetArrow(int targetArrow)Sets the mark at the target end; a negative value goes back to following isDirected.
public boolean isTargetArrowSet()True when setTargetArrow chose the target mark, so that it no longer follows isDirected.
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.
public boolean touches(String nodeId)True when the edge touches the node with this id.

Inherited methods

Field details

LINE_SOLID

public static final int LINE_SOLID = 0
An unbroken line, the default.

LINE_DASHED

public static final int LINE_DASHED = 1
A line of dashes.

LINE_DOTTED

public static final int LINE_DOTTED = 2
A line of dots.

ARROW_NONE

public static final int ARROW_NONE = 0
No mark at an end of the edge.

ARROW_FILLED

public static final int ARROW_FILLED = 1
A filled arrowhead.

ARROW_OPEN

public static final int ARROW_OPEN = 2
An arrowhead of two open strokes.

ARROW_DIAMOND

public static final int ARROW_DIAMOND = 3
A diamond.

ARROW_CIRCLE

public static final int ARROW_CIRCLE = 4
A circle.

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.