| Package | com.yworks.graph.model |
| Interface | public interface IFoldedGraph extends ILookup, flash.events.IEventDispatcher |
IGraph that supports folding operations like expanding and
collapsing of nodes.
The foldingManager creates views of its masterGraph and
masterHierarchy which are created using copies of the original "master" entities.
The views are being synchronized via the masterGraph, but may contain additional
view state.
Typically, nodes and edges are being copied from the masterGraph and they share
many of their properties by reference (e.g. their style).
However, if group nodes are being represented by collapsed group nodes in this view,
they maintain a separate set of labels, ports, bends,
and a separate layout. This view-local state is shared between all views
that have been created by the same FoldingManager and can be obtained and modified via the
FoldingManager's getViewState methods for dummy edges
and dummy nodes in the absence of a corresponding IFoldedGraph
view instance.
Developers typically don't need to implement this interface themselves, rather an implementation is provided
by the framework and can be obtained from the FoldingManager.
Use FoldingManager.createManagedView() to obtain an IGraph implementation
that contains an implementation of this class in its lookup method.
See also
| Property | Defined By | ||
|---|---|---|---|
| autoSwitchToAncestor : Boolean
Determines whether this instance should automatically switch the localRoot to an ancestor
of the current root, if this view becomes invalid. | IFoldedGraph | ||
| enqueueNavigationalUndoUnits : Boolean
Determines whether changes to the localRoot property and calls to
expand and collapse should be recorded in undo history. | IFoldedGraph | ||
| graph : IGraph [read-only]
Provides a reference to the IGraph implementation that provides the actual view data. | IFoldedGraph | ||
| groupedGraph : IGroupedGraph [read-only]
Provides a reference to the IGroupedGraph implementation that is backing the
graph. | IFoldedGraph | ||
| hierarchy : INodeHierarchy [read-only]
Provides a reference to the INodeHierarchy implementation that is backing the
graph. | IFoldedGraph | ||
| invalid : Boolean [read-only]
Determines if this view is currently valid and can be edited. | IFoldedGraph | ||
| localRoot : INode
Gets or sets an entity of the FoldingManager's masterHierarchy
to serve as the virtual root for the view's local hierarchy. | IFoldedGraph | ||
| manager : FoldingManager [read-only]
Provides access to the manager that created this view and that contains references to
the masterGraph and masterHierarchy. | IFoldedGraph | ||
| Method | Defined By | ||
|---|---|---|---|
This method will collapse the children of a group node into the group node. | IFoldedGraph | ||
dispose():void
Disposes of this view explicitly. | IFoldedGraph | ||
This method will expand a previously collapsed group node to make its contents
appear in this view. | IFoldedGraph | ||
Helper method that can be used to retrieve the original "master" items in the FoldingManager's
masterGraph that is managed by the manager associated with this view. | IFoldedGraph | ||
Helper method that can be used to retrieve the original "master" bend in the masterGraph
that is managed by the manager associated with this view. | IFoldedGraph | ||
Helper method that can be used to retrieve the original "master" edge in the masterGraph
that is managed by the manager associated with this view. | IFoldedGraph | ||
Helper method that corresponds to the getMasterEdge method, but is used for dummy edges, only. | IFoldedGraph | ||
Helper method that can be used to retrieve the original "master" label item in the masterGraph
that is managed by the manager associated with this view. | IFoldedGraph | ||
Helper method that can be used to retrieve the original "master" node in the masterGraph
that is managed by the manager associated with this view. | IFoldedGraph | ||
Helper method that can be used to retrieve the original "master" port in the masterGraph
that is managed by the manager associated with this view. | IFoldedGraph | ||
Helper method that can be used to retrieve the representing items in this graph-view
for all items that are part of the FoldingManager's masterGraph that is associated
with the manager of this instance. | IFoldedGraph | ||
Helper method that can be used to retrieve the representing bends in this graph-view
for all bends that are part of the masterGraph that is associated
with the manager of this instance. | IFoldedGraph | ||
Helper method that can be used to retrieve the representing edges in this graph-view
for all edges that are part of the masterGraph that is associated
with the manager of this instance. | IFoldedGraph | ||
Helper method that can be used to retrieve the representing labels in this graph-view
for all labels that are part of the masterGraph that is associated
with the manager of this instance. | IFoldedGraph | ||
Helper method that can be used to retrieve the representing node in this graph-view
for all nodes that are part of the masterGraph that is associated
with the manager of this instance. | IFoldedGraph | ||
Helper method that can be used to retrieve the representing ports in this graph-view
for all ports that are part of the masterGraph that is associated
with the manager of this instance. | IFoldedGraph | ||
isDummy(item:IModelItem):Boolean
Determines whether the specified item is a dummy in this view. | IFoldedGraph | ||
isExpanded(groupNode:INode):Boolean
Determines whether the provided node from this
hierarchy is currently expanded. | IFoldedGraph | ||
isInitiallyExpanded(masterGroupNode:INode):Boolean
Determines whether the given group node from the foldingManager's masterGraph
will be displayed in expanded state the next time it will be included in this view. | IFoldedGraph | ||
![]() | lookup(type:Class):Object
Returns an instance that implements the given type or null. | ILookup | |
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when a the folding state of a group node changes. | IFoldedGraph | |||
| Event that will be triggered whenever a property of this interface has changed. | IFoldedGraph | |||
| autoSwitchToAncestor | property |
autoSwitchToAncestor:Boolean
Determines whether this instance should automatically switch the localRoot to an ancestor
of the current root, if this view becomes invalid.
By default this property is set to true, which assures that this view will never become invalid.
It is the responsibility of the client code to check for the validity of this view before trying to modify it if
this feature is disabled.
The default value is true.
public function get autoSwitchToAncestor():Boolean public function set autoSwitchToAncestor(value:Boolean):void| enqueueNavigationalUndoUnits | property |
enqueueNavigationalUndoUnits:Boolean
Determines whether changes to the localRoot property and calls to
expand and collapse should be recorded in undo history.
By default this property is set to false.
However, depending on the use case, it may make sense to enqueue IUndoUnits
for this type of operations.
The default value is false;.
public function get enqueueNavigationalUndoUnits():Boolean public function set enqueueNavigationalUndoUnits(value:Boolean):voidSee also
| graph | property |
graph:IGraph [read-only]
Provides a reference to the IGraph implementation that provides the actual view data.
The instance has an implementation of this interface in its lookup that
has been obtained from the FoldingManager's createManagedView() method.
The instance holds the elements in the view only, which in general is a subset of the manager's
masterGraph.
Also note that the elements are not the same references as their masters. They
are copies that may share the same attributes.
public function get graph():IGraphSee also
| groupedGraph | property |
groupedGraph:IGroupedGraph [read-only]
Provides a reference to the IGroupedGraph implementation that is backing the
graph.
This is a convenience accessor, that yields the implementation that is bound to the graph instance.
The instance manages the elements in the view only, which in general is a subset of the FoldingManager's
masterGroupedGraph.
public function get groupedGraph():IGroupedGraph| hierarchy | property |
hierarchy:INodeHierarchy [read-only]
Provides a reference to the INodeHierarchy implementation that is backing the
graph.
This is a convenience accessor, that yields the implementation that is bound to the groupedGraph instance.
The instance manages the elements in the view only, which in general is a subset of the FoldingManager's
masterHierarchy and is induced by localRoot.
Note that the root property of the provided instance is not the same as localRoot.
localRoot is a node from the master hierarchy (including the root of the master hierarchy),
whereas the root property of this instance is set to an unmodifiable value.
public function get hierarchy():INodeHierarchy| invalid | property |
invalid:Boolean [read-only] Determines if this view is currently valid and can be edited.
A view is invalid if the localRoot is not currently part of the FoldingManager's
masterHierarchy.
This can happen if the root node is removed from the masterGraph.
Note that the view can become valid again if the removal is undone.
public function get invalid():BooleanSee also
| localRoot | property |
localRoot:INode
Gets or sets an entity of the FoldingManager's masterHierarchy
to serve as the virtual root for the view's local hierarchy.
This property can be set to any non-leaf node in the master hierarchy whose contents will then be represented in this view.
Note that the root property of the view's local hierarchy is not set to the same instance.
public function get localRoot():INode public function set localRoot(value:INode):void| manager | property |
manager:FoldingManager [read-only]
Provides access to the manager that created this view and that contains references to
the masterGraph and masterHierarchy.
public function get manager():FoldingManager| collapse | () | method |
public function collapse(groupNode:INode):voidThis method will collapse the children of a group node into the group node.
If a non-leaf node that belongs to this view's hierarchy is in expanded state,
calling this method will remove the children from this graph.
This method will do nothing if the node is already collapsed. Note that collapsing a group node
will make it a leaf node in the local hierarchy.
Parameters
groupNode:INode — A group node that is part of the graph and hierarchy that belongs to this instance.
|
See also
| dispose | () | method |
public function dispose():voidDisposes of this view explicitly.
Normally it is not necessary to do so, because the view will be garbage collected automatically.
However if the view still displays contents, this might have unwanted negative side effects
(group node sizes being calculated, etc.)
A disposed of instance is not synchronized with the manager anymore
and should not be used anymore.
| expand | () | method |
public function expand(groupNode:INode):void
This method will expand a previously collapsed group node to make its contents
appear in this view.
If a node that belongs to this view's hierarchy is in collapsed state,
calling this method will make the children appear in this view.
This method will do nothing if the node is already expanded. Note that expanding a collapsed group node
will make the node a non-leaf, whereas a collapsed group node is a leaf in
this hierarchy and thus cannot have visible children.
Parameters
groupNode:INode — A group node that is part of the graph and hierarchy that belongs to this instance.
|
See also
| getMaster | () | method |
public function getMaster(item:IModelItem):IModelItem
Helper method that can be used to retrieve the original "master" items in the FoldingManager's
masterGraph that is managed by the manager associated with this view.
Since the graph view that is associated with this instance maintains a copy of the entities in the
manager's masterGraph, there is a mapping between elements that
belong to this view's graph and the elements in the master graph.
This method can be called for the elements contained in this graph's item collection
and will return the corresponding item in the master graph that the element corresponds to, if any.
Note that for some items in the graph, there is no master item in the FoldingManager's
masterGraph, e.g. the IPort instances to which DummyEdgeId connect
have no corresponding ports in the master graph. The same holds true for the IBend and
ILabel of dummy edges and DummyNodeId.
For dummy edges, this method will yield the FoldingManager#getMainRepresentingEdge()
in the master graph, if the dummy edge represents more than one master edge. For dummy nodes, the master node
will be returned, no matter whether the node is currently collapsed or not.
Parameters
item:IModelItem — The item that is part of this graph for which the original "master" item in the
FoldingManager's masterGraph will be returned.
|
IModelItem — An item in the FoldingManager's masterGraph that corresponds to the passed item
or null, if there is no such item.
|
See also
| getMasterBend | () | method |
public function getMasterBend(bend:IBend):IBend
Helper method that can be used to retrieve the original "master" bend in the masterGraph
that is managed by the manager associated with this view.
Since the graph view that is associated with this instance maintains a copy of the entities in the
manager's masterGraph, there is a mapping between elements that
belong to this view's graph and the elements in the master graph.
Note that there is no corresponding master item in the manager's masterGraph
for bends of dummy edges.
Parameters
bend:IBend — A bend that is part of this graph for which the original "master" bend in the
masterGraph will be returned.
|
IBend — A bend in the manager's masterGraph that corresponds to the
given port, or null if no such bend exists.
|
See also
| getMasterEdge | () | method |
public function getMasterEdge(edge:IEdge):IEdge
Helper method that can be used to retrieve the original "master" edge in the masterGraph
that is managed by the manager associated with this view.
Since the graph view that is associated with this instance maintains a copy of the entities in the
manager's masterGraph, there is a mapping between elements that
belong to this view's graph and the elements in the master graph.
For dummy edges, this method will yield the main representing edge in the master graph, if the dummy edge represents more than one master edge.
Parameters
edge:IEdge — The edge that is part of this graph for which the original "master" edge in the
masterGraph will be returned.
|
IEdge — An edge in the manager's masterGraph that corresponds to the
given edge.
|
See also
| getMasterEdges | () | method |
public function getMasterEdges(dummyEdge:IEdge):Iterable
Helper method that corresponds to the getMasterEdge method, but is used for dummy edges, only.
Since dummy edges can represent more than one master edge, this method can be used to query all of the master edges that the provided dummy edge represents. If the dummy edge corresponds to a single master edge, the result will enumerate that edge, only.
Parameters
dummyEdge:IEdge — The dummy edge for which the master edges should be returned.
|
Iterable — An iterable that iterates all of the edges in the manager's masterGraph
that are being represented by the dummy edge in this view's graph.
|
See also
| getMasterLabel | () | method |
public function getMasterLabel(label:ILabel):ILabel
Helper method that can be used to retrieve the original "master" label item in the masterGraph
that is managed by the manager associated with this view.
Since the graph view that is associated with this instance maintains a copy of the entities in the
manager's masterGraph, there is a mapping between elements that
belong to this view's graph and the elements in the master graph.
Note that there are no corresponding master item in the manager's masterGraph
for labels of dummy edges and dummy nodes.
Parameters
label:ILabel — A label that is part of this graph for which the original "master" label in the
masterGraph will be returned.
|
ILabel — A label in the manager's masterGraph that corresponds to the
given node, or null if no such label exists.
|
See also
| getMasterNode | () | method |
public function getMasterNode(node:INode):INode
Helper method that can be used to retrieve the original "master" node in the masterGraph
that is managed by the manager associated with this view.
Since the graph view that is associated with this instance maintains a copy of the entities in the
manager's masterGraph, there is a mapping between elements that
belong to this view's graph and the elements in the master graph.
For dummy nodes, the master node will be returned, no matter
whether the node is currently collapsed or not.
Parameters
node:INode — A node that is part of this graph for which the original "master" node in the
masterGraph will be returned.
|
INode — A node in the manager's masterGraph that corresponds to the
given node.
|
See also
| getMasterPort | () | method |
public function getMasterPort(port:IPort):IPort
Helper method that can be used to retrieve the original "master" port in the masterGraph
that is managed by the manager associated with this view.
Since the graph view that is associated with this instance maintains a copy of the entities in the
manager's masterGraph, there is a mapping between elements that
belong to this view's graph and the elements in the master graph.
Note that there are no corresponding master item in the manager's masterGraph
for port items that dummy edges connect to.
Parameters
port:IPort — A port that is part of this graph for which the original "master" port in the
masterGraph will be returned.
|
IPort — A port in the manager's masterGraph that corresponds to the
given port, or null if no such port exists.
|
See also
| getRepresentative | () | method |
public function getRepresentative(modelItem:IModelItem):IModelItem
Helper method that can be used to retrieve the representing items in this graph-view
for all items that are part of the FoldingManager's masterGraph that is associated
with the manager of this instance.
Since the graph view that is associated with this instance maintains a copy of the entities in the
manager's masterGraph, there is a mapping between elements that
belong to master graph and the elements in the graph of this view.
This method can be called for the elements contained in the collectionModel of the
FoldingManager's masterGraph and will return the corresponding item in this view's
Graph if the element is represented by an item in this view.
Note that for some items in the
FoldingManager's masterGraph, there may be no item
in the graph instance, e.g. those elements which are part of a collapsed subtree in the
FoldingManager's masterHierarchy or those items that do not belong to the subtree
that is induced by the localRoot of this view.
Also, for nodes and edges that are being represented by dummies in this view, labels, ports, and bends are not
being represented directly by corresponding entities in this graph.
If more than one edge is represented by a dummy edge in this view, this method will yield the same dummy edge
instance for each of them.
Parameters
modelItem:IModelItem — An item that is part of the FoldingManager's masterGraph that is
associated with the manager of this instance.
|
IModelItem — An item in the graph that corresponds to the passed model item
or null, if the item is not currently being represented in this view.
|
See also
| getRepresentativeBend | () | method |
public function getRepresentativeBend(bend:IBend):IBend
Helper method that can be used to retrieve the representing bends in this graph-view
for all bends that are part of the masterGraph that is associated
with the manager of this instance.
Since the graph that is associated with this instance maintains a copy of the entities in the
manager's masterGraph, there is a mapping between elements that
belong to master graph and the elements in the graph of this view.
This method can be called for the bends contained in this master graph's
collectionModel and will return the corresponding bend in this view's
graph if the master bend is represented by an item in this view.
Note that for some bends in the master graph, there may be no bend in the graph instance, e.g.
those bends which are part of a collapsed subtree in the manager's masterHierarchy
or those bends that do not belong to the subtree that is induced by the localRoot of this view.
Also, for nodes and edges that are being represented by dummies in this view, bends are not
being represented directly by corresponding entities in this graph.
Parameters
bend:IBend — A bend that is part of the masterGraph that is associated with the
manager of this instance.
|
IBend — A bend in the local graph view that corresponds to the given argument
or null, if the item is not currently being represented in this view.
|
See also
| getRepresentativeEdge | () | method |
public function getRepresentativeEdge(edge:IEdge):IEdge
Helper method that can be used to retrieve the representing edges in this graph-view
for all edges that are part of the masterGraph that is associated
with the manager of this instance.
Since the graph that is associated with this instance maintains a copy of the entities in the
manager's masterGraph, there is a mapping between elements that
belong to master graph and the elements in the graph of this view.
This method can be called for the edges contained in this master graph's
collectionModel and will return the corresponding edge in this view's
graph if the master edge is represented by an item in this view.
Note that for some edges in the master graph, there may be no item in the graph instance, e.g.
those edges which are part of a collapsed subtree in the manager's masterHierarchy
or those edges that do not belong to the subtree that is induced by the localRoot of this view.
If more than one edge is represented by a dummy edge in this view, this method will yield the same dummy edge instance for each of them.
Parameters
edge:IEdge — An edge that is part of the masterGraph that is associated with the
manager of this instance.
|
IEdge — An edge in the local graph view that corresponds to the given argument
or null, if the edge is not currently being represented in this view.
|
See also
| getRepresentativeLabel | () | method |
public function getRepresentativeLabel(label:ILabel):ILabel
Helper method that can be used to retrieve the representing labels in this graph-view
for all labels that are part of the masterGraph that is associated
with the manager of this instance.
Since the graph that is associated with this instance maintains a copy of the entities in the
manager's masterGraph, there is a mapping between elements that
belong to master graph and the elements in the graph of this view.
This method can be called for the labels contained in this master graph's
collectionModel and will return the corresponding label in this view's
graph if the master label is represented by a label in this view.
Note that for some labels in the master graph, there may be no label in the graph instance, e.g.
those labels which are part of a collapsed subtree in the manager's masterHierarchy
or those labels that do not belong to the subtree that is induced by the localRoot of this view.
Also, for nodes and edges that are being represented by dummies in this view, labels are not
being represented directly by corresponding entities in this graph.
Parameters
label:ILabel — A label that is part of the masterGraph that is associated with the
manager of this instance.
|
ILabel — A label in the local graph view that corresponds to the given argument
or null, if the label is not currently being represented in this view.
|
See also
| getRepresentativeNode | () | method |
public function getRepresentativeNode(node:INode):INode
Helper method that can be used to retrieve the representing node in this graph-view
for all nodes that are part of the masterGraph that is associated
with the manager of this instance.
Since the graph that is associated with this instance maintains a copy of the entities in the
manager's masterGraph, there is a mapping between elements that
belong to master graph and the elements in the graph of this view.
This method can be called for the nodes contained in this master graph's
collectionModel and will return the corresponding node in this view's
graph if the master node is represented by a node in this view.
Note that for some nodes in the master graph, there may be no item in the graph instance, e.g.
those nodes which are part of a collapsed subtree in the manager's masterHierarchy
or those nodes that do not belong to the subtree that is induced by the localRoot of this view.
Parameters
node:INode — A node that is part of the masterGraph that is associated with the
manager of this instance.
|
INode — A node in the local graph view that corresponds to the given node
or null, if the node is not currently being represented in this view.
|
See also
| getRepresentativePort | () | method |
public function getRepresentativePort(port:IPort):IPort
Helper method that can be used to retrieve the representing ports in this graph-view
for all ports that are part of the masterGraph that is associated
with the manager of this instance.
Since the graph that is associated with this instance maintains a copy of the entities in the
manager's masterGraph, there is a mapping between elements that
belong to master graph and the elements in the graph of this view.
This method can be called for the ports contained in this master graph's
collectionModel and will return the corresponding port in this view's
graph if the master port is represented by a port in this view.
Note that for some ports in the master graph, there may be no item in the graph instance, e.g.
those ports which are part of a collapsed subtree in the manager's masterHierarchy
or those ports that do not belong to the subtree that is induced by the localRoot of this view.
Also, for nodes and edges that are being represented by dummies in this view, ports are not
being represented directly by corresponding entities in this graph.
Parameters
port:IPort — A port that is part of the masterGraph that is associated with the
manager of this instance.
|
IPort — A port in the local graph view that corresponds to the given argument
or null, if the port is not currently being represented in this view.
|
See also
| isDummy | () | method |
public function isDummy(item:IModelItem):BooleanDetermines whether the specified item is a dummy in this view.
This method can be used to determine if an INode, IEdge,
IPort, ILabel, or IBend has a
view local state and is not a direct copy of the master item, if any.
Note that collapsed group nodes are dummy items, even though they do have a master
item in the master graph and dummy edges always have at least one master edge, while
all other dummy items don't have a corresponding master item in the master graph.
Parameters
item:IModelItem — One of the items that are contained in the graph.
|
Boolean — Whether the item is a dummy that is not an exact copy of an item in the manager's masterGraph.
|
| isExpanded | () | method |
public function isExpanded(groupNode:INode):Boolean
Determines whether the provided node from this
hierarchy is currently expanded.
Expanded group nodes will have all of their children visible in this graph
and hierarchy.
Parameters
groupNode:INode — The group node for which the expanded state will be returned.
|
Boolean — true, if the group node can be collapsed.
|
| isInitiallyExpanded | () | method |
public function isInitiallyExpanded(masterGroupNode:INode):Boolean
Determines whether the given group node from the foldingManager's masterGraph
will be displayed in expanded state the next time it will be included in this view.
The initial state had been queried using the predicate function,
that has been specified during the creation of the view
but can be different for this view due to
subsequent calls to collapse and expand.
This method can be used to yield the last known expanded state for a node, even if it is not currently visible in the view.
Parameters
masterGroupNode:INode — The group node in the foldingManager's masterHierarchy.
|
Boolean — true iff the node should be displayed in expanded state
the next time it will become visible in this view.
|
See also
| foldingStateChanged | Event |
com.yworks.graph.model.GraphEventcom.yworks.graph.model.GraphEvent.FOLDING_STATE_CHANGEDDispatched when a the folding state of a group node changes.
The kind property of the dispatched event will be set to either
GraphEventKind.GROUP_COLLAPSED or GraphEventKind.GROUP_EXPANDED
GraphEvent.FOLDING_STATE_CHANGED constant defines the value of the
type property of the event object for a foldingStateChanged event.
See also
| propertyChanged | Event |
mx.events.PropertyChangeEventmx.events.PropertyChangeEvent.PROPERTY_CHANGEEvent that will be triggered whenever a property of this interface has changed.
This can be used to easily monitor the validity of this view.
Also, changes to the localRoot property will be published via this event.
See also
IFoldedGraph can be obtained.
var manager:FoldingManager = new FoldingManager();
var foldedGraph:IFoldedGraph = manager.createManagedView();
var graph:IGraph = foldedGraph.graph;
// obtain the foldedGraph instance using the lookup, this
// will yield the same instance as above but can be used
// at other places in the code that have access to the graph
// instance, only.
var foldedGraph:IFoldedGraph = graph.lookup( IFoldedGraph ) as IFoldedGraph;