C

MultiComponentLayerAssigner

This class is a wrapper ILayerAssigner implementation that delegates the actual layering to a delegate ILayerAssigner.
ImplementsInheritance Hierarchy

Remarks

If the graph consists of multiple components, they will be identified and sorted, and each of the components will be layered separately using the delegate ILayerAssigner instance. After that, they will all be merged using the method merge and according to a specified mergingPolicy.

Default Values of Properties

NameDefaultDescription
mergingPolicyLayerMergingPolicy.ADD_RIGHT_TOP_ALIGNED
Nodes of the source HierarchicalLayoutContext layering are to the right of the target layering and all nodes are top-aligned.

Members

Show:

Constructors

Creates a new instance of MultiComponentLayerAssigner.

Parameters

singleComponentLayerAssigner: ILayerAssigner
The layer assigner to be used for single components.

Throws

Exception ({ name: 'ArgumentError' })
if the given layer assigner is null

Properties

Gets or sets the comparison function to sort the lists of nodes that form a component.
final

Property Value

the component comparison or null if no specific comparison exists
Gets or sets the merging policy that is obeyed by the default implementation of merge.
conversionfinal

Property Value

one of the predefined merging policy constants

Default Value

Nodes of the source HierarchicalLayoutContext layering are to the right of the target layering and all nodes are top-aligned.
Gets or sets the delegate ILayerAssigner instance.
final

Property Value

the given ILayerAssigner instance

Throws

Exception ({ name: 'ArgumentError' })
if the specified ILayerAssigner is null

Methods

Assigns all nodes of the graph to layers and adds them to the layers in the given layoutContext.

In order to create new layers, factory method insertLayer has to be used.

Information about the nodes is provided by a HierarchicalLayoutContext instance. However, positional information (see position and layer) is not available during this phase.

final

Parameters

graph: LayoutGraph
the input graph
layoutContext: HierarchicalLayoutContext
The HierarchicalLayoutContext instance providing access to context information for the graph elements, as well as the layers the nodes are assigned to.
Merges the two layer lists contained in the two given HierarchicalLayoutContext instances.

All nodes that belong to the source and target layers are part of the graph at the moment of invocation.

The state of the source HierarchicalLayoutContext instance is discarded after this call and does not need to be updated to reflect the changes. The target HierarchicalLayoutContext instance must be updated accordingly.

By default, this method takes into account the mergingPolicy to merge layers. It can be overridden to implement a custom merging strategy.

protected

Parameters

graph: LayoutGraph
the graph containing the nodes of both contexts/layerings
sourceLayersContext: HierarchicalLayoutContext
the HierarchicalLayoutContext that holds the source layers that will be merged into the target layers
targetLayersContext: HierarchicalLayoutContext
the HierarchicalLayoutContext that holds the target layers that will be modified to contain the resulting (merged) layering
Sorts an array which consists of YList<T>s, where each list contains nodes that belong to the same component.

It is called during assignLayers.

By default, this method uses the componentComparator to sort the list and has no effect if the instance is null. This means it ignores the componentIndexProvider parameter.

The method may be overridden to implement a custom ordering of the components.

protected

Parameters

nodeLists: YList<LayoutNode>[]
the array of YList<T> with LayoutNodes each of which containing nodes that belong to the same component
componentIndexProvider: IMapper<LayoutNode, number>
the IMapper<K, V> that returns an object representing the component index for each node (this value can be either integer or object)