Class GraphEdge
java.lang.Object
com.codename1.graph.GraphEdge
A connection from one node to another, optionally from a port to a port.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA circle.static final intA diamond.static final intA filled arrowhead.static final intNo mark at an end of the edge.static final intAn arrowhead of two open strokes.static final intA line of dashes.static final intA line of dots.static final intAn unbroken line, the default. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAn edge like this one under another id and between other nodes, with the same ports, label, line and arrows.getId()The id, unique within the model.getLabel()The text painted at the middle of the edge, or null.intHow the line is drawn:LINE_SOLID,LINE_DASHEDorLINE_DOTTED.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.intThe mark at the source end, one of theARROW_constants;ARROW_NONEby 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.intThe mark at the target end, one of theARROW_constants.The id of the node the edge enters.The id of the input port the edge enters, or null.Anything the application keeps with the edge.booleanTrue, the default, when the edge is painted with an arrowhead.booleanTrue whensetTargetArrowchose the target mark, so that it no longer followsisDirected.voidsetDirected(boolean directed) Paints the edge with or without an arrowhead.voidSets the label.voidsetLineStyle(int lineStyle) Sets how the line is drawn.voidsetRoute(double[] route) Sets the bend points; null removes them.voidsetSourceArrow(int sourceArrow) Sets the mark at the source end.voidsetStyleKey(String styleKey) Sets the style key.voidsetTargetArrow(int targetArrow) Sets the mark at the target end; a negative value goes back to followingisDirected.voidsetUserData(Object userData) Sets the application's data.booleanTrue when the edge touches the node with this id.
-
Field Details
-
LINE_SOLID
public static final int LINE_SOLIDAn unbroken line, the default.- See Also:
-
LINE_DASHED
public static final int LINE_DASHEDA line of dashes.- See Also:
-
LINE_DOTTED
public static final int LINE_DOTTEDA line of dots.- See Also:
-
ARROW_NONE
public static final int ARROW_NONENo mark at an end of the edge.- See Also:
-
ARROW_FILLED
public static final int ARROW_FILLEDA filled arrowhead.- See Also:
-
ARROW_OPEN
public static final int ARROW_OPENAn arrowhead of two open strokes.- See Also:
-
ARROW_DIAMOND
public static final int ARROW_DIAMONDA diamond.- See Also:
-
ARROW_CIRCLE
public static final int ARROW_CIRCLEA circle.- See Also:
-
-
Constructor Details
-
GraphEdge
-
GraphEdge
-
-
Method Details
-
getId
The id, unique within the model. -
getSourceId
The id of the node the edge leaves. -
getSourcePortId
The id of the output port the edge leaves, or null. -
getTargetId
The id of the node the edge enters. -
getTargetPortId
The id of the input port the edge enters, or null. -
getLabel
The text painted at the middle of the edge, or null. -
setLabel
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
A key a renderer may map to a colour or a dash, or null. -
setStyleKey
Sets the style key. -
getUserData
Anything the application keeps with the edge. -
setUserData
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_DASHEDorLINE_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 theARROW_constants;ARROW_NONEby 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 theARROW_constants. UntilsetTargetArrowis called it followsisDirected:ARROW_FILLEDfor a directed edge andARROW_NONEotherwise. -
setTargetArrow
public void setTargetArrow(int targetArrow) Sets the mark at the target end; a negative value goes back to followingisDirected. -
isTargetArrowSet
public boolean isTargetArrowSet()True whensetTargetArrowchose the target mark, so that it no longer followsisDirected. -
copy
-
touches
True when the edge touches the node with this id.
-