public class SimpleEdge extends Object implements IEdge
IEdge interface that can be used stand-alone.
Note that this class is not the one used as the default implementation of a DefaultGraph's IEdges and
casting them to SimpleEdge will fail. Instances of this class can be used without an accompanying graph
instance. All of the properties are mutable. An example of a possible use case would be the rendering of an edge into a
graphics context: Simply create a
SimpleEdge, associate a style with it and use the style's renderer instance to obtain a rendering for the
edge.
| Constructor and Description |
|---|
SimpleEdge(IPort sourcePort,
IPort targetPort)
Creates an edge with a
default lookup, and the given source and target ports. |
| Modifier and Type | Method and Description |
|---|---|
IListEnumerable<IBend> |
getBends()
Provides access to a collection of
bends that describe the geometry of this edge. |
IListEnumerable<ILabel> |
getLabels()
Gets the collection for the labels.
|
ILookup |
getLookupImplementation()
Gets the
ILookup implementation used for calls to lookup(Class) on this instance. |
IListEnumerable<IPort> |
getPorts()
Provides access to a collection of
ports that are owned by this instance. |
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. |
Object |
getTag()
Gets the tag associated with this instance.
|
IPort |
getTargetPort()
Gets the target port instance this edge is connected to.
|
<TLookup> TLookup |
lookup(Class<TLookup> type)
Returns an instance that implements the given type or
null. |
void |
setBends(IListEnumerable<IBend> value)
Provides access to a collection of
bends that describe the geometry of this edge. |
void |
setLabels(IListEnumerable<ILabel> value)
Sets the collection for the labels.
|
void |
setLookupImplementation(ILookup value)
Sets the
ILookup implementation used for calls to lookup(Class) on this instance. |
void |
setPorts(IListEnumerable<IPort> value)
Provides access to a collection of
ports that are owned by this instance. |
void |
setSourcePort(IPort value)
Sets the source port instance this edge is connected to.
|
void |
setStyle(IEdgeStyle value)
Returns the style that is responsible for the visual representation of this edge in a
CanvasControl. |
void |
setTag(Object value)
Sets the tag associated with this instance.
|
void |
setTargetPort(IPort value)
Sets the target port instance this edge is connected to.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSourceNode, getTargetNode, isSelfloop, opposite, oppositecreateDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, safeLookuppublic SimpleEdge(IPort sourcePort, IPort targetPort)
default lookup, and the given source and target ports.
While technically the source and target port can be null here, this will cause all kinds of issues, e.g. with styles
or label models that require the ports to be non-null to
work properly.
sourcePort - The source port for the edge.targetPort - The target port for the edge.public final IListEnumerable<IBend> getBends()
IEdgebends 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.
public final IListEnumerable<ILabel> getLabels()
getLabels in interface ILabelOwnersetLabels(IListEnumerable)public final ILookup getLookupImplementation()
ILookup implementation used for calls to lookup(Class) on this instance.setLookupImplementation(ILookup)public final IListEnumerable<IPort> getPorts()
IPortOwnerports that are owned by this instance.
This gives access to a read-only live view of the ports, i.e. the collection can change over time, as well as the ports contained in it. If a snapshot of the current state is needed, one needs to copy the collection.
getPorts in interface IPortOwnerpublic final IPort getSourcePort()
IEdgeAlthough 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.
getSourcePort in interface IEdgepublic final IEdgeStyle getStyle()
IEdgeCanvasControl.
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.
public final Object getTag()
ITagOwnerThe implementation itself does not normally depend on the tag associated with it. It serves as storage for the object only.
getTag in interface ITagOwnerITagOwner.setTag(Object)public final IPort getTargetPort()
IEdgeAlthough 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.
getTargetPort in interface IEdgepublic <TLookup> TLookup lookup(Class<TLookup> type)
ILookupnull.
Typically, this method will be called in order to obtain a different view or
aspect of the current instance. This is quite similar to casting or using
a super type or interface of this instance, but is not limited to inheritance or
compile time constraints. An instance implementing this method is not
required to return non-null implementations for the types, nor does it
have to return the same instance any time. Also it depends on the
type and context whether the instance returned stays up to date or needs to
be reobtained for subsequent use.public final void setBends(IListEnumerable<IBend> value)
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.
value - The Bends to set.getBends()public final void setLabels(IListEnumerable<ILabel> value)
value - The Labels to set.getLabels()public final void setLookupImplementation(ILookup value)
ILookup implementation used for calls to lookup(Class) on this instance.value - The LookupImplementation to set.getLookupImplementation()public final void setPorts(IListEnumerable<IPort> value)
ports that are owned by this instance.
This gives access to a read-only live view of the ports, i.e. the collection can change over time, as well as the ports contained in it. If a snapshot of the current state is needed, one needs to copy the collection.
value - The Ports to set.getPorts()public final void setSourcePort(IPort value)
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.
value - The SourcePort to set.getSourcePort()public final void setStyle(IEdgeStyle value)
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.
value - The Style to set.getStyle()public final void setTag(Object value)
ITagOwnerThe implementation itself does not normally depend on the tag associated with it. It serves as storage for the object only.
setTag in interface ITagOwnervalue - The user object associated with this instance.ITagOwner.getTag()public final void setTargetPort(IPort value)
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.
value - The TargetPort to set.getTargetPort()