I

IPortCandidateProvider

This interface is used to provide IPortCandidates for a specific IPortOwner.
Inheritance Hierarchy

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 helper 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.

See Also

Developer's Guide

API

portCandidateProvider

Demos

Shows how edge creation can be customized.

Members

No filters for this type

Methods

Returns all source port candidates that belong to the context of this provider.
The enumerable may contain valid, invalid, and dynamic port candidates.
abstract

Parameters

context: IInputModeContext
The context for which the candidates should be provided.

Return Value

IEnumerable<IPortCandidate>
An enumerable over all source port candidates that are associated with the current context.

See Also

Developer's Guide
Returns all target port candidates that belong to the context of this provider.
The enumerable may contain valid, invalid, and dynamic port candidates.
abstract

Parameters

context: IInputModeContext
The context for which the candidates should be provided.

Return Value

IEnumerable<IPortCandidate>
An enumerable over all target port candidates that are associated with the current context.

See Also

Developer's Guide
Returns all port candidates that apply for the provided opposite port candidate.
The enumerable may contain valid, invalid, and dynamic port candidates.
abstract

Parameters

context: IInputModeContext
The context for which the candidates should be provided.
target: IPortCandidate
The opposite port candidate.

Return Value

IEnumerable<IPortCandidate>
An enumerable over all port candidates that are associated with the given opposite port.

See Also

Developer's Guide
Returns all port candidates that apply for the provided opposite port candidate.
The enumerable may contain valid, invalid, and dynamic port candidates.
abstract

Parameters

context: IInputModeContext
The context for which the candidates should be provided.
source: IPortCandidate
The opposite port candidate.

Return Value

IEnumerable<IPortCandidate>
An enumerable over all port candidates that are associated with the given opposite port.

See Also

Developer's Guide

Constants

A generic implementation of the IPortCandidateProvider interface that provides no candidates.
static

Examples

graph.decorator.nodes.portCandidateProvider.addConstant(
  IPortCandidateProvider.NO_CANDIDATES,
)

See Also

Developer's Guide

Static Methods

Creates a generic composite implementation for the IPortCandidateProvider interface.
static

Parameters

providers: IEnumerable<IPortCandidateProvider>
The providers to create the composite from.

Return Value

IPortCandidateProvider
An instance of IPortCandidateProvider that combines the given providers.

Examples

This method can directly be used as factory for a LookupDecorator<TDecoratedType, TInterface>
graph.decorator.nodes.portCandidateProvider.addFactory((node) =>
  IPortCandidateProvider.combine(
    IPortCandidateProvider.fromNodeCenter(node),
    IPortCandidateProvider.fromShapeGeometry(node, 0.25, 0.75),
  ),
)

See Also

Developer's Guide
Creates a generic composite implementation for the IPortCandidateProvider interface.
static

Parameters

providers: IPortCandidateProvider
The providers to create the composite from.

Return Value

IPortCandidateProvider
An instance of IPortCandidateProvider that combines the given providers.

Examples

This method can directly be used as factory for a LookupDecorator<TDecoratedType, TInterface>
graph.decorator.nodes.portCandidateProvider.addFactory((node) =>
  IPortCandidateProvider.combine(
    IPortCandidateProvider.fromNodeCenter(node),
    IPortCandidateProvider.fromShapeGeometry(node, 0.25, 0.75),
  ),
)
static

Parameters

Return Value

IPortCandidateProvider
Creates an implementation of an IPortCandidateProvider that provides only the given port candidates.
static

Parameters

candidates: IPortCandidate
The port candidates the provider should provide.

Return Value

PortCandidateProviderBase
An instance of PortCandidateProviderBase that returns the given port candidates.
Creates an implementation of an IPortCandidateProvider that provides only the given port candidates.
static

Parameters

candidates: IEnumerable<IPortCandidate>
The port candidates the provider should provide.

Return Value

PortCandidateProviderBase
An instance of PortCandidateProviderBase that returns the given port candidates.

See Also

Developer's Guide
Creates an implementation of the IPortCandidateProvider interface that returns the ports that exist in the given ports's IPortOwner collection.
static

Parameters

owner: IPortOwner
The owner of the port collection.

Return Value

IPortCandidateProvider
An instance of IPortCandidateProvider that provides the ports from the owner's collection.

Examples

This method can directly be used as factory for a LookupDecorator<TDecoratedType, TInterface>
graph.decorator.nodes.portCandidateProvider.addFactory((node) =>
  IPortCandidateProvider.fromExistingPorts(node),
)

See Also

Developer's Guide
Creates a trivial implementation of an IPortCandidateProvider that always returns exactly one candidate that is centered at the node's layout.
static

Parameters

node: INode
The node to get the layout's center from.

Return Value

PortCandidateProviderBase
An instance of PortCandidateProviderBase that returns the candidate centered at the node's layout.

Examples

This method can directly be used as factory for a LookupDecorator<TDecoratedType, TInterface>
graph.decorator.nodes.portCandidateProvider.addFactory((node) =>
  IPortCandidateProvider.fromNodeCenter(node),
)

See Also

Developer's Guide
Creates an implementation of an IPortCandidateProvider that always returns a candidate that uses the default locationParameter for the corresponding IPortDefaults.
static

Parameters

owner: IPortOwner
The owner of the port.

Return Value

IPortCandidateProvider
An instance of IPortCandidateProvider that always returns a candidate that uses the default locationParameter for the corresponding IPortDefaults.

Examples

This method can directly be used as factory for a LookupDecorator<TDecoratedType, TInterface>
graph.decorator.nodes.portCandidateProvider.addFactory((node) =>
  IPortCandidateProvider.fromPortDefaults(node),
)

See Also

Developer's Guide
Creates an implementation of IPortCandidateProvider that works for IPortOwner implementations that have IShapeGeometry instances in their lookup.
static

Parameters

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.

Return Value

PortCandidateProviderBase
An instance of PortCandidateProviderBase that provides the ports from the shape geometry.

Examples

graph.decorator.nodes.portCandidateProvider.addFactory((node) =>
  IPortCandidateProvider.fromShapeGeometry(node, 0.25, 0.75),
)

See Also

Developer's Guide
Creates an implementation of IPortCandidateProvider that works for IPortOwner implementations that have IShapeGeometry instances in their lookup.
static

Parameters

owner: IPortOwner
The owner to receive the shape geometry from
addExistingPortsEnabled: boolean
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.

Return Value

PortCandidateProviderBase
An instance of PortCandidateProviderBase that provides the ports from the shape geometry.

Examples

graph.decorator.nodes.portCandidateProvider.addFactory((node) =>
  IPortCandidateProvider.fromShapeGeometry(node, 0.25, 0.75),
)
Creates an implementation of an IPortCandidateProvider that returns unoccupied ports at a given entity.
static

Parameters

owner: IPortOwner
The owner to query the ports from.

Return Value

IPortCandidateProvider
An instance of IPortCandidateProvider that returns unoccupied ports.

Examples

This method can directly be used as factory for a LookupDecorator<TDecoratedType, TInterface>
graph.decorator.nodes.portCandidateProvider.addFactory((node) =>
  IPortCandidateProvider.fromUnoccupiedPorts(node),
)

See Also

Developer's Guide