C

EdgeDecorator

Helps in decorating the lookup method of IEdge instances by providing access to decorators for the most common types.
Inheritance Hierarchy

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

Show:

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.
Custom IBendCreator implementations can be used to influence the interactive creation of new IBends. This interface is mainly used by the CreateBendInputMode in GraphEditorInputMode. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IBendCreator instances on IEdges.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IBendSelectionTester type for IEdges this instance has been created for.
Custom IBendSelectionTester implementations can be used to influence hit test behavior for bends on edges. This interface is mainly used by the GraphEditorInputMode and CreateBendInputMode to determine whether an existing bend has been hit. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IBendSelectionTester instances on IEdges.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IClipboardHelper type for IEdges this instance has been created for.
Custom IClipboardHelper implementations can be used to customize the way the clipboard operations are performed by GraphClipboard. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IClipboardHelper instances on IEdges.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IEditLabelHelper type for IEdges this instance has been created for.
Custom IEditLabelHelper implementations can be used to change or customize interactive label editing and label creation. This interface is mainly used by the GraphEditorInputMode which uses the callbacks from the implementation to determine the label to add or edit, as well as to customize the TextEditorInputMode appearance for the upcoming edit. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IEditLabelHelper instances on IEdges.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IFocusRenderer<IEdge> type for IEdges this instance has been created for.
Custom IFocusRenderer<IEdge> implementations can be used to change the way the focus of an IEdge is represented in a GraphComponent. This interface is mainly used by the FocusIndicatorManager<T> in the GraphComponent. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IFocusRenderer<IEdge> instances on IEdges.
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.

readonlyfinal

Property Value

A decorator that can be used to modify the queries for IHandleProvider instances on IEdges.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IHighlightRenderer<IEdge> type for IEdges this instance has been created for.
Custom IHighlightRenderer<IEdge> implementations can be used to change the way the highlighting of an IEdge is represented in a GraphComponent. This interface is mainly used by the HighlightIndicatorManager<T> in the GraphComponent. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IHighlightRenderer<IEdge> instances on IEdges.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the ILassoTestable type for IEdges this instance has been created for.
Custom ILassoTestable implementations can be used to change the way tests for lasso inclusions are performed on the IEdges in the editor. This interface is mainly used by the GraphEditorInputMode. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for ILassoTestable instances on IEdges
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IMarqueeTestable type for IEdges this instance has been created for.
Custom IMarqueeTestable implementations can be used to change the way tests for marquee inclusions are performed on IEdges in the editor. This interface is mainly used by the GraphEditorInputMode. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IMarqueeTestable instances on IEdges.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IMementoSupport type for IEdges this instance has been created for.
Custom IMementoSupport implementations can be used to make the UndoEngine aware of changes to data that is associated with the IEdges. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IMementoSupport instances on IEdges.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IObstacleProvider type for IEdges this instance has been created for.
Custom IObstacleProvider implementations provide information about obstacles that will be considered by GraphObstacleProvider which itself serves as a provider for geometric obstacles to BridgeManager that manages the rendering of bridges in edge paths. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IObstacleProvider instances on IEdges.

See Also

API
GraphObstacleProvider, BridgeManager
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IOrthogonalEdgeHelper type for IEdges this instance has been created for.
Custom IOrthogonalEdgeHelper implementations can be used to change the orthogonal edge editing behavior in the context of OrthogonalEdgeEditingContext. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IOrthogonalEdgeHelper instances on IEdges.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IPortCandidateProvider type for IEdges this instance has been created for.
Custom IPortCandidateProvider implementations can be used to present the user with a set of IPortCandidates that newly created edges can use as their source and target IPorts. This interface is mainly used by the CreateEdgeInputMode mode of GraphEditorInputMode if allowEdgeToEdgeConnections is enabled. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IPortCandidateProvider instances on IEdges.
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.

readonlyfinal

Property Value

A decorator that can be used to modify the queries for IEdgePortHandleProvider instances on edges.

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.
Custom IPositionHandler implementations can be used to restrict or enhance the way the user moves IEdges interactively in the editor. This interface is mainly used by the MoveInputMode. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IPositionHandler instances on IEdges.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IEdgeReconnectionPortCandidateProvider type for IEdges this instance has been created for.
Custom IEdgeReconnectionPortCandidateProvider implementations can be used to change the set of possible IPortCandidates that are available for an existing edge in the IGraph if the user interactively tries to change the ports of an IEdge in a GraphComponent. This interface is mainly used by the PortRelocationHandle. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
For folding-enabled graphs it is mandatory that the masterGraph is decorated. Decorating the view graph may result in an exception.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IEdgeReconnectionPortCandidateProvider instances on IEdges.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the ISelectionRenderer<IEdge> type for IEdges this instance has been created for.
Custom ISelectionRenderer<IEdge> implementations can be used to change the way the selection of an IEdge is represented in a GraphComponent. This interface is mainly used by the SelectionIndicatorManager<T> in the GraphComponent. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for ISelectionRenderer<IEdge> instances on IEdges.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the ISnapReferenceProvider type for IEdges this instance has been created for.
Custom ISnapReferenceProvider implementations can be used to provide custom SnapReferences based on the IEdges this instance has been created for. This could e.g. be a horizontal OrthogonalSnapLine vertically centered between two horizontal segments of one of these edges. This interface is mainly used by the GraphSnapContext to collect all available OrthogonalSnapLines of orthogonal edge segments. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify queries for ISnapReferenceProvider instances on IEdges.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IEdgeSnapResultProvider type for IEdges this instance has been created for.
Custom IEdgeSnapResultProvider implementations can be used to change the snapping behavior of edges while they are being moved in the context of a GraphSnapContext. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IEdgeSnapResultProvider instances on IEdges.

Examples

Setting a configured orthogonal edge helper
graph.decorator.edges.orthogonalEdgeHelper.addFactory(
  (edge) =>
    new OrthogonalEdgeHelper({
      edge,
      implicitlyMoveEnds: true,
    }),
)

Methods

Note that the various decorators for edges provide a more convenient way to add chain links to the lookup.
final

Parameters

link: IContextLookupChainLink
The lookup chain link to add.
Creates a LookupDecorator<TDecoratedType, TInterface> for IEdges that can be used to decorate TInterface types of the edges.
final

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

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)
}