Package | com.yworks.graph.model |
Class | public class GroupedGraph |
Inheritance | GroupedGraph flash.events.EventDispatcher |
Implements | IGroupedGraph, INodeBoundsChangedListener |
IGroupedGraph
interface that can be used
to decorate IGraph
instances.
DefaultGraph
uses this class to provide an implementation of the IGroupedGraph
interface in its lookup
method, if its groupingSupported
property is set to true
.
This implementation will decorate the look-ups
of the IGraph
and its nodes to support the following features:
INodeHierarchy
to the lookup of the IGraph
as well as register this instance under IGroupedGraph
and GroupedGraph
with the graph's lookup mechanism.autoAdjustGroupNodeBounds
IUndoUnit
s for hierarchy changes to the IUndoSupport
of
the graph instance if the underlying graph supports it.See also
Property | Defined By | ||
---|---|---|---|
autoAdjustGroupNodeBounds : Boolean
Gets or sets a property that determines whether the bounds of group nodes should automatically
be adjusted whenever the nodes that belong to the group node change their bounds. | GroupedGraph | ||
defaultGroupNodeStyle : INodeStyle
Gets or sets the defaultGroupNodeStyle property. | GroupedGraph | ||
graph : IGraph [read-only]
Yields the graph instance that this instance is working on. | GroupedGraph | ||
hierarchy : INodeHierarchy [read-only]
Yields the hierarchy of the nodes in this grouped graph. | GroupedGraph | ||
shareDefaultGroupNodeStyleInstance : Boolean
Gets or sets a property that determines whether newly
created group nodes should share the currently set dfaultGroupNodeStyle
instance. | GroupedGraph |
Method | Defined By | ||
---|---|---|---|
Creates a new instance using the provided graph and hierarchy instance. | GroupedGraph | ||
adjustGroupNodeBounds(groupNode:INode):void
Method to adjust the size of a group node. | GroupedGraph | ||
Creates a new group node. | GroupedGraph | ||
Creates a new ordinary node as a direct descendant of parent. | GroupedGraph | ||
dispose():void
Disposes of this instance. | GroupedGraph | ||
Convenience method that yields the parent of a node. | GroupedGraph | ||
Groups the nodes in children into a group node. | GroupedGraph | ||
Called when the bounds of a node have changed. | GroupedGraph | ||
Sets the parent node for a given node. | GroupedGraph |
Method | Defined By | ||
---|---|---|---|
Factory method for the defaultGroupNodeStyle property. | GroupedGraph | ||
Factory callback that returns an INodeStyle
for newly created group nodes. | GroupedGraph | ||
Called when the defaultGroupNodeStyle property value changes
and after initialization of the field. | GroupedGraph | ||
Called whenever a new group node has been created in the graph. | GroupedGraph | ||
onNodeChanged(node:INode):void
Callback that will be called once the original IGraph
triggers the nodeChanged event. | GroupedGraph | ||
Called whenever a new node has been created in the graph. | GroupedGraph | ||
onNodeRemoved(node:INode):void
Called whenever a node has been removed in the graph. | GroupedGraph |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when the value of the defaultGroupNodeStyle property changes. | GroupedGraph |
Constant | Defined By | ||
---|---|---|---|
DEFAULT_GROUP_NODE_STYLE_CHANGED : String = defaultGroupNodeStyleChanged [static]
| GroupedGraph |
autoAdjustGroupNodeBounds | property |
autoAdjustGroupNodeBounds:Boolean
Gets or sets a property that determines whether the bounds of group nodes should automatically be adjusted whenever the nodes that belong to the group node change their bounds.
This behavior is turned on by default and should only be turned off temporarily to allow for programmatic batch updates to the bounds of nodes.
public function get autoAdjustGroupNodeBounds():Boolean
public function set autoAdjustGroupNodeBounds(value:Boolean):void
defaultGroupNodeStyle | property |
defaultGroupNodeStyle:INodeStyle
Gets or sets the defaultGroupNodeStyle property.
If the field has not yet been initialized upon first access, the
factory method createDefaultGroupNodeStyle()
will be called.
Upon change the onDefaultGroupNodeStyleChanged
method will be called.
public function get defaultGroupNodeStyle():INodeStyle
public function set defaultGroupNodeStyle(value:INodeStyle):void
graph | property |
graph:IGraph
[read-only] Yields the graph instance that this instance is working on.
public function get graph():IGraph
hierarchy | property |
hierarchy:INodeHierarchy
[read-only] Yields the hierarchy of the nodes in this grouped graph.
public function get hierarchy():INodeHierarchy
shareDefaultGroupNodeStyleInstance | property |
shareDefaultGroupNodeStyleInstance:Boolean
Gets or sets a property that determines whether newly
created group nodes should share the currently set dfaultGroupNodeStyle
instance.
If this property is set to false
, the createGroupNodeStyle
factory
method used by the creational methods will try to clone the currently
set style instance instead of returning it directly.
The default value is false
.
public function get shareDefaultGroupNodeStyleInstance():Boolean
public function set shareDefaultGroupNodeStyleInstance(value:Boolean):void
GroupedGraph | () | Constructor |
public function GroupedGraph(graph:IGraph = null, hierarchy:INodeHierarchy = null)
Creates a new instance using the provided graph and hierarchy instance.
If both a graph and a hierarchy are passed, it is the responsibility of the caller to assure that the hierarchy and graph instances are in sync, initially.
Parametersgraph:IGraph (default = null ) — The graph implementation to use for managing the node hierarchy, or null .
If no graph is passed, a newly created empty DefaultGraph is used.
If only the graph parameter is used, the hierarchy will be initialized so that all nodes
in the provided graph are initially top-level non-group nodes.
| |
hierarchy:INodeHierarchy (default = null ) — The hierarchy to use, or null .
If no hierarchy is passed, a newly created DefaultNodeHierarchy is used.
If only the hierarchy parameter is used, the hierarchy may not contain any nodes initially.
|
adjustGroupNodeBounds | () | method |
public function adjustGroupNodeBounds(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.
Parameters
groupNode:INode — The group node to adjust the size of.
|
createDefaultGroupNodeStyle | () | method |
protected function createDefaultGroupNodeStyle():INodeStyle
Factory method for the defaultGroupNodeStyle
property. This method will be called
upon first access to the defaultGroupNodeStyle
property.
INodeStyle — A new instance of ShapeNodeStyle .
|
createGroupNode | () | method |
public function createGroupNode(parent:INode = null, bounds:IRectangle = null, style:INodeStyle = null):INode
Creates a new group node.
If no parent
group node is provided, the group node will
be a top-level group node in the node hierarchy. If a parent
is provided, the created group node will be a direct descendant of
parent
.
Parameters
parent:INode (default = null ) — The node to use as the parent in the grouping hierarchy, or null
if a top-level group node should be created.
| |
bounds:IRectangle (default = null ) — The initial bounds to use for the new group node, or null .
| |
style:INodeStyle (default = null ) — The style to use for the new group node, or null , if the
defaultGroupNodeStyle should be used.
|
INode — The newly created group node if no parent node was
provided, or parent .
|
createGroupNodeStyle | () | method |
protected function createGroupNodeStyle():INodeStyle
Factory callback that returns an INodeStyle
for newly created group nodes.
Depending on the value of the shareDefaultGroupNodeStyleInstance
this method will simply return the defaultGroupNodeStyle
or
create a clone of it.
INodeStyle — Either the defaultGroupNodeStyle instance or a clone of it.
|
createNode | () | method |
public function createNode(parent:INode, bounds:IRectangle = null, style:INodeStyle = null):INode
Creates a new ordinary node as a direct descendant of parent
.
This method ultimately delegates to the graph
's createNode
set of methods.
Parameters
parent:INode — The node to use as the parent in the grouping hierarchy.
| |
bounds:IRectangle (default = null ) — The initial node bounds, or null if default bounds should be used.
The values will be copied to the node's layout field.
| |
style:INodeStyle (default = null ) — the style instance that will be assigned to the newly created instance, or null
if the default style should be used.
|
INode — The newly created node.
|
dispose | () | method |
public function dispose():void
Disposes of this instance. This removes all artifacts from the IGraph instance that have been added during the registration.
getParent | () | method |
public function getParent(node:INode):INode
Convenience method that yields the parent of a node.
This method yields the parent node of the current node or INodeHierarchy.root
if the node is a top level node in the hierarchy.
Parameters
node:INode — The node to yield the parent node.
|
INode — The parent of the node or INodeHierarchy.root if the node is a top level node.
|
See also
groupNodes | () | method |
public function groupNodes(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
children:Iterable — The children to group into the group node.
| |
parent:INode (default = null )
|
INode — The newly created group node if no parent was provided, or
parent .
|
nodeBoundsChanged | () | method |
public function nodeBoundsChanged(node:INode, oldBounds:IRectangle):void
Called when the bounds of a node have changed.
Parameters
node:INode — the node whose bounds have changed
| |
oldBounds:IRectangle — The node's bounds before the change.
|
onDefaultGroupNodeStyleChanged | () | method |
protected function onDefaultGroupNodeStyleChanged(oldStyle:INodeStyle, newStyle:INodeStyle):void
Called when the defaultGroupNodeStyle
property value changes
and after initialization of the field.
Triggers the defaultGroupNodeStyleChanged
event.
Parameters
oldStyle:INodeStyle — The old value, which may be null the first time.
| |
newStyle:INodeStyle — The new value.
|
onGroupNodeCreated | () | method |
protected function onGroupNodeCreated(parent:INode, node:INode):void
Called whenever a new group node has been created in the graph.
Parameters
parent:INode — The new parent node of the node or IHierarchy.root .
| |
node:INode — The newly created node.
|
onNodeChanged | () | method |
protected function onNodeChanged(node:INode):void
Callback that will be called once the original IGraph
triggers the nodeChanged
event.
This implementation will call IHierarchy.publishItemChanged()
.
Parameters
node:INode — The node that has changed.
|
onNodeCreated | () | method |
protected function onNodeCreated(parent:INode, node:INode):void
Called whenever a new node has been created in the graph.
Parameters
parent:INode — The new parent node of the node or IHierarchy.root .
| |
node:INode — The newly created node.
|
onNodeRemoved | () | method |
protected function onNodeRemoved(node:INode):void
Called whenever a node has been removed in the graph.
Parameters
node:INode — The removed node.
|
setParent | () | method |
public function setParent(node:INode, parent:INode):void
Sets the parent node for a given node.
Use hierarchy
's root
field
to make node
a top-level node for this graph.
Parameters
node:INode — The node to assign a new parent.
| |
parent:INode — The parent group node to assign to node .
|
defaultGroupNodeStyleChanged | Event |
mx.events.PropertyChangeEvent
com.yworks.graph.model.DEFAULT_GROUP_NODE_STYLE_CHANGED
Dispatched when the value of the defaultGroupNodeStyle
property changes.
DEFAULT_GROUP_NODE_STYLE_CHANGED | Constant |
public static const DEFAULT_GROUP_NODE_STYLE_CHANGED:String = defaultGroupNodeStyleChanged