C

GraphModelManager

Manages the visual appearance of an IGraph instance in a CanvasComponent.
Inheritance Hierarchy

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.

See Also

Developer's Guide

API

nodeGroup, hierarchicalNestingPolicy, LabelLayerPolicy, PortLayerPolicy

Members

Show:

Constructors

Creates a new manager instance.

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.
null when not currently installed.
protectedreadonlyfinal

See Also

API
install
Gets the content group this manager instance uses to add visual representation of the graph to.
This property is set by install and cleared by uninstall and therefore not null during the install life-cycle.
readonlyfinal
Gets the IRenderTreeGroup instance that will be used for installing edge styles.

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.

readonlyfinal

See Also

Developer's Guide
API
getEdgeRenderTreeGroup, edgeRenderer
Gets the IRenderTreeGroup instance that will be used for installing edge label styles.
If the field has not yet been initialized upon first access, the factory method createEdgeLabelGroup will be called.
readonlyfinal

See Also

Developer's Guide
API
getLabelRenderTreeGroup, edgeLabelRenderer
Gets or sets the policy to determine at which visual layer edge labels shall be inserted.
The default value is SEPARATE_LAYER.
conversionfinal
Provides access to the ItemModelManager<T> which handles the ILabels at edges.
The manager is created by createEdgeLabelModelManager upon first access.
readonlyfinal
Gets or sets the IObjectRenderer<ILabel> instance used for installing an ILabel of an IEdge into the canvas.
final
Provides access to the ItemModelManager<T> which handles the IEdges.
The manager is created by createEdgeModelManager upon first access.
readonlyfinal
Gets or sets the IObjectRenderer<IEdge> instance used for installing an IEdge into the canvas.
final
Gets or sets the graph this manager manages.
final

See Also

API
onGraphChanged
Gets the IRenderTreeGroup instance that will be used for installing node styles of group nodes.
If the field has not yet been initialized upon first access, the factory method createGroupNodeGroup will be called. Note that this group is only used when hierarchicalNestingPolicy is GROUP_NODES.
readonlyfinal

See Also

Developer's Guide
API
getNodeRenderTreeGroup, nodeRenderer, hierarchicalNestingPolicy
Gets or sets the policy whether and how this instance should nest the nodes and edges if the graph is grouped.
Gets a IHitTester that can be used to enumerate hits on the canvas at a given world coordinate position.
This enumerator will enumerate hits in the order so that the visually topmost element will be reported first.
readonlyfinal
Gets the IRenderTreeGroup instance that will be used for installing node styles.

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:

readonlyfinal

See Also

Developer's Guide
API
getNodeRenderTreeGroup, getMainRenderTreeElement, nodeRenderer
Gets the IRenderTreeGroup instance that will be used for installing node label styles.
If the field has not yet been initialized upon first access, the factory method createNodeLabelGroup will be called.
readonlyfinal

See Also

Developer's Guide
API
getLabelRenderTreeGroup, nodeLabelRenderer
Gets or sets the policy to determine at which visual layer node labels shall be inserted.
The default value is SEPARATE_LAYER.
conversionfinal
Provides access to the ItemModelManager<T> which handles the ILabels at nodes.
The manager is created by createNodeLabelModelManager upon first access.
readonlyfinal
Gets or sets the IObjectRenderer<ILabel> instance used for installing an ILabel of an INode into the canvas.
final
Provides access to the ItemModelManager<T> which handles the INodes.
The manager is created by createNodeModelManager upon first access.
readonlyfinal
Gets or sets the IObjectRenderer<INode> instance used for installing an INode into the canvas.
final
Gets the IRenderTreeGroup instance that will be used for installing port styles.
If the field has not yet been initialized upon first access, the factory method createPortGroup will be called.
readonlyfinal

See Also

Developer's Guide
API
getPortRenderTreeGroup, portRenderer
Gets the IRenderTreeGroup instance that will be used for installing port label styles.
If the field has not yet been initialized upon first access, the factory method createPortLabelGroup will be called.
readonlyfinal

See Also

Developer's Guide
API
getLabelRenderTreeGroup, portLabelRenderer
Gets or sets the policy to determine at which visual layer port labels shall be inserted.
The default value is SEPARATE_LAYER.
conversionfinal
Provides access to the ItemModelManager<T> which handles the ILabels at ports.
The manager is created by createPortLabelModelManager upon first access.
readonlyfinal
Gets or sets the IObjectRenderer<ILabel> instance used for installing an ILabel of an IPort into the canvas.
final
Gets or sets the policy to determine at which visual layer node and edge ports shall be inserted.
The default value is SEPARATE_LAYER.
conversionfinal
Provides access to the ItemModelManager<T> which handles the IPorts.
The manager is created by createPortModelManager upon first access.
readonlyfinal
Gets or sets the IObjectRenderer<IPort> instance used for installing an IPort into the canvas.
final
Gets an comparison instance that can be used to compare two model items with respect to their visual display order.
An item is considered to be greater than another item if it is rendered on top of it.
readonlyfinal

Methods

Compares two items with respect to their rendering order.

Parameters

item1: IModelItem
the first item to compare
item2: IModelItem
the second item to compare

Return Value

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

API
renderOrderComparator, renderOrderComparator
Factory method for the edgeGroup property.
This method will be called upon first access to the property.
protected

Return Value

IRenderTreeGroup
a new group that has been added to the contentGroup
Factory method for the edgeLabelGroup property.
This method will be called upon first access to the property.
protected

Return Value

IRenderTreeGroup
a new group that has been added to the contentGroup
Factory method for creating the ItemModelManager<T> that handles the visual representation of edge labels.
protected

Parameters

renderer: IObjectRenderer<ILabel>
callback: function(ILabel): IRenderTreeGroup
A callback to get the IRenderTreeGroup containing the render tree element of a given edge label.

Return Value

ItemModelManager<ILabel>
a new instance of ItemModelManager<T> for edge labels
Factory method for creating the ItemModelManager<T> that handles the visual representation of edges.
protected

Parameters

renderer: IObjectRenderer<IEdge>
callback: function(IEdge): IRenderTreeGroup
A callback to get the IRenderTreeGroup containing the render tree element of a given edge.

Return Value

ItemModelManager<IEdge>
a new instance of ItemModelManager<T> for edges
Factory method for the groupNodeGroup property.
This method will be called upon first access to the property.
protected

Return Value

IRenderTreeGroup
a new group that has been added to the contentGroup
Factory method for the nodeGroup property.
This method will be called upon first access to the property.
protected

Return Value

IRenderTreeGroup
a new group that has been added to the contentGroup
Factory method for the nodeLabelGroup property.
This method will be called upon first access to the property.
protected

Return Value

IRenderTreeGroup
a new group that has been added to the contentGroup
Factory method for creating the ItemModelManager<T> that handles the visual representation of node labels.
protected

Parameters

renderer: IObjectRenderer<ILabel>
callback: function(ILabel): IRenderTreeGroup
A callback to get the IRenderTreeGroup containing the render tree element of a given node label.

Return Value

ItemModelManager<ILabel>
a new instance of ItemModelManager<T> for node labels
Factory method for creating the ItemModelManager<T> that handles the visual representation of nodes.
protected

Parameters

renderer: IObjectRenderer<INode>
callback: function(INode): IRenderTreeGroup
A callback to get the IRenderTreeGroup containing the render tree element of a given node.

Return Value

ItemModelManager<INode>
a new instance of ItemModelManager<T> for nodes
Factory method for the portGroup property.
This method will be called upon first access to the property.
protected

Return Value

IRenderTreeGroup
a new group that has been added to the contentGroup
Factory method for the portLabelGroup property.
This method will be called upon first access to the property.
protected

Return Value

IRenderTreeGroup
a new group that has been added to the contentGroup
Factory method for creating the ItemModelManager<T> that handles the visual representation of port labels.
protected

Parameters

renderer: IObjectRenderer<ILabel>
callback: function(ILabel): IRenderTreeGroup
A callback to get the IRenderTreeGroup containing the render tree element of a given port label.

Return Value

ItemModelManager<ILabel>
a new instance of ItemModelManager<T> for port labels
Factory method for creating the ItemModelManager<T> that handles the visual representation of ports.
protected

Parameters

renderer: IObjectRenderer<IPort>
callback: function(IPort): IRenderTreeGroup
A callback to get the IRenderTreeGroup containing the render tree element of a given port.

Return Value

ItemModelManager<IPort>
a new instance of ItemModelManager<T> for ports
Retrieves the IRenderTreeGroup containing the render tree element of a given edge.
This implementation is called by the default edgeRenderer instance.
protected

Parameters

edge: IEdge
The edge that will be installed in the canvas.

Return Value

IRenderTreeGroup
The group to use.
Retrieves the IRenderTreeGroup containing the render tree element of a given label.
This implementation is called by the default nodeLabelRenderer, edgeLabelRenderer, and portLabelRenderer instances.
protected

Parameters

label: ILabel
The label that will be installed in the canvas.

Return Value

IRenderTreeGroup
The group to use.
Retrieves the IRenderTreeElement for a given model item that can be used for z-order or visibility operations.

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

item: IModelItem
the item

Return Value

IRenderTreeElement
The main render tree element for the given item or null

See Also

Developer's Guide
API
getRenderTreeElement
Retrieves the corresponding IModelItem for the given render tree element.

Parameters

renderTreeElement: IRenderTreeElement
The instance to use for the query

Return Value

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.
This implementation is called by the default nodeRenderer instance.
protected

Parameters

node: INode
The node that will be installed in the canvas.

Return Value

IRenderTreeGroup
The group to use.

See Also

Developer's Guide
Retrieves the IRenderTreeGroup containing the render tree element of a given port.
This implementation is called by the default portRenderer instance.
protected

Parameters

port: IPort
The port that will be installed in the canvas.

Return Value

IRenderTreeGroup
The group to use.
Retrieves the IRenderTreeElement visualizing a given model item managed by this instance.
Note that for changing the z-order via raise, lower, toFront, toBack, above or below or for switching the visibility the main render tree element should be used instead.

Parameters

item: IModelItem
the item

Return Value

IRenderTreeElement
the render tree element for the given item or null

See Also

API
getRenderTreeElement
Enumerates hits in the render tree of the canvas at a given world coordinate position for a given context and IRenderTreeGroup.

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

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.

Return Value

IEnumerable<IModelItem>
a live enumerable that will enumerate the hits at the given coordinates
Installs this instance for the specified CanvasComponent.
To use an instance of this class as the main GraphModelManager of a GraphComponent, set it to the graphModelManager property. This will then call this method.

Parameters

canvasComponent: 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.
Lowers the main render tree element of the item below its current predecessor in its containing parent.

Parameters

item: IModelItem
The model item to lower.

See Also

Developer's Guide
Lowers the visual representations of all IModelItems in items below their current predecessors.
Lowers the main render tree elements of all IModelItems in items below their current predecessors in their containing parent.

Parameters

items: IEnumerable<IModelItem>
The IModelItems to lower.

See Also

Developer's Guide
Called when the graph property changes.
This method registers the collections of the graph instance with the mechanism that manages the mapping between the elements and the IRenderTreeElements. Subclasses should call the base method if they want to use the default mechanisms.
protected

Parameters

oldGraph: IGraph
The old graph instance.
newGraph: IGraph
The new graph instance.
Raises the visual representation of the item above its current successor.
Raises the main render tree element of the item above its current successor in the containing parent.

Parameters

item: IModelItem
The model item to raise.

See Also

Developer's Guide
Raises the visual representations of all IModelItems in items above their current successors.
Raises the main render tree elements of all IModelItems in items above their current successors in their containing parent.

Parameters

items: IEnumerable<IModelItem>
The IModelItems to raise.

See Also

Developer's Guide
Lowers the visual representation of the item to the back.
Lowers the main render tree element of the item to the back in its containing parent.

Parameters

item: IModelItem
The model item to lower to the back.

See Also

Developer's Guide
Lowers the visual representation of all IModelItems in items to the back.
Lowers the main render tree elements of all IModelItems in items to the back in their containing parent.

Parameters

items: IEnumerable<IModelItem>
The IModelItems to move to the back.

See Also

Developer's Guide
Raises the visual representation of the item to the front.
Raises the main render tree element of the item to the front in its containing parent.

Parameters

item: IModelItem
The model item to raise to the front.

See Also

Developer's Guide
Raises the visual representations of all IModelItems in items to the front.
Raises the main render tree elements of all IModelItems in items to the front in their containing parent.

Parameters

items: IEnumerable<IModelItem>
The IModelItems to move to the front.

See Also

Developer's Guide
Reverts the install method.
If another GraphModelManager is set to the GraphComponent's graphModelManager property, this method will be called automatically for the old instance.

Parameters

canvasComponent: CanvasComponent
Updates the visual representation of the given item.

Parameters

item: IModelItem
The item to update the visual representation of

See Also

API
update

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.