| Package | com.yworks.graph.model |
| Interface | public interface IGraph extends ILookup, flash.events.IEventDispatcher |
| Implementors | AbstractGraphWrapper, DefaultGraph |
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 IVisualStyle
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
Gets or sets the default ILabelModelParameter that will be used for
newly created edge labels if no other parameter is specified. | IGraph | ||
| defaultEdgeLabelStyle : ILabelStyle
Gets or sets the default ILabelStyle that will be used for
newly created edge labels if no other style is specified. | IGraph | ||
| defaultEdgeStyle : IEdgeStyle
Gets or sets the default IEdgeStyle that will be used for
newly created edges if no other style is specified. | IGraph | ||
| defaultNodeLabelModelParameter : ILabelModelParameter
Gets or sets the default ILabelModelParameter that will be used for
newly created node labels if no other parameter is specified. | IGraph | ||
| defaultNodeLabelStyle : ILabelStyle
Gets or sets the default ILabelStyle that will be used for
newly created node labels if no other style is specified. | IGraph | ||
| defaultNodePortModelParameter : IPortLocationModelParameter
Gets or sets the default IPortLocationModelParameter that will be used for
newly created node ports if no other parameter is specified. | IGraph | ||
| defaultNodeSize : ISize
Gets or sets the default node size. | IGraph | ||
| defaultNodeStyle : INodeStyle
Gets or sets the default INodeStyle that will be used for
newly created nodes if no other style is specified. | IGraph | ||
| defaultPortStyle : IPortStyle
Gets or sets the default IPortStyle that will be used for
newly created ports if no other style is specified. | 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 : ICollectionModel [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
the port anchor. | IGraph | ||
Add a port to the given port owner using the model parameter to determine the coordinates of
the port. | 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 location model parameter of the given port to the given value. | 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.
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.
public function get collectionModel():ICollectionModel| defaultEdgeLabelModelParameter | property |
defaultEdgeLabelModelParameter:ILabelModelParameter
Gets or sets the default ILabelModelParameter that will be used for
newly created edge labels if no other parameter is specified.
It is up to the implementation to decide whether to assign a clone of the current parameter to newly created elements or whether the instance will be shared.
public function get defaultEdgeLabelModelParameter():ILabelModelParameter public function set defaultEdgeLabelModelParameter(value:ILabelModelParameter):void| defaultEdgeLabelStyle | property |
defaultEdgeLabelStyle:ILabelStyle
Gets or sets the default ILabelStyle that will be used for
newly created edge labels if no other style is specified.
It is up to the implementation to decide whether to assign a clone of the current style to newly created elements or whether the style instance will be shared.
public function get defaultEdgeLabelStyle():ILabelStyle public function set defaultEdgeLabelStyle(value:ILabelStyle):void| defaultEdgeStyle | property |
defaultEdgeStyle:IEdgeStyle
Gets or sets the default IEdgeStyle that will be used for
newly created edges if no other style is specified.
It is up to the implementation to decide whether to assign a clone of the current style to newly created elements or whether the style instance will be shared.
public function get defaultEdgeStyle():IEdgeStyle public function set defaultEdgeStyle(value:IEdgeStyle):void| defaultNodeLabelModelParameter | property |
defaultNodeLabelModelParameter:ILabelModelParameter
Gets or sets the default ILabelModelParameter that will be used for
newly created node labels if no other parameter is specified.
It is up to the implementation to decide whether to assign a clone of the current parameter to newly created elements or whether the instance will be shared.
public function get defaultNodeLabelModelParameter():ILabelModelParameter public function set defaultNodeLabelModelParameter(value:ILabelModelParameter):void| defaultNodeLabelStyle | property |
defaultNodeLabelStyle:ILabelStyle
Gets or sets the default ILabelStyle that will be used for
newly created node labels if no other style is specified.
It is up to the implementation to decide whether to assign a clone of the current style to newly created elements or whether the style instance will be shared.
public function get defaultNodeLabelStyle():ILabelStyle public function set defaultNodeLabelStyle(value:ILabelStyle):void| defaultNodePortModelParameter | property |
defaultNodePortModelParameter:IPortLocationModelParameter
Gets or sets the default IPortLocationModelParameter that will be used for
newly created node ports if no other parameter is specified.
It is up to the implementation to decide whether to assign a clone of the current parameter to newly created elements or whether the instance will be shared.
public function get defaultNodePortModelParameter():IPortLocationModelParameter public function set defaultNodePortModelParameter(value:IPortLocationModelParameter):void| defaultNodeSize | property |
defaultNodeSize:ISizeGets or sets the default node size.
The values of this size will be used by the createNode
and createNodeAt methods.
public function get defaultNodeSize():ISize public function set defaultNodeSize(value:ISize):void| defaultNodeStyle | property |
defaultNodeStyle:INodeStyle
Gets or sets the default INodeStyle that will be used for
newly created nodes if no other style is specified.
It is up to the implementation to decide whether to assign a clone of the current style to newly created elements or whether the style instance will be shared.
public function get defaultNodeStyle():INodeStyle public function set defaultNodeStyle(value:INodeStyle):void| defaultPortStyle | property |
defaultPortStyle:IPortStyle
Gets or sets the default IPortStyle that will be used for
newly created ports if no other style is specified.
It is up to the implementation to decide whether to assign a clone of the current style to newly created elements or whether the style instance will be shared.
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.
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.
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.
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.
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.
public function get nodes():ICollectionModel| ports | property |
ports:ICollectionModel [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.
public function get ports():ICollectionModel| 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.
Parameters
edge: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.
Parameters
item: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 the 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.
If the port owner is an INode a new IPortLocationModelParameter is created using
the model of the defaultNodePortLocationModelParameter and the specified coordinates.
This will trigger the nodeChanged or edgeChanged
event correspondingly.
Parameters
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.
|
| addPortWithParameter | () | method |
public function addPortWithParameter(portOwner:IPortOwner, modelParameter:IPortLocationModelParameter):IPortAdd a port to the given port owner using the model parameter to determine the coordinates of the port.
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.
Parameters
portOwner:IPortOwner — The owner to add the port instance to.
| |
modelParameter:IPortLocationModelParameter — The model parameter to determine the location of the port.
|
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.
Parameters
edge:IEdge — The edge whose bends will be removed.
|
| contains | () | method |
public function contains(item:IModelItem):BooleanDetermines whether this instance contains the given element.
Parameters
item: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.
Parameters
sourcePort: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 instances to which the edge will be connected. The edge will be a part of this graph after the method returns. This will trigger the corresponding events.
Parameters
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.
Parameters
bounds: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.
Parameters
x: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.
Parameters
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.
Parameters
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.
Parameters
bend: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.
Parameters
edge: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.
Parameters
label: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.
Parameters
node: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.
Parameters
port:IPort |
| setBendLocation | () | method |
public function setBendLocation(bend:IBend, x:Number, y:Number):voidModifies the location of the given bend.
Parameters
bend: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.
Parameters
node: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.
Parameters
edge: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.
Parameters
label: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.
Parameters
label: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.
Parameters
label: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.
Parameters
node: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.
Parameters
port:IPort — The port to modify.
| |
x:Number — The new x coordinate of the port.
| |
y:Number — The new y coordinate of the port
|
| setPortLocationModelParameter | () | method |
public function setPortLocationModelParameter(port:IPort, modelParameter:IPortLocationModelParameter):voidSets the location model parameter of the given port to the given value.
Parameters
port:IPort — The port to modify.
| |
modelParameter:IPortLocationModelParameter — The new location model parameter for the given 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.
Parameters
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.
Parameters
port: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.
Parameters
label:ILabel — The label.
| |
width:Number — The new width.
| |
height:Number — The new height.
|
| displaysInvalidated | Event |
com.yworks.graph.model.InvalidateEventcom.yworks.graph.model.InvalidateEvent.INVALIDATED
Dispatched when invalidateDisplays was called.
| graphChanged | Event |
com.yworks.graph.model.GraphEventcom.yworks.graph.model.GraphEvent.GRAPH_CHANGEDDispatched when a change to the graph structure occurs.
Use GraphEvent.kind and compare with GraphEventKind constants to
find out the nature of the event.
GraphEvent.GRAPH_CHANGED constant defines the value of the
type property of the event object for a graphChanged event.
See also