Remarks
Predefined LookupDecorator<TDecoratedType, TInterface> are made available through properties like e.g. highlightRenderer. Note that the list of possible decorations that are available using this class is not exhaustive in any way. This is merely a way to provide access to those interfaces that are more commonly being decorated by the developer.
Typically, a configured instance of this class is available through edges on the GraphDecorator which is returned by decorator on an IGraph.
This decorator can be used to conveniently decorate the lookup of IEdges in an IGraph. It serves as a factory for predefined LookupDecorator<TDecoratedType, TInterface> instances that are specifically useful for the IEdge type.
Examples
The edge can be decorated in various ways. addConstant decorates the edge's lookup to return the same instance for each edge.
graph.decorator.edges.selectionRenderer.addConstant(
new ConstantSelection(),
)addConstant with a predicate decorates the edge's lookup only to return the same instance for each edge for which the predicate returns true.
graph.decorator.edges.selectionRenderer.addConstant(
(edge) => edge.tag !== null,
new ConstantSelection(),
)addFactory calls the provided factory method to return a new instance of the queried type created for the given edge or for edges for which the predicate returns true, respectively:
graph.decorator.edges.selectionRenderer.addFactory(
(edge) => new CustomSelection(edge),
)
graph.decorator.edges.selectionRenderer.addFactory(
(edge) => edge.tag !== null,
(edge) => new CustomSelection(edge),
)addWrapperFactory calls the provided factory method to return a new instance of the queried type which wraps the default implementation, once for all edges and once only for edges for which the predicate returns true.
graph.decorator.edges.selectionRenderer.addWrapperFactory(
(edge, original) => new SelectionWrapper(edge, original),
)
graph.decorator.edges.selectionRenderer.addWrapperFactory(
(edge) => edge.tag !== null,
(edge, original) => new SelectionWrapper(edge, original),
)Finally hide hides the default implementation by letting the lookup always return null for all edges and for edges for which the predicate returns true, respectively
graph.decorator.edges.selectionRenderer.hide()
graph.decorator.edges.selectionRenderer.hide((edge) => edge.tag !== null)Each of these methods returns a IContextLookupChainLink which can be used to remove the modified behavior again:
constructor() {}
registerLookup(graph: IGraph): void {
this.chainLink = graph.decorator.edges.selectionRenderer.addFactory(
(edge) => new CustomSelection(edge),
)!
}
deregisterLookup(graph: IGraph): void {
graph.decorator.edges.remove(this.chainLink)
}See Also
Developer's Guide
API
- GraphDecorator, LookupDecorator
Members
Constructors
Initializes a new instance of the EdgeDecorator class.
Parameters
- decorator: ILookupDecorator
- The decorator to use.
Properties
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IBendCreator type for IEdges this instance has been created for.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IBendSelectionTester type for IEdges this instance has been created for.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IClipboardHelper type for IEdges this instance has been created for.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IEditLabelHelper type for IEdges this instance has been created for.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IFocusRenderer<IEdge> type for IEdges this instance has been created for.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IHandleProvider type for IEdges this instance has been created for.
Custom IHandleProvider implementations provide interactive draggable handles for the user to change the geometry or other aspects of IEdges in the GraphComponent. This interface is mainly used by the HandleInputMode in the GraphEditorInputMode. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
When the decorated IHandleProvider provides a set of handles that may change over time, a call to requeryHandles may be necessary to refresh the displayed handles.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IHighlightRenderer<IEdge> type for IEdges this instance has been created for.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the ILassoTestable type for IEdges this instance has been created for.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IMarqueeTestable type for IEdges this instance has been created for.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IMementoSupport type for IEdges this instance has been created for.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IObstacleProvider type for IEdges this instance has been created for.
Property Value
See Also
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IOrthogonalEdgeHelper type for IEdges this instance has been created for.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IPortCandidateProvider type for IEdges this instance has been created for.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IEdgePortHandleProvider type for IEdges this instance has been created for.
Custom IEdgePortHandleProvider implementations can be used to provide interactive draggable handles for the source and target end points of an edge. This interface is mainly used by the HandleInputMode in the GraphEditorInputMode and by the implementations that work with OrthogonalEdgeEditingContext. Implementations may decide, e.g. whether to yield IHandle implementations that either move the edge to another port(-candidate) using setEdgePorts or whether to move the port the edge is currently connected to itself, instead. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
When the decorated IEdgePortHandleProvider provides a set of handles that may change over time, a call to requeryHandles may be necessary to refresh the displayed handles.
Property Value
See Also
Developer's Guide
API
- PortRelocationHandle, IHandle, IHandleProvider, OrthogonalEdgeEditingContext
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IPositionHandler type for IEdges this instance has been created for.
Property Value
reconnectionPortCandidateProvider
: LookupDecorator<IEdge, IEdgeReconnectionPortCandidateProvider>readonlyGets a LookupDecorator<TDecoratedType, TInterface> that decorates the IEdgeReconnectionPortCandidateProvider type for IEdges this instance has been created for.
reconnectionPortCandidateProvider
: LookupDecorator<IEdge, IEdgeReconnectionPortCandidateProvider>Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the ISelectionRenderer<IEdge> type for IEdges this instance has been created for.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the ISnapReferenceProvider type for IEdges this instance has been created for.
Property Value
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IEdgeSnapResultProvider type for IEdges this instance has been created for.
Property Value
Examples
graph.decorator.edges.orthogonalEdgeHelper.addFactory(
(edge) =>
new OrthogonalEdgeHelper({
edge,
implicitlyMoveEnds: true,
}),
)Methods
Adds an IContextLookupChainLink.
Parameters
- link: IContextLookupChainLink
- The lookup chain link to add.
getDecoratorFor
<TInterface> (interfaceType: Constructor<TInterface>): LookupDecorator<IEdge, TInterface>Creates a LookupDecorator<TDecoratedType, TInterface> for IEdges that can be used to decorate TInterface types of the edges.
getDecoratorFor
<TInterface> (interfaceType: Constructor<TInterface>): LookupDecorator<IEdge, TInterface>TInterface types of the edges.Parameters
- interfaceType: Constructor<TInterface>
- The type of the interface that should be decorated of the instances' lookup.
Return Value
- LookupDecorator<IEdge, TInterface>
- A new LookupDecorator<TDecoratedType, TInterface> for the specified interface.
Removes an IContextLookupChainLink that has been added by one of the various decorators for edges.
Parameters
- link: IContextLookupChainLink
- The lookup chain link to remove.
Examples
constructor() {}
registerLookup(graph: IGraph): void {
this.chainLink = graph.decorator.edges.selectionRenderer.addFactory(
(edge) => new CustomSelection(edge),
)!
}
deregisterLookup(graph: IGraph): void {
graph.decorator.edges.remove(this.chainLink)
}