| Package | com.yworks.graph.model |
| Interface | public interface IGraph extends ILookup, flash.events.IEventDispatcher |
| Implementors | DefaultGraph, DefaultGraphStructure, GraphSelection |
GraphCanvasComponent.
This interface can be used to query structural information, it also offers methods that change the structure of the graph and its attributes. A number of events will trigger appropriate events if the structure of the graph changes.
The graph is made up of collections of INodes and IEdges.
Each node and edge can be associated
with a number of ILabels and possibly IPorts
to which edges connect. An edge connects to two
ports and may consist of zero or more IBends.
The graph is treated as a directed graph, i.e. edges have a IEdge.sourcePort
and a IEdge.targetPort. It is up to the algorithms
and the visualization to possibly treat them as undirected.
The edgesAtPortOwner( IPortOwner ) and methods edgesAtPort( IPort )
can be used to query adjacency information from the graph's structure.
Each element in the graph can be associated with a IVisualStylevisual style
that is used for the visualization of the element.
Styles can be shared between multiple instances.
| Property | Defined by | ||
|---|---|---|---|
| bends : ICollectionModel
[read-only]
A collection view over the bends of the edges contained in this graph.
| IGraph | ||
| collectionModel : ICollectionModel
[read-only]
Offers a view over all elements that make up the graph.
| IGraph | ||
| defaultEdgeLabelModelParameter : ILabelModelParameter | IGraph | ||
| defaultEdgeLabelStyle : ILabelStyle | IGraph | ||
| defaultEdgeStyle : IEdgeStyle | IGraph | ||
| defaultNodeLabelModelParameter : ILabelModelParameter | IGraph | ||
| defaultNodeLabelStyle : ILabelStyle | IGraph | ||
| defaultNodeSize : ISize | IGraph | ||
| defaultNodeStyle : INodeStyle | IGraph | ||
| defaultPortStyle : IPortStyle | IGraph | ||
| edgeLabels : ICollectionModel
[read-only]
A collection view over the labels attached to edges contained in this graph.
| IGraph | ||
| edges : ICollectionModel
[read-only]
A collection view over the edges contained in this graph.
| IGraph | ||
| mapperRegistry : IMapperRegistry
[read-only]
A registry that can be used to store and retrieve arbitrary information for items in this graph.
| IGraph | ||
| nodeLabels : ICollectionModel
[read-only]
A collection view over the labels attached to nodes contained in this graph.
| IGraph | ||
| nodes : ICollectionModel
[read-only]
A collection view over the nodes contained in this graph.
| IGraph | ||
| ports : PortCollectionModel [read-only]
A collection view over the ports contained in this graph.
| IGraph | ||
| Method | Defined by | ||
|---|---|---|---|
|
Adds a bend at the given index to the given edge using the coordinates provided.
| IGraph | ||
|
addLabel(item:ILabeledItem, text:String, labelModelParameter:ILabelModelParameter = null, style:ILabelStyle = null):ILabel
Add a label to the given item using the text as the initial label text and label model parameter and style.
| IGraph | ||
|
Add a port to the given port owner using the coordinates as the new initial position of
he port anchor.
| IGraph | ||
|
clear():void
Clears this instance, removing all entities in proper order.
| IGraph | ||
|
clearBends(edge:IEdge):void
Removes all bends from the given edge.
| IGraph | ||
|
contains(item:IModelItem):Boolean
Determines whether this instance contains the given element.
| IGraph | ||
|
Creates and returns an edge that connects to the given port instances.
| IGraph | ||
|
Convenience method that creates and returns an edge that connects to the given node instances using the
given style instance.
| IGraph | ||
|
Creates and returns a node using default values for the style and the specified initial geometry.
| IGraph | ||
|
createNodeAt(x:Number, y:Number):INode
Creates and returns a node using default values for the style and the specified initial geometry.
| IGraph | ||
|
Returns an
Iterable for all edges that are adjacent to the given
port as a IEdge.sourcePort or IEdge.targetPort. | IGraph | ||
|
Returns an
Iterable for all edges that have the given port owner as their
IEdge.targetPort's or IEdge.sourcePort's. | IGraph | ||
|
invalidateDisplays():void
Causes the
displaysInvalidated event to be triggered. | IGraph | ||
![]() |
lookup(type:Class):Object
Returns an instance that implements the given type or
null. | ILookup | |
|
removeBend(bend:IBend):void
Removes the given bend instance from its edge.
| IGraph | ||
|
removeEdge(edge:IEdge):void
Removes the given edge instance from this graph.
| IGraph | ||
|
removeLabel(label:ILabel):void
Removes the given label from its owner.
| IGraph | ||
|
removeNode(node:INode):void
Removes the given node instance from this graph.
| IGraph | ||
|
removePort(port:IPort):void
Removes the port from its owner.
| IGraph | ||
|
setBendLocation(bend:IBend, x:Number, y:Number):void
Modifies the location of the given bend.
| IGraph | ||
|
Sets the bounds of the given node to the new values.
| IGraph | ||
|
Assigns the given style instance by reference to the edge.
| IGraph | ||
|
Sets the label model parameter for the given label.
| IGraph | ||
|
Assigns the given style instance by reference to the label.
| IGraph | ||
|
setLabelText(label:ILabel, text:String):void
Sets the label text of the given label.
| IGraph | ||
|
Assigns the given style instance by reference to the node.
| IGraph | ||
|
setPortLocation(port:IPort, x:Number, y:Number):void
Sets the coordinates of the given port to the given values.
| IGraph | ||
|
Sets the ports of the given edge to the new values.
| IGraph | ||
|
Assigns the given style instance by reference to the port.
| IGraph | ||
|
setPreferredSize(label:ILabel, width:Number, height:Number):void
Sets the preferred size of the label.
| IGraph | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
Dispatched when invalidateDisplays was called. | IGraph | |||
| Dispatched when a change to the graph structure occurs. | IGraph | |||
| bends | property |
bends:ICollectionModel [read-only]A collection view over the bends of the edges contained in this graph.
This is a readonly live view of the entities, i.e. the same reference will be returned for each invocation, that always represents the current state of the graph.
Implementation public function get bends():ICollectionModel
| collectionModel | property |
collectionModel:ICollectionModel [read-only]Offers a view over all elements that make up the graph. This is a combined view of all nodes, edges, labels, ports, and bends.
Implementation public function get collectionModel():ICollectionModel
| defaultEdgeLabelModelParameter | property |
defaultEdgeLabelModelParameter:ILabelModelParameter [read-write]Implementation
public function get defaultEdgeLabelModelParameter():ILabelModelParameter
public function set defaultEdgeLabelModelParameter(value:ILabelModelParameter):void
| defaultEdgeLabelStyle | property |
defaultEdgeLabelStyle:ILabelStyle [read-write]Implementation
public function get defaultEdgeLabelStyle():ILabelStyle
public function set defaultEdgeLabelStyle(value:ILabelStyle):void
| defaultEdgeStyle | property |
defaultEdgeStyle:IEdgeStyle [read-write]Implementation
public function get defaultEdgeStyle():IEdgeStyle
public function set defaultEdgeStyle(value:IEdgeStyle):void
| defaultNodeLabelModelParameter | property |
defaultNodeLabelModelParameter:ILabelModelParameter [read-write]Implementation
public function get defaultNodeLabelModelParameter():ILabelModelParameter
public function set defaultNodeLabelModelParameter(value:ILabelModelParameter):void
| defaultNodeLabelStyle | property |
defaultNodeLabelStyle:ILabelStyle [read-write]Implementation
public function get defaultNodeLabelStyle():ILabelStyle
public function set defaultNodeLabelStyle(value:ILabelStyle):void
| defaultNodeSize | property |
defaultNodeSize:ISize [read-write]Implementation
public function get defaultNodeSize():ISize
public function set defaultNodeSize(value:ISize):void
| defaultNodeStyle | property |
defaultNodeStyle:INodeStyle [read-write]Implementation
public function get defaultNodeStyle():INodeStyle
public function set defaultNodeStyle(value:INodeStyle):void
| defaultPortStyle | property |
defaultPortStyle:IPortStyle [read-write]Implementation
public function get defaultPortStyle():IPortStyle
public function set defaultPortStyle(value:IPortStyle):void
| edgeLabels | property |
edgeLabels:ICollectionModel [read-only]A collection view over the labels attached to edges contained in this graph.
This is a readonly live view of the entities, i.e. the same reference will be returned for each invocation, that always represents the current state if the graph.
Implementation public function get edgeLabels():ICollectionModel
| edges | property |
edges:ICollectionModel [read-only]A collection view over the edges contained in this graph.
This is a readonly live view of the entities, i.e. the same reference will be returned for each invocation, that always represents the current state of the graph.
Implementation public function get edges():ICollectionModel
| mapperRegistry | property |
mapperRegistry:IMapperRegistry [read-only]A registry that can be used to store and retrieve arbitrary information for items in this graph.
Implementation public function get mapperRegistry():IMapperRegistry
| nodeLabels | property |
nodeLabels:ICollectionModel [read-only]A collection view over the labels attached to nodes contained in this graph.
This is a readonly live view of the entities, i.e. the same reference will be returned for each invocation, that always represents the current state if the graph.
Implementation public function get nodeLabels():ICollectionModel
| nodes | property |
nodes:ICollectionModel [read-only]A collection view over the nodes contained in this graph.
This is a readonly live view of the nodes, i.e. the same reference will be returned for each invocation, that always represents the current state of the graph.
Implementation public function get nodes():ICollectionModel
| ports | property |
ports:PortCollectionModel [read-only]A collection view over the ports contained in this graph.
This is a readonly live view of the entities, i.e. the same reference will be returned for each invocation, that always represents the current state of the graph.
Implementation public function get ports():PortCollectionModel
| addBend | () | method |
public function addBend(edge:IEdge, index:int, x:Number, y:Number):IBendAdds a bend at the given index to the given edge using the coordinates provided. The added instance will be returned.
Parametersedge:IEdge — The edge to which the bend will be added.
|
|
index:int — The index for the newly added bend.
|
|
x:Number — The x-coordinate to use for the newly created bend.
|
|
y:Number — The y-coordinate to use for the newly created bend.
|
IBend —
A newly created live bend.
|
| addLabel | () | method |
public function addLabel(item:ILabeledItem, text:String, labelModelParameter:ILabelModelParameter = null, style:ILabelStyle = null):ILabelAdd a label to the given item using the text as the initial label text and label model parameter and style.
Parametersitem:ILabeledItem — The item to add the label to.
|
|
text:String — The initial text of the label
|
|
labelModelParameter:ILabelModelParameter (default = null) — The label model parameter instance to use. If null, default label model parameters will be used.
|
|
style:ILabelStyle (default = null) — The style to use for the label. If null a default label style will be used.
|
ILabel —
The newly created label.
|
| addPort | () | method |
public function addPort(portOwner:IPortOwner, x:Number, y:Number):IPortAdd a port to the given port owner using the coordinates as the new initial position of he port anchor.
Depending on the implementation this method may throw an IllegalOperationError
if the type of the portOwner instance does not support adding of ports.
This will trigger the nodeChanged or edgeChanged
event correspondingly.
portOwner:IPortOwner — The owner to add the port instance to.
|
|
x:Number — the new absolute x coordinate in the world coordinate system.
|
|
y:Number — the new absolute y coordinate in the world coordinate system.
|
IPort —
the newly created port
|
— If this instance cannot add a port to portOwner.
|
| clear | () | method |
public function clear():voidClears this instance, removing all entities in proper order.
| clearBends | () | method |
public function clearBends(edge:IEdge):voidRemoves all bends from the given edge.
The edge must be part of this graph at the time of the incovation. This will trigger the corresponding events.
Parametersedge:IEdge — The edge whose bends will be removed.
|
| contains | () | method |
public function contains(item:IModelItem):BooleanDetermines whether this instance contains the given element.
Parametersitem:IModelItem — the element.
|
Boolean — true if this instance contains the element.
|
| createEdge | () | method |
public function createEdge(sourcePort:IPort, targetPort:IPort, style:IEdgeStyle = null):IEdgeCreates and returns an edge that connects to the given port instances.
The ports must be part of this graph at the time of the invocation. The edge will be a part of this graph after the method returns. This will trigger the corresponding events.
ParameterssourcePort:IPort — The source port the created edge will connect to.
|
|
targetPort:IPort — The target port the created edge will connect to.
|
|
style:IEdgeStyle (default = null) — The style instance that will be assigned to the newly created instance.
If null, a default style will be used.
|
IEdge —
A newly created edge instance
|
| createEdgeBetweenNodes | () | method |
public function createEdgeBetweenNodes(sourceNode:INode, targetNode:INode, style:IEdgeStyle = null):IEdgeConvenience method that creates and returns an edge that connects to the given node instances using the given style instance.
The nodes must be part
of this graph at the time of the invocation, and the implementation will choose the
The edge will be a part of this graph after the method returns.
This will trigger the corresponding events.
sourceNode:INode — The source node the created edge will connect to. It is up to the implementation
to decide which port to use at the given node. The implementation may create a new port of the edge.
|
|
targetNode:INode — he target node the created edge will connect to. It is up to the implementation
to decide which port to use at the given node. The implementation may create a new port of the edge.
|
|
style:IEdgeStyle (default = null) — The style instance that will be assigned to the newly created instance.
If null, a default style will be used.
|
IEdge —
the newly created edge instance
|
| createNode | () | method |
public function createNode(bounds:IRectangle = null, style:INodeStyle = null):INodeCreates and returns a node using default values for the style and the specified initial geometry.
The node will be a part of this graph after the method returns. This will trigger the corresponding events.
Parametersbounds:IRectangle (default = null) — The bounds to use initially. If null, some default bounds will be used.
|
|
style:INodeStyle (default = null) — The style instance that will be assigned to the newly created instance.
If null, a default style will be used.
|
INode —
A newly created node instance
|
| createNodeAt | () | method |
public function createNodeAt(x:Number, y:Number):INodeCreates and returns a node using default values for the style and the specified initial geometry.
The node will be a part of this graph after the method returns. This will trigger the corresponding events.
Parametersx:Number — the initial x coordinate of the center of
the node's layout field
|
|
y:Number — the initial y coordinate of the center of
the node's layout field
|
INode —
A newly created node instance
|
| edgesAtPort | () | method |
public function edgesAtPort(port:IPort):Iterable
Returns an Iterable for all edges that are adjacent to the given
port as a IEdge.sourcePort or IEdge.targetPort.
port:IPort — The port to check.
|
Iterable —
An iterable of all adjacent edges.
|
| edgesAtPortOwner | () | method |
public function edgesAtPortOwner(portOwner:IPortOwner):Iterable
Returns an Iterable for all edges that have the given port owner as their
IEdge.targetPort's or IEdge.sourcePort's.
portOwner:IPortOwner — The port owner to check
|
Iterable —
Iterable of all adjacent edges
|
| invalidateDisplays | () | method |
public function invalidateDisplays():void
Causes the displaysInvalidated event to be triggered.
This method may be called by client code to invalidate all views of the graph
that have registerd with the displaysInvalidated event.
Views that need to be informed if non-structural changes have been made
to the graph should register with the corresponding event.
| removeBend | () | method |
public function removeBend(bend:IBend):voidRemoves the given bend instance from its edge.
The edge must be part of this graph at the time of the incovation. This will trigger the corresponding events.
Parametersbend:IBend — The bend to remove.
|
| removeEdge | () | method |
public function removeEdge(edge:IEdge):voidRemoves the given edge instance from this graph.
The edge must be a part of this graph. This will trigger the corresponding event. The implementation may decide to remove the corresponding ports from the node if no other edge connects to them after the given edge has been removed. Also this will trigger the removal of all labels and bends owned by this instance.
Parametersedge:IEdge — The live edge to be removed from this graph instance
|
| removeLabel | () | method |
public function removeLabel(label:ILabel):voidRemoves the given label from its owner.
This will trigger the corresponding event.
Parameterslabel:ILabel — The label to be removed.
|
| removeNode | () | method |
public function removeNode(node:INode):voidRemoves the given node instance from this graph.
The node must be a part of this graph. This will trigger the corresponding event. This method will remove all adjacent edges and their corresponding ports in proper order before the node will be removed. Also this will trigger the removal of all labels owned by this instance.
Parametersnode:INode — The live node to be removed from this graph instance
|
| removePort | () | method |
public function removePort(port:IPort):voidRemoves the port from its owner.
The port must be part of this graph at the time of invocation.
This will trigger the corresponding GraphEvents.
port:IPort |
| setBendLocation | () | method |
public function setBendLocation(bend:IBend, x:Number, y:Number):voidModifies the location of the given bend.
Parametersbend:IBend — The bend whose location is to be modified.
|
|
x:Number — The new x-coordinate of the bend.
|
|
y:Number — Tthe new y-coordinate of the bend.
|
| setBounds | () | method |
public function setBounds(node:INode, x:Number, y:Number, width:Number, height:Number):voidSets the bounds of the given node to the new values.
Parametersnode:INode — A live node that belongs to this graph
|
|
x:Number — The new absolute x-coordinate of the upper left corner of the node
|
|
y:Number — The new absolute y-coordinate of the upper left corner of the node
|
|
width:Number — The new width of the node
|
|
height:Number — The new height of the node
|
| setEdgeStyle | () | method |
public function setEdgeStyle(edge:IEdge, style:IEdgeStyle):voidAssigns the given style instance by reference to the edge.
Style instances can be shared.
Parametersedge:IEdge — The edge that will be assigned the new style.
|
|
style:IEdgeStyle — The style instance that will be assigned to the edge.
|
| setLabelModelParameter | () | method |
public function setLabelModelParameter(label:ILabel, parameter:ILabelModelParameter):voidSets the label model parameter for the given label.
Parameterslabel:ILabel — The label.
|
|
parameter:ILabelModelParameter — The new parameter.
|
| setLabelStyle | () | method |
public function setLabelStyle(label:ILabel, style:ILabelStyle):voidAssigns the given style instance by reference to the label.
Style instances can be shared.
Parameterslabel:ILabel — The label that will be assigned the new style.
|
|
style:ILabelStyle — The style instance that will be assigned to the label.
|
| setLabelText | () | method |
public function setLabelText(label:ILabel, text:String):voidSets the label text of the given label.
Parameterslabel:ILabel — The label to modify.
|
|
text:String — The new text of the label.
|
| setNodeStyle | () | method |
public function setNodeStyle(node:INode, style:INodeStyle):voidAssigns the given style instance by reference to the node.
Style instances can be shared.
Parametersnode:INode — The node that will be assigned the new style.
|
|
style:INodeStyle — The style instance that will be assigned to the node.
|
| setPortLocation | () | method |
public function setPortLocation(port:IPort, x:Number, y:Number):voidSets the coordinates of the given port to the given values.
Parametersport:IPort — The port to modify.
|
|
x:Number — The new x coordinate of the port.
|
|
y:Number — The new y coordinate of the port
|
| setPorts | () | method |
public function setPorts(edge:IEdge, sourcePort:IPort, targetPort:IPort):void
Sets the ports of the given edge to the new values.
This will trigger an EdgeChanged event if source or target ports differ
from the current ones. Both ports and the edge must belong to the current graph instance.
edge:IEdge — The edge to change the ports.
|
|
sourcePort:IPort — The new source port instance.
|
|
targetPort:IPort — The new target port instance.
|
| setPortStyle | () | method |
public function setPortStyle(port:IPort, style:IPortStyle):voidAssigns the given style instance by reference to the port.
Style instances can be shared.
Parametersport:IPort — The port that will be assigned the new style.
|
|
style:IPortStyle — The style instance that will be assigned to the port.
|
| setPreferredSize | () | method |
public function setPreferredSize(label:ILabel, width:Number, height:Number):voidSets the preferred size of the label.
Parameterslabel:ILabel — The label.
|
|
width:Number — The new width.
|
|
height:Number — The new height.
|
| displaysInvalidated | event |
com.yworks.graph.model.InvalidateEvent
Dispatched when invalidateDisplays was called.
| graphChanged | event |
com.yworks.graph.model.GraphEvent
Dispatched when a change to the graph structure occurs.
Use GraphEvent.kind and compare with GraphEventKind constants to
find out the nature of the event.
See also