Packagecom.yworks.graph.model
Classpublic class GroupedGraphUtil
InheritanceGroupedGraphUtil Inheritance Object

This class provides IGroupedGraph-related utility methods.



Public Methods
 MethodDefined By
  
adjustGroupNodeBounds(groupedGraph:IGroupedGraph, groupNode:INode):void
[static] Method to adjust the size of a group node.
GroupedGraphUtil
  
[static] Calculates the minimum area to enclose by the given group node with respect to its IGroupBoundsCalculator.
GroupedGraphUtil
  
[static] Enlarges all group nodes so that the minimum enclosed area is respected.
GroupedGraphUtil
  
[static] Enlarges all group nodes in an interactive scenario, so that the minimum enclosed area is respected.
GroupedGraphUtil
  
enlargeGroupNode(groupedGraph:IGroupedGraph, groupNode:INode, ancestors:Boolean):void
[static] Enlarges the given group node to ensure that the minimum enclosed area is inside of its bounds.
GroupedGraphUtil
  
enlargeGroupNodeInteractively(context:IInputModeContext, groupedGraph:IGroupedGraph, groupNode:INode, ancestors:Boolean):void
[static] Enlarges the group nodes in an interactive scenario, using IReshapeHandler implementations of the group nodes to perform the actual resizing.
GroupedGraphUtil
  
[static] Tries to retrieve an IGroupedGraph instance from the passed context.
GroupedGraphUtil
  
groupNodes(groupedGraph:IGroupedGraph, children:Iterable, parent:INode = null):INode
[static] Groups the nodes in children into a group node.
GroupedGraphUtil
Method Detail
adjustGroupNodeBounds()method
public static function adjustGroupNodeBounds(groupedGraph:IGroupedGraph, groupNode:INode):void

Method to adjust the size of a group node.

This will resize to group node bounds such that the node requires the least amount of space. If the node does not have any children, it's bounds will be left unchanged. This will also respect any ISizeConstraintProviders for INodes, that are available in the lookup of the groupNode.

Parameters

groupedGraph:IGroupedGraph — The graph to operate on.
 
groupNode:INode — The group node to adjust the size of.

See also

calculateMinimumEnclosedArea()method 
public static function calculateMinimumEnclosedArea(nodeHierarchy:INodeHierarchy, groupNode:INode):IRectangle

Calculates the minimum area to enclose by the given group node with respect to its IGroupBoundsCalculator.

Parameters

nodeHierarchy:INodeHierarchy — The node hierarchy to operate on.
 
groupNode:INode — The group node to calculate the minimum enclosed area of.

Returns
IRectangle — The area to enclose for the given group node. This is an empty rectangle if the node is not a group node, or if it hasn't any children.

See also

IGroupBoundsCalculator
enlargeAllGroupNodes()method 
public static function enlargeAllGroupNodes(groupedGraph:IGroupedGraph):void

Enlarges all group nodes so that the minimum enclosed area is respected.

Parameters

groupedGraph:IGroupedGraph — The graph to operate on.

See also

enlargeAllGroupNodesInteractively()method 
public static function enlargeAllGroupNodesInteractively(context:IInputModeContext, groupedGraph:IGroupedGraph):void

Enlarges all group nodes in an interactive scenario, so that the minimum enclosed area is respected. This method should be used in an interactive editing scenario. It records an ICompoundEdit to support undoability and uses the IReshapeHandler for the resizing of the nodes. That way, e.g. orthogonally edited edges will be properly reshaped.

Parameters

context:IInputModeContext — The context to use for the IReshapeHandlers.
 
groupedGraph:IGroupedGraph — The graph to operate on.

See also

enlargeGroupNode()method 
public static function enlargeGroupNode(groupedGraph:IGroupedGraph, groupNode:INode, ancestors:Boolean):void

Enlarges the given group node to ensure that the minimum enclosed area is inside of its bounds. This method can be used to resize a group node and all of its parent group nodes to fully contain its children, e.g. after a child node has changed its bounds. Note that this method will only enlarge the bounds of the group nodes, it will never reduce the size of a group node.

Parameters

groupedGraph:IGroupedGraph — The graph to operate on.
 
groupNode:INode — The group node to resize.
 
ancestors:Boolean — If set to true all ancestor group nodes will be resized, too, if necessary.

See also

enlargeGroupNodeInteractively()method 
public static function enlargeGroupNodeInteractively(context:IInputModeContext, groupedGraph:IGroupedGraph, groupNode:INode, ancestors:Boolean):void

Enlarges the group nodes in an interactive scenario, using IReshapeHandler implementations of the group nodes to perform the actual resizing. This method should be used in an interactive editing scenario. It records an ICompoundEdit to support undoability and uses the IReshapeHandler for the resizing of the nodes. That way, e.g. orthogonally edited edges will be properly reshaped.

Parameters

context:IInputModeContext — The context to use for the IReshapeHandlers.
 
groupedGraph:IGroupedGraph — The graph to operate on.
 
groupNode:INode — The group node to resize.
 
ancestors:Boolean — If set to true all ancestor group nodes will be resized, too, if necessary.

See also

IReshapeHandler
ICompoundEdit
getGroupedGraph()method 
public static function getGroupedGraph(context:IInputModeContext):IGroupedGraph

Tries to retrieve an IGroupedGraph instance from the passed context.

This will use the ILookup of the context or if nothing is found the lookup of the IGraph in the context.

Parameters

context:IInputModeContext — The context to retrieve the implementation from.

Returns
IGroupedGraph — The instance or null.

See also

groupNodes()method 
public static function groupNodes(groupedGraph:IGroupedGraph, children:Iterable, parent:INode = null):INode

Groups the nodes in children into a group node.

If no parent is provided, the parent group node will be created at the common ancestor level of all nodes in children.

The parent needs to be a group node at the time of the invocation. This operation is basically the same as calling setParent for each node in the children iterable whose parent is not part of the set.

Parameters

groupedGraph:IGroupedGraph — The graph to operate on.
 
children:Iterable — The children to group into the group node.
 
parent:INode (default = null) — The node to use as the parent in the grouping hierarchy.

Returns
INode — The newly created group node if no parent was provided, or parent.

See also