Packagecom.yworks.graph.model
Classpublic class DefaultGraphStructure
InheritanceDefaultGraphStructure Inheritance Object
Implements IGraphStructure

This class can be used to build a specialized DefaultGraph instance.

This class may be used as a foundation to build one's own IGraph implementation, although this should rarely be needed.

Note: Despite of its name, this is not the IGraphStructure implementation which is used by DefaultGraph.

See also

DefaultGraph
IGraph


Public Properties
 PropertyDefined By
  edges : Collection
[read-only] Gets a collection view over the edges in the graph.
DefaultGraphStructure
  nodes : Collection
[read-only] Gets a collection view over the nodes in the graph.
DefaultGraphStructure
Public Methods
 MethodDefined By
  
Creates a new instance.
DefaultGraphStructure
  
addBend(forEdge:IEdge, index:int, bend:IBend):void
Adds a bend to an edge at the given index.
DefaultGraphStructure
  
addEdge(edge:IEdge, sourcePort:IPort, targetPort:IPort):void
Adds a previously created edge to the collection of edges.
DefaultGraphStructure
  
addLabel(owner:ILabeledItem, label:ILabel):void
Adds a previously created label to its owner.
DefaultGraphStructure
  
addNode(node:INode):void
Adds a previously created node to the collection of nodes.
DefaultGraphStructure
  
addPort(node:INode, port:IPort):void
Add a previously created port to a given node.
DefaultGraphStructure
  
clearBends(edge:IEdge):void
Removes all bends from the given edge.
DefaultGraphStructure
  
containsBend(bend:IBend):Boolean
Determines whether this instance contains the specified bend.
DefaultGraphStructure
  
containsEdge(edge:IEdge):Boolean
Determines whether this instance contains the specified edge.
DefaultGraphStructure
  
containsItem(item:IModelItem):Boolean
Determines whether this instance contains the specified item.
DefaultGraphStructure
  
containsLabel(label:ILabel):Boolean
Determines whether this instance contains the specified label.
DefaultGraphStructure
  
containsNode(node:INode):Boolean
Determines whether this instance contains the specified node.
DefaultGraphStructure
  
containsPort(port:IPort):Boolean
Determines whether this instance contains the specified port.
DefaultGraphStructure
  
Delegates to createDefaultBend Creates but does not add a bend for a given edge instance.
DefaultGraphStructure
  
Delegates to createDefaultEdge to create the actual edge instance, to createBends to set the edge's bends property and to createEdgeLabelCollection to set the edge's labels property.
DefaultGraphStructure
  
Delegates to createDefaultLabel Creates a label for a given owner using the provided model parameter.
DefaultGraphStructure
  
Delegates to createDefaultNode to create the actual node instance, to createPortCollection to set the node's ports property and to createNodeLabelCollection to set the node's label property.
DefaultGraphStructure
  
Delegates to createDefaultPort Create but don't yet add a port for a given node.
DefaultGraphStructure
  
getEdgesAtPort(port:IPort, inEdges:Boolean, outEdges:Boolean):Iterable
Enumerates all edges that are incident to the given port.
DefaultGraphStructure
  
getEdgesAtPortOwner(portOwner:IPortOwner, inEdges:Boolean, outEdges:Boolean):Iterable
Enumerates all edges that are incident to ports owned by the given owner.
DefaultGraphStructure
  
removeBend(bend:IBend):void
Removes the bend from its edge.
DefaultGraphStructure
  
removeEdge(edge:IEdge):void
Remove an edge from the current set of edges.
DefaultGraphStructure
  
removeLabel(label:ILabel):void
Remove a label from its owner.
DefaultGraphStructure
  
removeNode(node:INode):void
Remove a node from the current set of nodes.
DefaultGraphStructure
  
removePort(port:IPort):void
Removes the port from its owner.
DefaultGraphStructure
  
setBendLocation(bend:IBend, x:Number, y:Number):void
Sets the Location of a bend to the specified coordinates.
DefaultGraphStructure
  
setEdgeStyle(edge:IEdge, style:IEdgeStyle):void
Associates the style with the given edge.
DefaultGraphStructure
  
Sets the label model parameter for the given label.
DefaultGraphStructure
  
setLabelStyle(label:ILabel, labelStyle:ILabelStyle):void
Associates the style with the given label.
DefaultGraphStructure
  
setLabelText(label:ILabel, text:String):void
Sets the label text for a given label to the specified text.
DefaultGraphStructure
  
setNodeStyle(node:INode, style:INodeStyle):void
Associates the style with the given node.
DefaultGraphStructure
  
Sets the location model parameter of a port.
DefaultGraphStructure
  
setPorts(edge:IEdge, sourcePort:IPort, targetPort:IPort):void
Sets the ports of the given edge to the new values.
DefaultGraphStructure
  
setPortStyle(port:IPort, style:IPortStyle):void
Associates the style with the given port.
DefaultGraphStructure
Protected Methods
 MethodDefined By
  
Factory method for an IBendList instance that holds the bends of a DefaultEdge.
DefaultGraphStructure
  
Create a DefaultBend instance for the given bend at a default location.
DefaultGraphStructure
  
Factory method for a DefaultEdge instance.
DefaultGraphStructure
  
Factory method for a DefaultLabel instance
DefaultGraphStructure
  
Factory method for DefaultNode instances
DefaultGraphStructure
  
Factory method for a DefaultPort instance.
DefaultGraphStructure
  
Factory method for an ILabelCollection instance that holds the labels of an edge.
DefaultGraphStructure
  
Factory method for an ILabelCollection instance that holds the labels of a node.
DefaultGraphStructure
  
Factory method for an IRectangle instance that determines the default layout of a node.
DefaultGraphStructure
  
Factory method for an IPortCollection instance that holds the ports of the given node.
DefaultGraphStructure
Property Detail
edgesproperty
edges:Collection  [read-only]

Gets a collection view over the edges in the graph.


Implementation
    public function get edges():Collection
nodesproperty 
nodes:Collection  [read-only]

Gets a collection view over the nodes in the graph.


Implementation
    public function get nodes():Collection
Constructor Detail
DefaultGraphStructure()Constructor
public function DefaultGraphStructure()

Creates a new instance.

Method Detail
addBend()method
public function addBend(forEdge:IEdge, index:int, bend:IBend):void

Adds a bend to an edge at the given index.

Parameters

forEdge:IEdge — The edge to add the bend to.
 
index:int — The index at which the bend is to be added.
 
bend:IBend — The bend to be added.

addEdge()method 
public function addEdge(edge:IEdge, sourcePort:IPort, targetPort:IPort):void

Adds a previously created edge to the collection of edges.

Parameters

edge:IEdge — The edge to add.
 
sourcePort:IPort — The source port of the edge.
 
targetPort:IPort — The target port of the edge.

addLabel()method 
public function addLabel(owner:ILabeledItem, label:ILabel):void

Adds a previously created label to its owner.

Parameters

owner:ILabeledItem — The item to add the label to.
 
label:ILabel — The label to add.

addNode()method 
public function addNode(node:INode):void

Adds a previously created node to the collection of nodes.

Parameters

node:INode — The node to add.

addPort()method 
public function addPort(node:INode, port:IPort):void

Add a previously created port to a given node.

Parameters

node:INode — The node.
 
port:IPort — The port that is not owned by another item.

clearBends()method 
public function clearBends(edge:IEdge):void

Removes all bends from the given edge.

Parameters

edge:IEdge — The edge to be cleared.

containsBend()method 
public function containsBend(bend:IBend):Boolean

Determines whether this instance contains the specified bend.

Parameters

bend:IBend — The bend.

Returns
Booleantrue if this graph contains the specified bend.
containsEdge()method 
public function containsEdge(edge:IEdge):Boolean

Determines whether this instance contains the specified edge.

Parameters

edge:IEdge — The edge.

Returns
Booleantrue if this graph contains the specified edge.
containsItem()method 
public function containsItem(item:IModelItem):Boolean

Determines whether this instance contains the specified item.

Parameters

item:IModelItem — The item.

Returns
Booleantrue if this graph contains the specified item.
containsLabel()method 
public function containsLabel(label:ILabel):Boolean

Determines whether this instance contains the specified label.

Parameters

label:ILabel — The label.

Returns
Booleantrue if this graph contains the specified label.
containsNode()method 
public function containsNode(node:INode):Boolean

Determines whether this instance contains the specified node.

Parameters

node:INode — The node.

Returns
Booleantrue if this graph contains the specified node.
containsPort()method 
public function containsPort(port:IPort):Boolean

Determines whether this instance contains the specified port.

Parameters

port:IPort — The port.

Returns
Booleantrue if this graph contains the specified port.
createBend()method 
public function createBend(forEdge:IEdge):IBend

Delegates to createDefaultBend Creates but does not add a bend for a given edge instance.

Parameters

forEdge:IEdge — The edge to add the bend to.

Returns
IBend — A newly created bend.

See also

createBends()method 
protected function createBends():IBendList

Factory method for an IBendList instance that holds the bends of a DefaultEdge.

Returns
IBendList — The bends of a DefaultEdge.
createDefaultBend()method 
protected function createDefaultBend(forEdge:IEdge):DefaultBend

Create a DefaultBend instance for the given bend at a default location.

Parameters

forEdge:IEdge

Returns
DefaultBend — a new DefaultBend

See also

createDefaultEdge()method 
protected function createDefaultEdge():DefaultEdge

Factory method for a DefaultEdge instance.

Returns
DefaultEdge — A new DefaultEdge instance.
createDefaultLabel()method 
protected function createDefaultLabel(owner:ILabeledItem, parameter:ILabelModelParameter):DefaultLabel

Factory method for a DefaultLabel instance

Parameters

owner:ILabeledItem — The owner to create a label for.
 
parameter:ILabelModelParameter — The label model parameters of the label to be created.

Returns
DefaultLabel

See also

createDefaultNode()method 
protected function createDefaultNode():DefaultNode

Factory method for DefaultNode instances

Returns
DefaultNode — a new DefaultNode instances
createDefaultPort()method 
protected function createDefaultPort(forNode:INode):DefaultPort

Factory method for a DefaultPort instance.

Parameters

forNode:INode — The node to create a port instance for.

Returns
DefaultPort — A new DefaultPort instance.

See also

createEdge()method 
public function createEdge():IEdge

Delegates to createDefaultEdge to create the actual edge instance, to createBends to set the edge's bends property and to createEdgeLabelCollection to set the edge's labels property. Callback factory method that creates an IEdge implementation.

Implementations may not add the instance to the collection until the addEdge method is invoked.

Returns
IEdge — A non-live edge instance

See also

createEdgeLabelCollection()method 
protected function createEdgeLabelCollection(owner:IEdge):ILabelCollection

Factory method for an ILabelCollection instance that holds the labels of an edge.

Parameters

owner:IEdge — The edge to create a label collection for.

Returns
ILabelCollection — The labels of the edge.
createLabel()method 
public function createLabel(owner:ILabeledItem, parameter:ILabelModelParameter):ILabel

Delegates to createDefaultLabel Creates a label for a given owner using the provided model parameter.

Parameters

owner:ILabeledItem — The owner.
 
parameter:ILabelModelParameter — The model parameter.

Returns
ILabel — A newly created label.

See also

createNode()method 
public function createNode():INode

Delegates to createDefaultNode to create the actual node instance, to createPortCollection to set the node's ports property and to createNodeLabelCollection to set the node's label property. Callback factory method that creates an INode implementation.

Implementations may not add the instance to the collection until the addNode method is invoked.

Returns
INode — A non-live node instance

See also

createNodeLabelCollection()method 
protected function createNodeLabelCollection(owner:INode):ILabelCollection

Factory method for an ILabelCollection instance that holds the labels of a node.

Parameters

owner:INode — A node instance to create the label collection for.

Returns
ILabelCollection — the labels of the node.
createNodeLayout()method 
protected function createNodeLayout():IRectangle

Factory method for an IRectangle instance that determines the default layout of a node.

Returns
IRectangle — the rectangle that defines the default layout of a node.
createPort()method 
public function createPort(forNode:INode):IPort

Delegates to createDefaultPort Create but don't yet add a port for a given node.

Parameters

forNode:INode

Returns
IPort — A newly created port.

See also

createPortCollection()method 
protected function createPortCollection(owner:INode):IPortCollection

Factory method for an IPortCollection instance that holds the ports of the given node.

Parameters

owner:INode — A node to create the port collection for.

Returns
IPortCollection

See also

getEdgesAtPort()method 
public function getEdgesAtPort(port:IPort, inEdges:Boolean, outEdges:Boolean):Iterable

Enumerates all edges that are incident to the given port.

Parameters

port:IPort — The port.
 
inEdges:Boolean — Whether to yield edges whose target port is connected to the portOwner.
 
outEdges:Boolean — Whether to yield edges whose source port is connected to the portOwner.

Returns
Iterable — An iterable that yields the adjacent edges.
getEdgesAtPortOwner()method 
public function getEdgesAtPortOwner(portOwner:IPortOwner, inEdges:Boolean, outEdges:Boolean):Iterable

Enumerates all edges that are incident to ports owned by the given owner.

Parameters

portOwner:IPortOwner — The item that owns the ports.
 
inEdges:Boolean — Whether to yield edges whose target port is connected to the portOwner.
 
outEdges:Boolean — Whether to yield edges whose source port is connected to the portOwner.

Returns
Iterable — An iterable that yields the adjacent edges.
removeBend()method 
public function removeBend(bend:IBend):void

Removes the bend from its edge.

Parameters

bend:IBend — The bend.

removeEdge()method 
public function removeEdge(edge:IEdge):void

Remove an edge from the current set of edges.

Parameters

edge:IEdge — The edge to remove.

removeLabel()method 
public function removeLabel(label:ILabel):void

Remove a label from its owner.

Parameters

label:ILabel — The label to remove.

removeNode()method 
public function removeNode(node:INode):void

Remove a node from the current set of nodes.

Parameters

node:INode — The node to remove.

removePort()method 
public function removePort(port:IPort):void

Removes the port from its owner.

Parameters

port:IPort — The port to be removed.

setBendLocation()method 
public function setBendLocation(bend:IBend, x:Number, y:Number):void

Sets the Location of a bend to the specified coordinates.

Parameters

bend:IBend — The bend to which the location is to be set.
 
x:Number — the x coordinate to be set.
 
y:Number — The y coordinate to be set.

setEdgeStyle()method 
public function setEdgeStyle(edge:IEdge, style:IEdgeStyle):void

Associates the style with the given edge.

Parameters

edge:IEdge — The edge to associate the style with.
 
style:IEdgeStyle — The new style instance.

setLabelModelParameter()method 
public function setLabelModelParameter(label:ILabel, parameter:ILabelModelParameter):void

Sets 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, labelStyle:ILabelStyle):void

Associates the style with the given label.

Parameters

label:ILabel — The label to associate the style with.
 
labelStyle:ILabelStyle — The new style instance.

setLabelText()method 
public function setLabelText(label:ILabel, text:String):void

Sets the label text for a given label to the specified text.

Parameters

label:ILabel — The label.
 
text:String — The text.

setNodeStyle()method 
public function setNodeStyle(node:INode, style:INodeStyle):void

Associates the style with the given node.

Parameters

node:INode — The node to associate the style with.
 
style:INodeStyle — The new style instance.

setPortLocationModelParameter()method 
public function setPortLocationModelParameter(port:IPort, modelParameter:IPortLocationModelParameter):void

Sets the location model parameter of a port.

Parameters

port:IPort — The port to which the parameter shall be assigned.
 
modelParameter:IPortLocationModelParameter — The parameter to assign to 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. Both ports and the edge are already live in this graph.

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):void

Associates the style with the given port.

Parameters

port:IPort — The port to associate the style with.
 
style:IPortStyle — The new style instance.