documentationfor yFiles for HTML 3.0.0.3

LookupDecorator<TDecoratedType,TInterface>

Simplifies using an ILookupDecorator.

Inheritance Hierarchy
LookupDecorator

Remarks

This class provides methods that help in performing common tasks related to decorating the lookup method for a certain TDecoratedType:

  • Set a single implementation
  • Set a factory that creates item-specific implementations
  • Wrap the default implementation
  • Hide the default implementation

Each of these methods adds a new IContextLookupChainLink to the lookup chain which adds the wanted behavior. The link can be removed again by calling the remove method on the parent decorator, e.g., the NodeDecorator.

Typically, one does not create instances of this class but uses the item specific implementations provided by GraphDecorator: nodes, edges, labels, ports, and bends.

Examples

Getting the decorator for a node's size constraint provider
const decorator = graph.decorator.nodes.sizeConstraintProvider
Setting a single implementation
graph.decorator.nodes.sizeConstraintProvider.addConstant(
  new ConstantSizeConstraintProvider(),
)
Setting a factory that creates item-specific implementations
graph.decorator.nodes.selectionRenderer.addFactory(
  (node) => new RedSelectionRenderer(node),
)
Wrapping the default implementation
graph.decorator.nodes.positionHandler.addWrapperFactory(
  (node, original) =>
    new ConstrainedPositionHandlerWrapper(original!, node!),
)
Hiding the default implementation
graph.decorator.nodes.positionHandler.hide()

Type Parameters

TDecoratedType
The type of the instances whose behavior should be modified.
TInterface
The interface or type that clients will use during the call. Note that this is normally an interface and not the implementation of the interface since client code will use the interface for the query.

Type Details

yFiles module
view

See Also

Constructors

Methods