public interface IEdge extends IPortOwner, ILabelOwner, IModelItem
IGraph
implementation.
This interface provides read-only access to the properties of an edge. In order to modify the state of an instance use
the various methods provided by the IGraph
this instance belongs to. An edge connects to two ports and may
consist of a number of bends. Also it can have zero or more labels. This interface combines the functionality of IPortOwner
to get access to the ports that edges can optionally have, ILabelOwner
to get access to the labels, and, like
all items in an IGraph
, edges support the ILookup.lookup(java.lang.Class)
method inherited from the IModelItem
interface that can be used to query additional aspects of each instance.
The graph model with all relevant types and their relationships is presented in detail in the section The Graph Model.
Using the look-up mechanism is explained in the section Service Locator Pattern: Lookup.
Some useful static methods can be found inGraphExtensions
.Modifier and Type | Method and Description |
---|---|
IListEnumerable<IBend> |
getBends()
Provides access to a collection of
bends that describe the geometry of this edge. |
default INode |
getSourceNode()
Gets the source node for the given edge or
null . |
IPort |
getSourcePort()
Gets the source port instance this edge is connected to.
|
IEdgeStyle |
getStyle()
Returns the style that is responsible for the visual representation of this edge in a
CanvasControl . |
default INode |
getTargetNode()
Gets the target node for the given edge or
null . |
IPort |
getTargetPort()
Gets the target port instance this edge is connected to.
|
default boolean |
isSelfloop()
Returns whether an
edge is a self loop. |
default IPort |
opposite(IPort port)
Gets the opposite port of an
IEdge . |
default IPortOwner |
opposite(IPortOwner owner)
Gets the opposite port owner of an
IEdge . |
getPorts
getLabels
createDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, lookup, safeLookup
IListEnumerable<IBend> getBends()
bends
that describe the geometry of this edge.
This gives access to a read-only live view of the bends, i.e. the collection can change over time, as well as the bends
contained in it. If a snapshot of the current state is needed, one needs to copy the collection. In order to modify the
bend collection of an edge, use the various methods
in IGraph
.
default INode getSourceNode()
null
.null
.IPort getSourcePort()
Although the notion of source and target port is used for directed edges, it is still up to the client to decide whether the edge should be treated as such.
IEdgeStyle getStyle()
CanvasControl
.
In order to set the style on an instance, use the IGraph.setStyle(IEdge, IEdgeStyle)
method. Note that the style instance associated with an edge instance may be shared between multiple edge instances and
that the modification of this style will result in a change of the appearance of all edges that are associated with the
same style instance.
default INode getTargetNode()
null
.null
.IPort getTargetPort()
Although the notion of source and target port is used for directed edges, it is still up to the client to decide whether the edge should be treated as such.
default boolean isSelfloop()
edge
is a self loop.true
, if the edge is a self loopdefault IPort opposite(IPort port)
IEdge
.IllegalArgumentException
- If port
is neither the source or target of the edge.port
- The port that the IEdge
is connected to.default IPortOwner opposite(IPortOwner owner)
IEdge
.IllegalArgumentException
- If owner
is neither the source or target of the edge.owner
- The owner of the port that the IEdge
is connected to.