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 ICanvasObject instance in the canvas for each item in the graph. Note that GraphComponent has an instance of this type built-in already and usually it is not necessary to create an own one.
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-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.view.GraphModelManager
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 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 graph property is set to an instance after construction. Also, make sure to either provide the canvas
parameter or call the install life-cycle methods.
Parameters
A map of options to pass to the method.
- canvas - CanvasComponent
- the canvas to manage the visual appearance of a graph for. Optional parameter that does not need to be provided when this instance will be installed, later.
- contentGroup - ICanvasObjectGroup
- the group to add the graph's visual content to. If omitted contentGroup should be set afterwards or createContentGroup will automatically create a group lazily.
Properties
Gets the currently installed in CanvasComponent.
Gets an IComparer<T> instance that can be used to compare two model items with respect to their visual display order.
Remarks
Gets or sets the content group this manager instance uses to add visual representation of the graph to.
Gets or sets the ICanvasObjectDescriptor instance used for installing an IEdge into the canvas.
Gets the ICanvasObjectGroup 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 canvas objects of edges will only be put directly in this ICanvasObjectGroup, 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 or sets the ICanvasObjectDescriptor instance used for installing an ILabel of an IEdge into the canvas.
Gets the ICanvasObjectGroup instance that will be used for installing edge label styles.
Remarks
See Also
Gets or sets the policy to determines at which visual layer edge labels shall be inserted.
Remarks
Provides access to the ItemModelManager<T> which handles the ILabels at edges.
Remarks
Provides access to the ItemModelManager<T> which handles the IEdges.
Remarks
Gets or sets the graph this manager manages.
See Also
Gets the ICanvasObjectGroup 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.
Gets a IHitTester<T> that can be used to enumerate hits on the canvas at a given world coordinate position.
Remarks
Gets or sets the policy to determines at which visual layer node, edge and port labels shall be inserted.
Remarks
The default value is SEPARATE_LAYER.
Setting this property overrides the more specific nodeLabelLayerPolicy, edgeLabelLayerPolicy and portLabelLayerPolicy properties which supersede this property.
Deprecation warning
Use the more specific properties NodeLabelLayerPolicy, EdgeLabelLayerPolicy, and PortLabelLayerPolicy.Gets or sets the ICanvasObjectDescriptor instance used for installing an INode into the canvas.
Gets the ICanvasObjectGroup 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 hierarchicNestingPolicy:
- NONE – Contains the main canvas objects of all nodes top-level.
- NODES – Contains the main canvas objects of all nodes in a more complicated nesting of dynamically created ICanvasObjectGroups.
- NODES_AND_EDGES – Contains the main canvas objects of all nodes and edges in a more complicated nesting of dynamically created ICanvasObjectGroups.
- GROUP_NODES – Contains the main canvas objects of all leaf nodes. Group nodes having the same hierarchical depth are in one child ICanvasObjectGroup of the groupNodeGroup instead.
See Also
Gets or sets the ICanvasObjectDescriptor instance used for installing an ILabel of an INode into the canvas.
Gets the ICanvasObjectGroup instance that will be used for installing node label styles.
Remarks
See Also
Gets or sets the policy to determines at which visual layer node labels shall be inserted.
Remarks
Provides access to the ItemModelManager<T> which handles the ILabels at nodes.
Remarks
Provides access to the ItemModelManager<T> which handles the INodes.
Remarks
Gets or sets the ICanvasObjectDescriptor instance used for installing an IPort into the canvas.
Gets the ICanvasObjectGroup instance that will be used for installing port styles.
Remarks
See Also
Gets or sets the ICanvasObjectDescriptor instance used for installing an ILabel of an IPort into the canvas.
Gets the ICanvasObjectGroup instance that will be used for installing port label styles.
Remarks
See Also
Gets or sets the policy to determines 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 policy to determines 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 if the userObject should be provided by its main canvas object.
Remarks
The userObject is already provided by the canvas object visualizing the model item. As this canvas object may differ from the main canvas object, this property determines only if the userObject is provided by its main canvas object if it differs from getCanvasObject.
The default value is false
.
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 that creates the contentGroup
Remarks
Returns
- ↪ICanvasObjectGroup
- The group to use for adding the content.
Factory method for the edgeGroup property.
Remarks
Returns
- ↪ICanvasObjectGroup
- a new group that has been added to the contentGroup
Factory method for the edgeLabelGroup property.
Remarks
Returns
- ↪ICanvasObjectGroup
- a new group that has been added to the contentGroup
createEdgeLabelModelManager
(descriptor: ICanvasObjectDescriptor, callback: function(ILabel):ICanvasObjectGroup) : 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.
- descriptor - ICanvasObjectDescriptor
- An ICanvasObjectDescriptor for edge labels.
- callback - function(ILabel):ICanvasObjectGroup
- A callback to get the ICanvasObjectGroup containing the canvas object of a given edge label.
Signature Details
function(arg: ILabel) : ICanvasObjectGroup
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
- ICanvasObjectGroup
- The return value of the method that this delegate encapsulates.
Returns
- ↪ItemModelManager<ILabel>
- a new instance of ItemModelManager<T> for edge labels
createEdgeModelManager
(descriptor: ICanvasObjectDescriptor, callback: function(IEdge):ICanvasObjectGroup) : 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.
- descriptor - ICanvasObjectDescriptor
- An ICanvasObjectDescriptor for IEdges.
- callback - function(IEdge):ICanvasObjectGroup
- A callback to get the ICanvasObjectGroup containing the canvas object of a given edge.
Signature Details
function(arg: IEdge) : ICanvasObjectGroup
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
- ICanvasObjectGroup
- 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
- ↪ICanvasObjectGroup
- a new group that has been added to the contentGroup
Gets a IHitTester<T> that can be used to enumerate hits on the canvas at a given world coordinate position.
Remarks
Type Parameters
- T: IModelItem
Factory method for the nodeGroup property.
Remarks
Returns
- ↪ICanvasObjectGroup
- a new group that has been added to the contentGroup
Factory method for the nodeLabelGroup property.
Remarks
Returns
- ↪ICanvasObjectGroup
- a new group that has been added to the contentGroup
createNodeLabelModelManager
(descriptor: ICanvasObjectDescriptor, callback: function(ILabel):ICanvasObjectGroup) : 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.
- descriptor - ICanvasObjectDescriptor
- An ICanvasObjectDescriptor for node labels.
- callback - function(ILabel):ICanvasObjectGroup
- A callback to get the ICanvasObjectGroup containing the canvas object of a given node label.
Signature Details
function(arg: ILabel) : ICanvasObjectGroup
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
- ICanvasObjectGroup
- The return value of the method that this delegate encapsulates.
Returns
- ↪ItemModelManager<ILabel>
- a new instance of ItemModelManager<T> for node labels
createNodeModelManager
(descriptor: ICanvasObjectDescriptor, callback: function(INode):ICanvasObjectGroup) : 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.
- descriptor - ICanvasObjectDescriptor
- An ICanvasObjectDescriptor for INodes.
- callback - function(INode):ICanvasObjectGroup
- A callback to get the ICanvasObjectGroup containing the canvas object of a given node.
Signature Details
function(arg: INode) : ICanvasObjectGroup
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
- ICanvasObjectGroup
- 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
- ↪ICanvasObjectGroup
- a new group that has been added to the contentGroup
Factory method for the portLabelGroup property.
Remarks
Returns
- ↪ICanvasObjectGroup
- a new group that has been added to the contentGroup
createPortLabelModelManager
(descriptor: ICanvasObjectDescriptor, callback: function(ILabel):ICanvasObjectGroup) : 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.
- descriptor - ICanvasObjectDescriptor
- An ICanvasObjectDescriptor for port labels.
- callback - function(ILabel):ICanvasObjectGroup
- A callback to get the ICanvasObjectGroup containing the canvas object of a given port label.
Signature Details
function(arg: ILabel) : ICanvasObjectGroup
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
- ICanvasObjectGroup
- The return value of the method that this delegate encapsulates.
Returns
- ↪ItemModelManager<ILabel>
- a new instance of ItemModelManager<T> for port labels
createPortModelManager
(descriptor: ICanvasObjectDescriptor, callback: function(IPort):ICanvasObjectGroup) : 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.
- descriptor - ICanvasObjectDescriptor
- An ICanvasObjectDescriptor for IPorts.
- callback - function(IPort):ICanvasObjectGroup
- A callback to get the ICanvasObjectGroup containing the canvas object of a given port.
Signature Details
function(arg: IPort) : ICanvasObjectGroup
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
- ICanvasObjectGroup
- The return value of the method that this delegate encapsulates.
Returns
- ↪ItemModelManager<IPort>
- a new instance of ItemModelManager<T> for ports
Retrieves the ICanvasObject 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
- ↪ICanvasObject
- the canvas object for the given item or
null
See Also
Retrieves the ICanvasObjectGroup containing the canvas object 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
- ↪ICanvasObjectGroup
- The group to use.
Retrieves the ICanvasObjectGroup containing the canvas object 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
- ↪ICanvasObjectGroup
- The group to use.
Retrieves the ICanvasObject 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 ICanvasObject 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
- ↪ICanvasObject
- The main canvas object for the given item or
null
See Also
Retrieves the corresponding IModelItem for the given canvas object.
Parameters
A map of options to pass to the method.
- canvasObject - ICanvasObject
- the instance to use for the query
Returns
- ↪IModelItem
- The item that is associated with the object or
null
.
Retrieves the ICanvasObjectGroup containing the canvas object 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
- ↪ICanvasObjectGroup
- The group to use.
See Also
Retrieves the ICanvasObjectGroup containing the canvas object 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
- ↪ICanvasObjectGroup
- The group to use.
Enumerates hits on the canvas at a given world coordinate position.
Remarks
Parameters
A map of options to pass to the method.
- location - Point
- the world coordinates to perform the hit test
Returns
- ↪IEnumerable<IModelItem>
- an enumerable that will enumerate the hits at the given coordinates
hitElementsAt
(context: IInputModeContext, location: Point, root: ICanvasObjectGroup) : IEnumerable<IModelItem>Enumerates hits on the canvas at a given world coordinate position for a given context.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context to provide to isHit
- location - Point
- the world coordinates to perform the hit test
- root - ICanvasObjectGroup
- The group to search the subtree of.
Returns
- ↪IEnumerable<IModelItem>
- an enumerable that will enumerate the hits at the given coordinates
Installs this manager for the specified CanvasComponent.
Remarks
Parameters
A map of options to pass to the method.
- canvas - CanvasComponent
- The CanvasComponent.
- graph - IGraph
- The graph.
Lowers the visual representation of the item
below its current predecessor.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The model item to lower.
See Also
Lowers the visual representations of all IModelItems in items
below their current predecessors.
Remarks
items
below their current predecessors in their containing group.See Also
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
Parameters
A map of options to pass to the method.
- item - IModelItem
- The model item to raise.
See Also
Raises the visual representations of all IModelItems in items
above their current successors.
Remarks
items
above their current successors in their containing group.See Also
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.
See Also
Lowers the visual representation of all IModelItems in items
to the back.
Remarks
See Also
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.
See Also
Raises the visual representations of all IModelItems in items
to the front.
Remarks
See Also
Enumerates hits on the canvas at a given world coordinate position.
Remarks
Type Parameters
- T: IModelItem
Parameters
A map of options to pass to the method.
Returns
- ↪IEnumerable<T>
- an enumerable that will enumerate the hits at the given coordinates
typedHitElementsAt
<Textends IModelItem>(modelItemType: Class, context: IInputModeContext, location: Point, root: ICanvasObjectGroup) : IEnumerable<T>Enumerates hits on the canvas at a given world coordinate position in a given context.
Remarks
Type Parameters
- T: IModelItem
Parameters
A map of options to pass to the method.
- modelItemType - Class
- context - IInputModeContext
- The context to provide to isHit
- location - Point
- the world coordinates to perform the hit test
- root - ICanvasObjectGroup
- The group to search the subtree of.
Returns
- ↪IEnumerable<T>
- an enumerable that will enumerate the hits at the given coordinates
Reverts the install method.
Remarks
Parameters
A map of options to pass to the method.
- canvas - 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
See Also
Constants
The immutable instance of the default ICanvasObjectDescriptor for IEdges which simply defers to the edge's IEdgeStyle.
The immutable instance of the default ICanvasObjectDescriptor for ILabels which simply defers to the label's ILabelStyle.
The immutable instance of the default ICanvasObjectDescriptor for INodes which simply defers to the node's INodeStyle.
The immutable instance of the default ICanvasObjectDescriptor for IPorts which simply defers to the port's IPortStyle.