documentationfor yFiles for HTML 3.0.0.3

DelegatingPortStyle

A foundational abstract implementation of IPortStyle that delegates its behavior to pre-configured style instances.

Inheritance Hierarchy
PortStyleBase<Visual>
DelegatingPortStyle
Implemented Interfaces

Remarks

This class supports three primary use cases:

  • Wrapping another style with a customized API. This is ideal for providing a simpler or domain-specific API by mapping properties from a subclass to the corresponding values of the delegated style. Subclasses typically return the preconfigured instance from getStyle and modify it in the constructor or through custom property setters.
  • Dynamically reconfiguring a style based on the target port. In this scenario, the implementation keeps one or more style instances as fields and switches between them in getStyle, depending on attributes of the port, such as its tag property. This approach may also involve dynamically reconfiguring the style instance for specific port instances. When appropriate, implementations may override clone to simply return this.
  • Replacing one part of the implementation of another style. Instead of subclassing another style, the implementation delegates to all but a subset of the various aspects to an existing implementation and provides its own implementation, otherwise, via overriding specific methods of the base PortStyleBase<TVisual> class.

Subclasses must implement getStyle and should ensure that it executes quickly and without allocations.

Type Details

yFiles module
view

See Also

Constructors

Properties

Methods