public class PortRelocationHandleProvider extends Object implements IHandleProvider, IEdgePortHandleProvider
IHandleProvider
that can be used for IEdge
s.
It will return the IHandle
s for the source
and target
ports using PortRelocationHandle
s.
Note that this implementation also explicitly implements the IEdgePortHandleProvider
and that it is recommended
to decorate the IEdgePortHandleProvider
interface with edges in order to influence the handles of the source and
target port of the edge instead of directly decorating and implementing the IHandleProvider
interface. The
default implementation of the IHandleProvider
interface in the lookup of the IEdge
s (see
DefaultEdgeLookup
) will use the IEdgeReconnectionPortCandidateProvider
interface to collect the source and target port handles.
Modifier and Type | Field and Description |
---|---|
protected IEdge |
edge
The edge this provider is working on.
|
protected IGraph |
graph
The graph this provider is working on.
|
Constructor and Description |
---|
PortRelocationHandleProvider(IGraph graph,
IEdge edge)
Initializes a new instance of the
PortRelocationHandleProvider class using the given graph and edge. |
Modifier and Type | Method and Description |
---|---|
protected IHandle |
createPortRelocationHandle(IGraph graph,
IEdge edge,
boolean sourcePort)
Factory method that creates the handle for this provider.
|
IHandle |
getHandle(IInputModeContext context,
IEdge edge,
boolean sourceHandle)
Gets an
IHandle implementation for one end of the provided edge . |
Iterable<IHandle> |
getHandles(IInputModeContext context)
Returns a collection of zero or more
IHandle implementations that are associated with this instance. |
protected final IEdge edge
protected final IGraph graph
public PortRelocationHandleProvider(IGraph graph, IEdge edge)
PortRelocationHandleProvider
class using the given graph and edge.graph
- The graph or null. If the graph is null, the handles will try to receive the graph from the IInputModeContext
it
is used in.edge
- The edge.protected IHandle createPortRelocationHandle(IGraph graph, IEdge edge, boolean sourcePort)
graph
- The graph that contains the edge.edge
- The edge.sourcePort
- if set to true
the handle for the source port is sought.null
.public final IHandle getHandle(IInputModeContext context, IEdge edge, boolean sourceHandle)
IEdgePortHandleProvider
IHandle
implementation for one end of the provided edge
.getHandle
in interface IEdgePortHandleProvider
context
- The context in which the handle will be used.edge
- The edge for which an handle is needed.sourceHandle
- if set to true
the handle for the source side/port should be returned.null
.public Iterable<IHandle> getHandles(IInputModeContext context)
IHandleProvider
IHandle
implementations that are associated with this instance.getHandles
in interface IHandleProvider