public interface IPortCandidateProvider
IPortCandidate
s for a specific IPortOwner
.
It is used in the context of the items that will later become the owner (IPortOwner
) of the ports obtained from
the candidates. They are mainly used during edge creation where there is no real edge yet (only the dummy edge) and thus
they need to use the opposite IPortCandidate
to understand the context.
Implementations of this interface may be queried using the ILookup.lookup(java.lang.Class)
method of IPortOwner
implementations like INode
.
Note that this interface is similar to the interface IEdgeReconnectionPortCandidateProvider
in the sense that
they will both provide IPortCandidate
instances in a certain query context. They are used in different query
contexts, though. The two interfaces can come together in concrete implementations of
IEdgeReconnectionPortCandidateProvider
: an edge could potentially be connected to ports at any given IPortOwner
and thus the IPortCandidateProvider
interface can be queried from the respective IPortOwner
that the
edge will be reconnected to.
Modifier and Type | Field and Description |
---|---|
static IPortCandidateProvider |
NO_CANDIDATES
A generic implementation of the
IPortCandidateProvider interface that provides no candidates. |
Modifier and Type | Method and Description |
---|---|
static IPortCandidateProvider |
combine(IPortCandidateProvider... providers)
Creates a generic composite implementation for the
IPortCandidateProvider interface. |
static IPortCandidateProvider |
combine(Iterable<IPortCandidateProvider> providers)
Creates a generic composite implementation for the
IPortCandidateProvider interface. |
static AbstractPortCandidateProvider |
fromCandidates(IPortCandidate... candidates)
Creates an implementation of an
IPortCandidateProvider that provides only the given port candidates. |
static AbstractPortCandidateProvider |
fromCandidates(Iterable<IPortCandidate> candidates)
Creates an implementation of an
IPortCandidateProvider that provides only the given port candidates. |
static IPortCandidateProvider |
fromExistingPorts(IPortOwner owner)
Creates an implementation of the
IPortCandidateProvider interface that returns the ports that exist in the given
Ports 's IPortOwner collection. |
static AbstractPortCandidateProvider |
fromNodeCenter(INode node)
Creates a trivial implementation of an
IPortCandidateProvider that always returns exactly one candidate that is
centered at the node's Layout . |
static IPortCandidateProvider |
fromPortDefaults(IPortOwner owner)
Creates a simple implementation of an
IPortCandidateProvider that always returns a candidate that uses the
default LocationParameter for the corresponding
IPortDefaults . |
static AbstractPortCandidateProvider |
fromShapeGeometry(IPortOwner owner,
boolean addExistingPortsEnabled,
double minimumSegmentLength,
double... ratios)
Creates an implementation of
IPortCandidateProvider that works for IPortOwner implementations that have
IShapeGeometry instances in their lookup. |
static AbstractPortCandidateProvider |
fromShapeGeometry(IPortOwner owner,
double... ratios)
Creates an implementation of
IPortCandidateProvider that works for IPortOwner implementations that have
IShapeGeometry instances in their lookup. |
static IPortCandidateProvider |
fromUnoccupiedPorts(IPortOwner owner)
Creates a simple implementation of an
IPortCandidateProvider that returns unoccupied ports at a given entity. |
Iterable<IPortCandidate> |
getSourcePortCandidates(IInputModeContext context)
Returns all source port candidates that belong to the context of this provider.
|
Iterable<IPortCandidate> |
getSourcePortCandidates(IInputModeContext context,
IPortCandidate target)
Returns all port candidates that apply for the provided opposite port candidate.
|
Iterable<IPortCandidate> |
getTargetPortCandidates(IInputModeContext context)
Returns all target port candidates that belong to the context of this provider.
|
Iterable<IPortCandidate> |
getTargetPortCandidates(IInputModeContext context,
IPortCandidate source)
Returns all port candidates that apply for the provided opposite port candidate.
|
static final IPortCandidateProvider NO_CANDIDATES
IPortCandidateProvider
interface that provides no candidates.static IPortCandidateProvider combine(IPortCandidateProvider... providers)
IPortCandidateProvider
interface.providers
- The providers to create the composite from.static IPortCandidateProvider combine(Iterable<IPortCandidateProvider> providers)
IPortCandidateProvider
interface.providers
- The providers to create the composite from.static AbstractPortCandidateProvider fromCandidates(IPortCandidate... candidates)
IPortCandidateProvider
that provides only the given port candidates.candidates
- The port candidates the provider should provide.IPortCandidateProvider
.static AbstractPortCandidateProvider fromCandidates(Iterable<IPortCandidate> candidates)
IPortCandidateProvider
that provides only the given port candidates.candidates
- The port candidates the provider should provide.IPortCandidateProvider
.static IPortCandidateProvider fromExistingPorts(IPortOwner owner)
IPortCandidateProvider
interface that returns the ports that exist in the given
Ports
's IPortOwner
collection.owner
- The owner of the port collection.static AbstractPortCandidateProvider fromNodeCenter(INode node)
IPortCandidateProvider
that always returns exactly one candidate that is
centered at the node's Layout
.node
- The node to get the layout's center from.static IPortCandidateProvider fromPortDefaults(IPortOwner owner)
IPortCandidateProvider
that always returns a candidate that uses the
default LocationParameter
for the corresponding
IPortDefaults
.static AbstractPortCandidateProvider fromShapeGeometry(IPortOwner owner, boolean addExistingPortsEnabled, double minimumSegmentLength, double... ratios)
IPortCandidateProvider
that works for IPortOwner
implementations that have
IShapeGeometry
instances in their lookup.owner
- The owner to receive the shape geometry fromminimumSegmentLength
- the minimum length a segment needs to have in order to be used to add port candidates.ratios
- A number of double values that are interpreted as ratio values between 0.0 and 1.0. If none are given, the provider
inserts a port candidate at the center of each straight line segment.addExistingPortsEnabled
- determines whether
existing ports should be added to the list of ports
.static AbstractPortCandidateProvider fromShapeGeometry(IPortOwner owner, double... ratios)
IPortCandidateProvider
that works for IPortOwner
implementations that have
IShapeGeometry
instances in their lookup.owner
- The owner to receive the shape geometry fromratios
- A number of double values that are interpreted as ratio values between 0.0 and 1.0. If none are given, the provider
inserts a port candidate at the center of each straight line segment.static IPortCandidateProvider fromUnoccupiedPorts(IPortOwner owner)
IPortCandidateProvider
that returns unoccupied ports at a given entity.owner
- The owner to query the ports from.Iterable<IPortCandidate> getSourcePortCandidates(IInputModeContext context)
The enumerable may both contain valid, invalid, and dynamic
port candidates.
context
- The context for which the candidates should be provided.Iterable<IPortCandidate> getSourcePortCandidates(IInputModeContext context, IPortCandidate target)
The enumerable may both contain valid, invalid, and dynamic
port candidates.
target
- The opposite port candidate.Iterable<IPortCandidate> getTargetPortCandidates(IInputModeContext context)
The enumerable may both contain valid, invalid, and dynamic
port candidates.
context
- The context for which the candidates should be provided.Iterable<IPortCandidate> getTargetPortCandidates(IInputModeContext context, IPortCandidate source)
The enumerable may both contain valid, invalid, and dynamic
port candidates.
context
- The context for which the candidates should be provided.source
- The opposite port candidate.