This interface is used to provide IPortCandidates for a specific IPortOwner.
Remarks
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 lookup 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.
Related Programming Samples
- Port Candidate Provider
- Shows how edge creation can be customized.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.input.IPortCandidateProvider
See Also
Methods
Returns all source port candidates that belong to the context of this provider.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context for which the candidates should be provided.
Returns
- ↪IEnumerable<IPortCandidate>
- An enumerable over all source port candidates that are associated with the current context.
See Also
Returns all target port candidates that belong to the context of this provider.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context for which the candidates should be provided.
Returns
- ↪IEnumerable<IPortCandidate>
- An enumerable over all target port candidates that are associated with the current context.
See Also
getSourcePortCandidates
(context: IInputModeContext, target: IPortCandidate) : IEnumerable<IPortCandidate>Returns all port candidates that apply for the provided opposite port candidate.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context for which the candidates should be provided.
- target - IPortCandidate
- The opposite port candidate.
Returns
- ↪IEnumerable<IPortCandidate>
- An enumerable over all port candidates that are associated with the given opposite port.
See Also
getTargetPortCandidates
(context: IInputModeContext, source: IPortCandidate) : IEnumerable<IPortCandidate>Returns all port candidates that apply for the provided opposite port candidate.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context for which the candidates should be provided.
- source - IPortCandidate
- The opposite port candidate.
Returns
- ↪IEnumerable<IPortCandidate>
- An enumerable over all port candidates that are associated with the given opposite port.
See Also
Constants
A generic implementation of the IPortCandidateProvider interface that provides no candidates.
Examples
graph.decorator.nodeDecorator.portCandidateProviderDecorator.setImplementation(
IPortCandidateProvider.NO_CANDIDATES
)
See Also
Class.ensure(GraphEditorInputMode)
More information.Static Methods
Creates a generic composite implementation for the IPortCandidateProvider interface.
Parameters
A map of options to pass to the method.
- providers - IEnumerable<IPortCandidateProvider>
- The providers to create the composite from.
Examples
graph.decorator.nodeDecorator.portCandidateProviderDecorator.setFactory(
(node) =>
IPortCandidateProvider.combine(
IPortCandidateProvider.fromNodeCenter(node),
IPortCandidateProvider.fromShapeGeometry(node, 0.25, 0.75)
)
)
See Also
Class.ensure(GraphEditorInputMode)
More information.Creates a generic composite implementation for the IPortCandidateProvider interface.
Parameters
A map of options to pass to the method.
- providers - IPortCandidateProvider
- The providers to create the composite from.
Examples
graph.decorator.nodeDecorator.portCandidateProviderDecorator.setFactory(
(node) =>
IPortCandidateProvider.combine(
IPortCandidateProvider.fromNodeCenter(node),
IPortCandidateProvider.fromShapeGeometry(node, 0.25, 0.75)
)
)
Class.ensure(GraphEditorInputMode)
More information.Creates an implementation of the interface IPortCandidateProvider from the given definition.
Remarks
Parameters
A map of options to pass to the method.
- getSourcePortCandidates - function(IInputModeContext, IPortCandidate):IEnumerable<IPortCandidate>
Returns all port candidates that apply for the provided opposite port candidate.
This property holds the implementation for getSourcePortCandidates.
- getTargetPortCandidates - function(IInputModeContext, IPortCandidate):IEnumerable<IPortCandidate>
Returns all port candidates that apply for the provided opposite port candidate.
This property holds the implementation for getTargetPortCandidates.
- getAllSourcePortCandidates - function(IInputModeContext):IEnumerable<IPortCandidate>
Returns all source port candidates that belong to the context of this provider.
This property holds the implementation for getAllSourcePortCandidates.
- getAllTargetPortCandidates - function(IInputModeContext):IEnumerable<IPortCandidate>
Returns all target port candidates that belong to the context of this provider.
This property holds the implementation for getAllTargetPortCandidates.
Returns
- ↪IPortCandidateProvider
- An instance of the IPortCandidateProvider interface based on the given definition.
Creates an implementation of an IPortCandidateProvider that provides only the given port candidates.
Parameters
A map of options to pass to the method.
- candidates - IPortCandidate
- The port candidates the provider should provide.
Returns
Class.ensure(GraphEditorInputMode)
More information.Creates an implementation of an IPortCandidateProvider that provides only the given port candidates.
Parameters
A map of options to pass to the method.
- candidates - IEnumerable<IPortCandidate>
- The port candidates the provider should provide.
Returns
See Also
Class.ensure(GraphEditorInputMode)
More information.Creates an implementation of the IPortCandidateProvider interface that returns the ports that exist in the given ports's IPortOwner collection.
Parameters
A map of options to pass to the method.
- owner - IPortOwner
- The owner of the port collection.
Examples
graph.decorator.nodeDecorator.portCandidateProviderDecorator.setFactory(
(node) => IPortCandidateProvider.fromExistingPorts(node)
)
See Also
Class.ensure(GraphEditorInputMode)
More information.Creates a trivial implementation of an IPortCandidateProvider that always returns exactly one candidate that is centered at the node's layout.
Parameters
A map of options to pass to the method.
- node - INode
- The node to get the layout's center from.
Examples
graph.decorator.nodeDecorator.portCandidateProviderDecorator.setFactory(
(node) => IPortCandidateProvider.fromNodeCenter(node)
)
See Also
Class.ensure(GraphEditorInputMode)
More information.Creates an implementation of an IPortCandidateProvider that always returns a candidate that uses the default locationParameter for the corresponding IPortDefaults.
Examples
graph.decorator.nodeDecorator.portCandidateProviderDecorator.setFactory(
(node) => IPortCandidateProvider.fromPortDefaults(node)
)
See Also
Class.ensure(GraphEditorInputMode)
More information.Creates an implementation of IPortCandidateProvider that works for IPortOwner implementations that have IShapeGeometry instances in their lookup.
Parameters
A map of options to pass to the method.
- owner - IPortOwner
- The owner to receive the shape geometry from
- ratios - number
- 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.
Examples
graph.decorator.nodeDecorator.portCandidateProviderDecorator.setFactory(
(node) => IPortCandidateProvider.fromShapeGeometry(node, 0.25, 0.75)
)
See Also
Class.ensure(GraphEditorInputMode)
More information.fromShapeGeometry
(owner: IPortOwner, addExistingPortsEnabled: boolean, minimumSegmentLength: number, ratios: number…) : PortCandidateProviderBaseCreates an implementation of IPortCandidateProvider that works for IPortOwner implementations that have IShapeGeometry instances in their lookup.
Parameters
A map of options to pass to the method.
- owner - IPortOwner
- The owner to receive the shape geometry from
- addExistingPortsEnabled - boolean
- determines whether existing ports should be added to the list of ports.
- minimumSegmentLength - number
- the minimum length a segment needs to have in order to be used to add port candidates.
- ratios - number
- 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.
Examples
graph.decorator.nodeDecorator.portCandidateProviderDecorator.setFactory(
(node) => IPortCandidateProvider.fromShapeGeometry(node, 0.25, 0.75)
)
Class.ensure(GraphEditorInputMode)
More information.Creates an implementation of an IPortCandidateProvider that returns unoccupied ports at a given entity.
Parameters
A map of options to pass to the method.
- owner - IPortOwner
- The owner to query the ports from.
Examples
graph.decorator.nodeDecorator.portCandidateProviderDecorator.setFactory(
(node) => IPortCandidateProvider.fromUnoccupiedPorts(node)
)
See Also
Class.ensure(GraphEditorInputMode)
More information.