Helps in decorating the lookup method of IEdge instances by providing access to decorators for the most common types.
Remarks
Predefined LookupDecorator<TDecoratedType,TInterface> are made available through properties like e.g. highlightDecorator. 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 edgeDecorator 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. setImplementation decorates the edge's lookup to return the same instance for each edge.
graph.decorator.edgeDecorator.selectionDecorator.setImplementation(
new ConstantSelection()
)
setImplementation 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.edgeDecorator.selectionDecorator.setImplementation(
(edge) => edge.tag !== null,
new ConstantSelection()
)
setFactory 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.edgeDecorator.selectionDecorator.setFactory(
(edge) => new CustomSelection(edge)
)
graph.decorator.edgeDecorator.selectionDecorator.setFactory(
(edge) => edge.tag !== null,
(edge) => new CustomSelection(edge)
)
setImplementationWrapper 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.edgeDecorator.selectionDecorator.setImplementationWrapper(
(edge, original) => new SelectionWrapper(edge, original)
)
graph.decorator.edgeDecorator.selectionDecorator.setImplementationWrapper(
(edge) => edge.tag !== null,
(edge, original) => new SelectionWrapper(edge, original)
)
Finally hideImplementation 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.edgeDecorator.selectionDecorator.hideImplementation()
graph.decorator.edgeDecorator.selectionDecorator.hideImplementation(
(edge) => edge.tag !== null
)
Each of these methods returns a IContextLookupChainLink which can be used to remove the modified behavior again:
constructor() {}
/**
* @param {!IGraph} graph
*/
registerLookup(graph) {
this.chainLink =
graph.decorator.edgeDecorator.selectionDecorator.setFactory(
(edge) => new CustomSelection(edge)
)
}
/**
* @param {!IGraph} graph
*/
deregisterLookup(graph) {
graph.decorator.edgeDecorator.remove(this.chainLink)
}
constructor() {}
registerLookup(graph: IGraph): void {
this.chainLink =
graph.decorator.edgeDecorator.selectionDecorator.setFactory(
(edge) => new CustomSelection(edge)
)!
}
deregisterLookup(graph: IGraph): void {
graph.decorator.edgeDecorator.remove(this.chainLink)
}
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.graph.EdgeDecorator
See Also
Constructors
Initializes a new instance of the EdgeDecorator class.
Parameters
A map of options to pass to the method.
- decorator - ILookupDecorator
- The decorator to use, which can be
null
.
Properties
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IBendCreator type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IBendSelectionTester type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IClipboardHelper type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IEdgePortHandleProvider type for IEdges this instance has been created for.
Remarks
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.
See Also
edgeReconnectionPortCandidateProviderDecorator
: LookupDecorator<IEdge,IEdgeReconnectionPortCandidateProvider>Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IEdgeReconnectionPortCandidateProvider type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IEdgeSnapResultProvider type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IEditLabelHelper type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IFocusIndicatorInstaller type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IHandleProvider type for IEdges this instance has been created for.
Remarks
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.
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IHighlightIndicatorInstaller type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the ILassoTestable type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IMarqueeTestable type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IMementoSupport type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IObstacleProvider type for IEdges this instance has been created for.
Remarks
See Also
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IOrthogonalEdgeHelper type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IPortCandidateProvider type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the IPositionHandler type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the ISelectionIndicatorInstaller type for IEdges this instance has been created for.
Remarks
Gets a LookupDecorator<TDecoratedType,TInterface> that decorates the ISnapLineProvider type for IEdges this instance has been created for.
Remarks
Methods
getDecoratorFor
<TInterface>(type: Class, decorateNulls?: boolean, nullIsFallback?: boolean) : LookupDecorator<IEdge,TInterface>Creates a LookupDecorator<TDecoratedType,TInterface> for IEdges that can be used to decorate TInterface
types of the edges.
Type Parameters
- TInterface
- The type of the interface that should be decorated of the instances'
.
Parameters
A map of options to pass to the method.
- type - Class
- The type of the interface that should be decorated of the instances' lookup.
- decorateNulls - boolean
- if set to
true
null
values will be decorated, otherwise not. - nullIsFallback - boolean
- if set to
true
null
values will be treated as fallback values, otherwise they will be used as the final result.
Returns
- ↪LookupDecorator<IEdge,TInterface>
- A new LookupDecorator<TDecoratedType,TInterface> for the specified interface.
$class
property on JavaScript classes inheriting from yFiles classes is only valid once an instance of this subclass was created. Call fixType, first or instantiate the class at least once.Removes an IContextLookupChainLink again that has been added by one of the various decorators for edges.
Parameters
A map of options to pass to the method.
- lookup - IContextLookupChainLink
- The lookup chain link to remove.
Examples
constructor() {}
/**
* @param {!IGraph} graph
*/
registerLookup(graph) {
this.chainLink =
graph.decorator.edgeDecorator.selectionDecorator.setFactory(
(edge) => new CustomSelection(edge)
)
}
/**
* @param {!IGraph} graph
*/
deregisterLookup(graph) {
graph.decorator.edgeDecorator.remove(this.chainLink)
}
constructor() {}
registerLookup(graph: IGraph): void {
this.chainLink =
graph.decorator.edgeDecorator.selectionDecorator.setFactory(
(edge) => new CustomSelection(edge)
)!
}
deregisterLookup(graph: IGraph): void {
graph.decorator.edgeDecorator.remove(this.chainLink)
}