C

NodeDecorator

Helps in decorating the lookup method of INode 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 nodes on the GraphDecorator which is returned by decorator on an IGraph.

This decorator can be used to conveniently decorate the lookup of INodes in an IGraph. It serves as a factory for predefined LookupDecorator<TDecoratedType, TInterface> instances that are specifically useful for the INode type.

Examples

The node can be decorated in various ways. addConstant decorates the node's lookup to return the same instance for each node.

graph.decorator.nodes.sizeConstraintProvider.addConstant(
  new ConstantSizeConstraintProvider(),
)

addConstant with a predicate decorates the node's lookup only to return the same instance for each node for which the predicate returns true.

graph.decorator.nodes.sizeConstraintProvider.addConstant(
  (node) => node.tag !== null,
  new ConstantSizeConstraintProvider(),
)

addFactory calls the provided factory method to return a new instance of the queried type created for the given node or for nodes for which the predicate returns true, respectively:

graph.decorator.nodes.sizeConstraintProvider.addFactory(
  (node) => new CustomSizeConstraintProvider(node),
)
graph.decorator.nodes.sizeConstraintProvider.addFactory(
  (node) => node.tag !== null,
  (node) => new CustomSizeConstraintProvider(node),
)

addWrapperFactory calls the provided factory method to return a new instance of the queried type which wraps the default implementation, once for all nodes and once only for nodes for which the predicate returns true.

graph.decorator.nodes.sizeConstraintProvider.addWrapperFactory(
  (node, originalProvider) =>
    new SizeConstraintProviderWrapper(node, originalProvider),
)
graph.decorator.nodes.sizeConstraintProvider.addWrapperFactory(
  (node) => node.tag !== null,
  (node, originalProvider) =>
    new SizeConstraintProviderWrapper(node, originalProvider),
)

Finally hide hides the default implementation by letting the lookup always return null for all nodes and for nodes for which the predicate returns true, respectively

graph.decorator.nodes.sizeConstraintProvider.hide()
graph.decorator.nodes.sizeConstraintProvider.hide(
  (node) => node.tag !== null,
)

Each of these methods returns a IContextLookupChainLink which can be used to remove the modified behavior again:

registerLookup(graph: IGraph): void {
  this.chainLink =
    graph.decorator.nodes.sizeConstraintProvider.addFactory(
      (node) => new CustomSizeConstraintProvider(node),
    )!
}

deregisterLookup(graph: IGraph): void {
  graph.decorator.nodes.remove(this.chainLink)
}

See Also

Developer's Guide

API

GraphDecorator, LookupDecorator

Members

Show:

Constructors

Initializes a new instance of the NodeDecorator class.

Parameters

decorator: ILookupDecorator
The decorator to use.

Properties

Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IClipboardHelper type for INodes 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 INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IEditLabelHelper type for the INodes 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 INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IFocusRenderer<INode> type for INodes this instance has been created for.
Custom IFocusRenderer<INode> implementations can be used to change the way the focus of an INode 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<INode> instances on INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IGroupBoundsCalculator type for the INodes this instance has been created for.
Custom IGroupBoundsCalculator implementations can be used to change the way the bounds of group nodes are being calculated if the geometry of child nodes is changed by the user. 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 IGroupBoundsCalculator instances on INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IGroupPaddingProvider type for the INodes this instance has been created for.
Custom IGroupPaddingProvider implementations can be used to change the way the bounds of group nodes are being calculated if the geometry of child nodes is changed by the user. This interface will be used if there is no custom IGroupBoundsCalculator associated with the nodes (see groupBoundsCalculator). This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup. Note that some INodeStyle implementations provide either a property to change the padding or calculate an appropriate padding automatically based on their configuration. This padding is then available via an IGroupPaddingProvider implementation that is provided by the corresponding INodeStyleRenderer. In those cases, decorating the lookup just for padding is usually not necessary.
readonlyfinal

Property Value

A decorator that can be used to modify the queries for IGroupPaddingProvider instances on INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IHandleProvider type for INodes this instance has been created for.

Custom IHandleProvider implementations provide interactive draggable handles for the user to change the geometry or other aspects of INodes 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 INodes.

See Also

Developer's Guide
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IHighlightRenderer<INode> type for INodes this instance has been created for.
Custom IHighlightRenderer<INode> implementations can be used to change the way the highlighting of an INode 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<INode> instances on INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the ILassoTestable type for INodes this instance has been created for.
Custom ILassoTestable implementations can be used to change the way tests for lasso inclusions are performed on INodes 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 INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IMarqueeTestable type for INodes this instance has been created for.
Custom IMarqueeTestable implementations can be used to change the way tests for marquee inclusions are performed on INodes 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 INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IMementoSupport type for INodes 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 INodes. 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 INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IObstacleProvider type for INodes 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 INodes.

See Also

API
GraphObstacleProvider, BridgeManager
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IPortCandidateProvider type for the INodes 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. Also, the default implementation of IEdgeReconnectionPortCandidateProvider will use this interface to determine the candidates that are available if the user interactively moves the ports using PortRelocationHandle (see portHandleProvider). 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 INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IPositionHandler type for the INodes this instance has been created for.
Custom IPositionHandler implementations can be used to restrict or enhance the way the user moves INodes 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 INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IReshapeHandleProvider type for the INodes this instance has been created for.

Custom IReshapeHandleProvider implementations can be used to change the number and type of IHandles that can be used by the user to reshape the INodes interactively in the editor. This interface is mainly used by the GraphEditorInputMode which passes the IHandles to the HandleInputMode. This is a convenient alternative to the direct usage of the ILookupDecorator that is provided by the IGraph's lookup.

When the decorated IReshapeHandleProvider 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 IReshapeHandleProvider instances on INodes.

See Also

Developer's Guide
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IReshapeHandler type for the INodes this instance has been created for.
Custom IReshapeHandler implementations can be used to alter how nodes are resized interactively. This interface is mainly used by IReshapeHandleProvider and corresponding IHandle implementations as the low-level interface to delegate the actual size changes to. 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 IReshapeHandler instances on INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the INodeReshapeSnapResultProvider type for the INodes this instance has been created for.
Custom INodeReshapeSnapResultProvider implementations can be used to provide custom SnapResults based on the INodes this instance has been created for. This could e.g., be a SnapResult describing that the top left corner of the node wants to snap to a grid point. This interface is mainly used by the default IReshapeHandler for INodes to collect SnapResults during a resize gesture for the node. 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 INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the ISelectionRenderer<INode> type for INodes this instance has been created for.
Custom ISelectionRenderer<INode> implementations can be used to change the way the selection of an INode 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<INode> instances on INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the IShapeGeometry type for the INodes this instance has been created for.
Custom IShapeGeometry implementations can be used to change the way different code parts interpret the layout of an INode. This interface is mainly used by the EdgePathCropper, and a custom IPortCandidateProvider that can be obtained from fromShapeGeometry. Note that decorating the IShapeGeometry for an INode will not change the result of a call to getShapeGeometry of the style. So such a change will not influence standard hit tests. 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 IShapeGeometry instances on INodes.
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the INodeSizeConstraintProvider type for the INodes this instance has been created for.
Custom INodeSizeConstraintProvider implementations can be used to add constraints to the size of a node. These constraints are used by the default IReshapeHandleProvider implementation for nodes to enforce size constraints for interactive resize gestures. Also, GraphEditorInputMode uses this interface to constrain the size of a node whenever its labels are being edited interactively. 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 INodeSizeConstraintProvider instances on INodes.

See Also

Developer's Guide
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the ISnapReferenceProvider type for the INodes this instance has been created for.
Custom ISnapReferenceProvider implementations can be used to provide custom SnapReferences based on the INodes this instance has been created for. This could e.g., be a horizontal OrthogonalSnapLine at the vertical center of the node to which other nodes should snap with their top border. This interface is mainly used by the GraphSnapContext to collect all available SnapReferences. 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 INodes.

See Also

Developer's Guide
Gets a LookupDecorator<TDecoratedType, TInterface> that decorates the INodeSnapResultProvider type for the INodes this instance has been created for.
Custom INodeSnapResultProvider implementations can be used to provide custom SnapResults based on the INodes this instance has been created for. This could e.g., be a SnapResult describing that the top left corner of the node wants to snap to a grid point. This interface is mainly used by the default IPositionHandler for INodes to collect SnapResults during a drag gesture for the node. 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 INodeSnapResultProvider instances on INodes.

Methods

Note that the various decorators for nodes 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 INodes that can be used to decorate TInterface types of the nodes.
final

Parameters

interfaceType: Constructor<TInterface>
The type of the interface that should be decorated of the instances' lookup.

Return Value

LookupDecorator<INode, TInterface>
A new LookupDecorator<TDecoratedType, TInterface> for the specified interface.

See Also

Developer's Guide
Removes an IContextLookupChainLink that has been added by one of the various decorators for nodes.
final

Parameters

link: IContextLookupChainLink
The lookup chain link to remove.

Examples

registerLookup(graph: IGraph): void {
  this.chainLink =
    graph.decorator.nodes.sizeConstraintProvider.addFactory(
      (node) => new CustomSizeConstraintProvider(node),
    )!
}

deregisterLookup(graph: IGraph): void {
  graph.decorator.nodes.remove(this.chainLink)
}

See Also

Developer's Guide