Manages the visual appearance of an IGraph instance in a CanvasComponent.
Remarks
This class monitors the structural changes of an IGraph implementation and installs the necessary IRenderTreeElement instance in the canvas for each item in the graph. Note that GraphComponent already has an instance of this type built-in, and usually it is not necessary to create your own.
This class will also use the node hierarchy to nest the nodes and edges accordingly and respect the nodeLabelLayerPolicy, edgeLabelLayerPolicy, portLabelLayerPolicy, and portLayerPolicy settings.
Type Details
- yFiles module
- view
See Also
Constructors
Creates a new manager instance.
Remarks
Note that a properly configured instance is already set by default to a GraphComponent's graphModelManager property.
If a new instance of this is set to a GraphComponent's graphModelManager property, method install will be called automatically.
If this instance is not set via the graphModelManager property, it is important that the install life-cycle methods are called.
Properties
Gets the currently installed in CanvasComponent.
Gets the IRenderTreeGroup instance that will be used for installing edge styles.
Remarks
If the field has not yet been initialized upon first access, the factory method createEdgeGroup will be called.
Note that in the case of hierarchically nested graphs, the main render tree elements of edges will only be put directly in this IRenderTreeGroup, if the property is not set to NODES_AND_EDGES. Otherwise, they will actually be nested in the subtree of the nodeGroup according to the node nesting.
See Also
Gets the IRenderTreeGroup instance that will be used for installing edge label styles.
Remarks
See Also
Gets or sets the policy to determine at which visual layer edge labels shall be inserted.
Remarks
Provides access to the ItemModelManager<T> which handles the ILabels at edges.
Remarks
Gets or sets the IObjectRenderer<ILabel> instance used for installing an ILabel of an IEdge into the canvas.
Provides access to the ItemModelManager<T> which handles the IEdges.
Remarks
Gets or sets the IObjectRenderer<IEdge> instance used for installing an IEdge into the canvas.
Gets or sets the graph this manager manages.
See Also
Gets the IRenderTreeGroup instance that will be used for installing node styles of group nodes.
Remarks
See Also
Gets or sets the policy whether and how this instance should nest the nodes and edges if the graph is grouped.
Remarks
Gets a IHitTester that can be used to enumerate hits on the canvas at a given world coordinate position.
Remarks
Gets the IRenderTreeGroup instance that will be used for installing node styles.
Remarks
If the field has not yet been initialized upon first access, the factory method createNodeGroup will be called.
Note that the content of this group depends on the hierarchicalNestingPolicy:
- NONE – Contains the main render tree elements of all nodes top-level.
- NODES – Contains the main render tree elements of all nodes in a more complicated nesting of dynamically created IRenderTreeGroups.
- NODES_AND_EDGES – Contains the main render tree elements of all nodes and edges in a more complicated nesting of dynamically created IRenderTreeGroup s.
- GROUP_NODES – Contains the main render tree elements of all leaf nodes. Group nodes having the same hierarchical depth are in one child IRenderTreeGroup of the groupNodeGroup instead.
See Also
Gets the IRenderTreeGroup instance that will be used for installing node label styles.
Remarks
See Also
Gets or sets the policy to determine at which visual layer node labels shall be inserted.
Remarks
Provides access to the ItemModelManager<T> which handles the ILabels at nodes.
Remarks
Gets or sets the IObjectRenderer<ILabel> instance used for installing an ILabel of an INode into the canvas.
Provides access to the ItemModelManager<T> which handles the INodes.
Remarks
Gets or sets the IObjectRenderer<INode> instance used for installing an INode into the canvas.
Gets the IRenderTreeGroup instance that will be used for installing port styles.
Remarks
See Also
Gets the IRenderTreeGroup instance that will be used for installing port label styles.
Remarks
See Also
Gets or sets the policy to determine at which visual layer port labels shall be inserted.
Remarks
Provides access to the ItemModelManager<T> which handles the ILabels at ports.
Remarks
Gets or sets the IObjectRenderer<ILabel> instance used for installing an ILabel of an IPort into the canvas.
Gets or sets the policy to determine at which visual layer node and edge ports shall be inserted.
Remarks
Provides access to the ItemModelManager<T> which handles the IPorts.
Remarks
Gets or sets the IObjectRenderer<IPort> instance used for installing an IPort into the canvas.
Gets or sets if the tag should be provided by its main render tree element.
Remarks
The tag is already provided by the render tree element visualizing the model item. As this render tree element may differ from the main render tree element, this property determines only if the tag is provided by its main render tree element if it differs from getRenderTreeElement.
The default value is false
.
Gets an comparison instance that can be used to compare two model items with respect to their visual display order.
Remarks
Signature Details
function(x: IModelItem, y: IModelItem) : number
Parameters
- x - IModelItem
- The first object to compare.
- y - IModelItem
- The second object to compare.
Returns
- number
- An integer value which is
<0
ifx
is less thany
,0
ifx
is equal toy
, or>0
ifx
is greater thany
Methods
Compares two items with respect to their rendering order.
Parameters
A map of options to pass to the method.
- item1 - IModelItem
- the first item to compare
- item2 - IModelItem
- the second item to compare
Returns
- ↪number
- 0 if item1 == item2, > 0 if item1 is rendered behind item2, < 0 if item1 is rendered in front of item2. Items that are not part of the visualization are always considered to be rendered first.
See Also
Factory method for the edgeGroup property.
Remarks
Returns
- ↪IRenderTreeGroup
- a new group that has been added to the contentGroup
Factory method for the edgeLabelGroup property.
Remarks
Returns
- ↪IRenderTreeGroup
- a new group that has been added to the contentGroup
createEdgeLabelModelManager
(renderer: IObjectRenderer<ILabel>, callback: function(ILabel):IRenderTreeGroup) : ItemModelManager<ILabel>Factory method for creating the ItemModelManager<T> that handles the visual representation of edge labels.
Parameters
A map of options to pass to the method.
- renderer - IObjectRenderer<ILabel>
- An IObjectRenderer<ILabel> for edge labels.
- callback - function(ILabel):IRenderTreeGroup
- A callback to get the IRenderTreeGroup containing the render tree element of a given edge label.
Signature Details
function(arg: ILabel) : IRenderTreeGroup
Encapsulates a method that has one parameters and returns a value of the type specified by theTResult
parameter.Parameters
- arg - ILabel
- The parameter of the method that this delegate encapsulates.
Returns
- IRenderTreeGroup
- The return value of the method that this delegate encapsulates.
Returns
- ↪ItemModelManager<ILabel>
- a new instance of ItemModelManager<T> for edge labels
createEdgeModelManager
(renderer: IObjectRenderer<IEdge>, callback: function(IEdge):IRenderTreeGroup) : ItemModelManager<IEdge>Factory method for creating the ItemModelManager<T> that handles the visual representation of edges.
Parameters
A map of options to pass to the method.
- renderer - IObjectRenderer<IEdge>
- An IObjectRenderer<IEdge> for IEdges.
- callback - function(IEdge):IRenderTreeGroup
- A callback to get the IRenderTreeGroup containing the render tree element of a given edge.
Signature Details
function(arg: IEdge) : IRenderTreeGroup
Encapsulates a method that has one parameters and returns a value of the type specified by theTResult
parameter.Parameters
- arg - IEdge
- The parameter of the method that this delegate encapsulates.
Returns
- IRenderTreeGroup
- The return value of the method that this delegate encapsulates.
Returns
- ↪ItemModelManager<IEdge>
- a new instance of ItemModelManager<T> for edges
Factory method for the groupNodeGroup property.
Remarks
Returns
- ↪IRenderTreeGroup
- a new group that has been added to the contentGroup
Factory method for the nodeGroup property.
Remarks
Returns
- ↪IRenderTreeGroup
- a new group that has been added to the contentGroup
Factory method for the nodeLabelGroup property.
Remarks
Returns
- ↪IRenderTreeGroup
- a new group that has been added to the contentGroup
createNodeLabelModelManager
(renderer: IObjectRenderer<ILabel>, callback: function(ILabel):IRenderTreeGroup) : ItemModelManager<ILabel>Factory method for creating the ItemModelManager<T> that handles the visual representation of node labels.
Parameters
A map of options to pass to the method.
- renderer - IObjectRenderer<ILabel>
- An IObjectRenderer<ILabel> for node labels.
- callback - function(ILabel):IRenderTreeGroup
- A callback to get the IRenderTreeGroup containing the render tree element of a given node label.
Signature Details
function(arg: ILabel) : IRenderTreeGroup
Encapsulates a method that has one parameters and returns a value of the type specified by theTResult
parameter.Parameters
- arg - ILabel
- The parameter of the method that this delegate encapsulates.
Returns
- IRenderTreeGroup
- The return value of the method that this delegate encapsulates.
Returns
- ↪ItemModelManager<ILabel>
- a new instance of ItemModelManager<T> for node labels
createNodeModelManager
(renderer: IObjectRenderer<INode>, callback: function(INode):IRenderTreeGroup) : ItemModelManager<INode>Factory method for creating the ItemModelManager<T> that handles the visual representation of nodes.
Parameters
A map of options to pass to the method.
- renderer - IObjectRenderer<INode>
- An IObjectRenderer<INode> for INodes.
- callback - function(INode):IRenderTreeGroup
- A callback to get the IRenderTreeGroup containing the render tree element of a given node.
Signature Details
function(arg: INode) : IRenderTreeGroup
Encapsulates a method that has one parameters and returns a value of the type specified by theTResult
parameter.Parameters
- arg - INode
- The parameter of the method that this delegate encapsulates.
Returns
- IRenderTreeGroup
- The return value of the method that this delegate encapsulates.
Returns
- ↪ItemModelManager<INode>
- a new instance of ItemModelManager<T> for nodes
Factory method for the portGroup property.
Remarks
Returns
- ↪IRenderTreeGroup
- a new group that has been added to the contentGroup
Factory method for the portLabelGroup property.
Remarks
Returns
- ↪IRenderTreeGroup
- a new group that has been added to the contentGroup
createPortLabelModelManager
(renderer: IObjectRenderer<ILabel>, callback: function(ILabel):IRenderTreeGroup) : ItemModelManager<ILabel>Factory method for creating the ItemModelManager<T> that handles the visual representation of port labels.
Parameters
A map of options to pass to the method.
- renderer - IObjectRenderer<ILabel>
- An IObjectRenderer<ILabel> for port labels.
- callback - function(ILabel):IRenderTreeGroup
- A callback to get the IRenderTreeGroup containing the render tree element of a given port label.
Signature Details
function(arg: ILabel) : IRenderTreeGroup
Encapsulates a method that has one parameters and returns a value of the type specified by theTResult
parameter.Parameters
- arg - ILabel
- The parameter of the method that this delegate encapsulates.
Returns
- IRenderTreeGroup
- The return value of the method that this delegate encapsulates.
Returns
- ↪ItemModelManager<ILabel>
- a new instance of ItemModelManager<T> for port labels
createPortModelManager
(renderer: IObjectRenderer<IPort>, callback: function(IPort):IRenderTreeGroup) : ItemModelManager<IPort>Factory method for creating the ItemModelManager<T> that handles the visual representation of ports.
Parameters
A map of options to pass to the method.
- renderer - IObjectRenderer<IPort>
- An IObjectRenderer<IPort> for IPorts.
- callback - function(IPort):IRenderTreeGroup
- A callback to get the IRenderTreeGroup containing the render tree element of a given port.
Signature Details
function(arg: IPort) : IRenderTreeGroup
Encapsulates a method that has one parameters and returns a value of the type specified by theTResult
parameter.Parameters
- arg - IPort
- The parameter of the method that this delegate encapsulates.
Returns
- IRenderTreeGroup
- The return value of the method that this delegate encapsulates.
Returns
- ↪ItemModelManager<IPort>
- a new instance of ItemModelManager<T> for ports
Retrieves the IRenderTreeGroup containing the render tree element of a given edge.
Remarks
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge that will be installed in the canvas.
Returns
- ↪IRenderTreeGroup
- The group to use.
Retrieves the IRenderTreeGroup containing the render tree element of a given label.
Remarks
Parameters
A map of options to pass to the method.
- label - ILabel
- The label that will be installed in the canvas.
Returns
- ↪IRenderTreeGroup
- The group to use.
Retrieves the IRenderTreeElement for a given model item that can be used for z-order or visibility operations.
Remarks
The z-order can be changed on the returned IRenderTreeElement via raise, lower, toFront, toBack, above or below.
The visibility can be changed via the visible property.
Note that these z-order or visibility changes will also affect model items whose z-order directly depends on item
like labels if AT_OWNER is chosen.
Parameters
A map of options to pass to the method.
- item - IModelItem
- the item
Returns
- ↪IRenderTreeElement?
- The main render tree element for the given item or
null
See Also
Retrieves the corresponding IModelItem for the given render tree element.
Parameters
A map of options to pass to the method.
- renderTreeElement - IRenderTreeElement
- The instance to use for the query
Returns
- ↪IModelItem?
- The item that is associated with the render tree element or
null
.
Retrieves the IRenderTreeGroup containing the render tree element of a given node.
Remarks
Parameters
A map of options to pass to the method.
- node - INode
- The node that will be installed in the canvas.
Returns
- ↪IRenderTreeGroup
- The group to use.
Retrieves the IRenderTreeGroup containing the render tree element of a given port.
Remarks
Parameters
A map of options to pass to the method.
- port - IPort
- The port that will be installed in the canvas.
Returns
- ↪IRenderTreeGroup
- The group to use.
Retrieves the IRenderTreeElement visualizing a given model item managed by this instance.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- the item
Returns
- ↪IRenderTreeElement?
- the render tree element for the given item or
null
See Also
hitElementsAt
(location: Point, context?: IInputModeContext, root?: IRenderTreeGroup, typeFilter?: GraphItemTypes) : IEnumerable<IModelItem>Enumerates hits in the render tree of the canvas at a given world coordinate position for a given context and IRenderTreeGroup.
Remarks
The instance returned will enumerate hits in the order so that the topmost visual element will be reported first. The enumeration is performed lazily.
Note that if you do not specify the root
parameter, only the members of the contentGroup will be hit tested.
Parameters
A map of options to pass to the method.
- location - Point
- the world coordinates to perform the hit test at
- context - IInputModeContext
- The context to provide to isHit
- root - IRenderTreeGroup
- The group to search the subtree of. contentGroup if not specified.
- typeFilter - GraphItemTypes
- An optional filter that preselects a subset of types that will be tested and reported. This can result in improved performance when testing does not need to be performed.
Returns
- ↪IEnumerable<IModelItem>
- a live enumerable that will enumerate the hits at the given coordinates
Installs this instance for the specified CanvasComponent.
Remarks
Parameters
A map of options to pass to the method.
- canvasComponent - CanvasComponent
- The CanvasComponent.
- graph - IGraph
- The graph.
- contentGroup - IRenderTreeGroup
- The group to add the graph's visual content to. If omitted, the contentGroup of the renderTree of the
canvasComponent
is used.
Lowers the visual representation of the item
below its current predecessor.
Remarks
item
below its current predecessor in its containing parent.Parameters
A map of options to pass to the method.
- item - IModelItem
- The model item to lower.
Lowers the visual representations of all IModelItems in items
below their current predecessors.
Remarks
items
below their current predecessors in their containing parent.Parameters
A map of options to pass to the method.
- items - IEnumerable<IModelItem>
- The IModelItems to lower.
Called when the graph property changes.
Remarks
Parameters
A map of options to pass to the method.
Raises the visual representation of the item
above its current successor.
Remarks
item
above its current successor in the containing parent.Parameters
A map of options to pass to the method.
- item - IModelItem
- The model item to raise.
Raises the visual representations of all IModelItems in items
above their current successors.
Remarks
items
above their current successors in their containing parent.Parameters
A map of options to pass to the method.
- items - IEnumerable<IModelItem>
- The IModelItems to raise.
Lowers the visual representation of the item
to the back.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The model item to lower to the back.
Lowers the visual representation of all IModelItems in items
to the back.
Remarks
items
to the back in their containing parent.Parameters
A map of options to pass to the method.
- items - IEnumerable<IModelItem>
- The IModelItems to move to the back.
Raises the visual representation of the item
to the front.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The model item to raise to the front.
Raises the visual representations of all IModelItems in items
to the front.
Remarks
items
to the front in their containing parent.Parameters
A map of options to pass to the method.
- items - IEnumerable<IModelItem>
- The IModelItems to move to the front.
Reverts the install method.
Remarks
Parameters
A map of options to pass to the method.
- canvasComponent - CanvasComponent
- The CanvasComponent.
Updates the visual representation of the given item.
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item to update the visual representation of
See Also
Constants
The immutable instance of the default IObjectRenderer<IEdge> for IEdges which simply defers to the edge's IEdgeStyle.
The immutable instance of the default IObjectRenderer<ILabel> for ILabels which simply defers to the label's ILabelStyle.
The immutable instance of the default IObjectRenderer<INode> for INodes which simply defers to the node's INodeStyle.
The immutable instance of the default IObjectRenderer<IPort> for IPorts which simply defers to the port's IPortStyle.