Packagecom.yworks.graph.model
Classpublic class GraphCopier
InheritanceGraphCopier Inheritance Object

Utility class that copies parts of an IGraph to another instance.

Instances of this class can be used in GraphClipboard, e.g.



Public Properties
 PropertyDefined By
  copyGrouping : Boolean
Determines whether grouping information should be copied to IGroupedGraph target graphs.
GraphCopier
  copyViewStates : Boolean
Gets or sets a property that determines whether additional view states.
GraphCopier
  copyZOrders : Boolean
Gets or sets a property that determines whether z-order information should be copied to target graphs.
GraphCopier
Public Methods
 MethodDefined By
  
copy(sourceGraph:IGraph, filter:Function, targetGraph:IGraph, elementCopiedDelegate:Function, targetRoot:INode = null):void
Copies a subgraph described by a predicate function from the sourceGraph to the targetGraph.
GraphCopier
  
copyBendTag(bend:IBend):Object
Copies the user tag of a given bend.
GraphCopier
  
Copies an IEdgeStyle instance.
GraphCopier
  
copyEdgeTag(edge:IEdge):Object
Copies the user tag of a given edge.
GraphCopier
  
Copies a ILabelModelParameter for a given label.
GraphCopier
  
Copies an ILabelStyle instance.
GraphCopier
  
copyLabelTag(label:ILabel):Object
Copies the user tag of a given label.
GraphCopier
  
Copies an INodeStyle instance.
GraphCopier
  
copyNodeTag(node:INode):Object
Copies the user tag of a given node.
GraphCopier
  
Copies an IPortStyle instance.
GraphCopier
  
copyPortTag(port:IPort):Object
Copies the user tag of a given port.
GraphCopier
Property Detail
copyGroupingproperty
copyGrouping:Boolean

Determines whether grouping information should be copied to IGroupedGraph target graphs.

The default value is true.


Implementation
    public function get copyGrouping():Boolean
    public function set copyGrouping(value:Boolean):void
copyViewStatesproperty 
copyViewStates:Boolean

Gets or sets a property that determines whether additional view states. Should be copied to target graphs.

If the source and target graphs have an instance of FoldingManager in their lookup, the additional dummy view states of the nodes and edges will be copied.

The default value is true.


Implementation
    public function get copyViewStates():Boolean
    public function set copyViewStates(value:Boolean):void

See also

copyZOrdersproperty 
copyZOrders:Boolean

Gets or sets a property that determines whether z-order information should be copied to target graphs.

If the source and target graphs have an instance of IZOrderSupport in their lookup, the z-order information of copied model items will be copied as well.

The default value is true.


Implementation
    public function get copyZOrders():Boolean
    public function set copyZOrders(value:Boolean):void

See also

Method Detail
copy()method
public function copy(sourceGraph:IGraph, filter:Function, targetGraph:IGraph, elementCopiedDelegate:Function, targetRoot:INode = null):void

Copies a subgraph described by a predicate function from the sourceGraph to the targetGraph.

Parameters

sourceGraph:IGraph — The graph to copy the elements from.
 
filter:Function — The filter that decides which elements to copy: a function which takes a IModelItem as parameter and returns true if the item should be copied.
 
targetGraph:IGraph — The graph to copy the elements to.
 
elementCopiedDelegate:Function — A delegate to invoke for each element being copied.
 
targetRoot:INode (default = null) — The group node that should act as the root node for the pasted elements. May be null if there is no such node.

copyBendTag()method 
public function copyBendTag(bend:IBend):Object

Copies the user tag of a given bend.

If the tag implements ICloneable a clone of the tag will be returned. Otherwise, the tag itself will be returned.

Parameters

bend:IBend — The bend to copy the tag from.

Returns
Object — The tag. A clone of the original if the tag implements ICloneable.

See also

copyEdgeStyle()method 
public function copyEdgeStyle(graph:IGraph, edge:IEdge):IEdgeStyle

Copies an IEdgeStyle instance.

This implementation uses the ICloneable.clone() method to create the copy.

Parameters

graph:IGraph — The graph that contains the edge.
 
edge:IEdge — The edge to copy the style from.

Returns
IEdgeStyle — The style to apply for the copy.

See also

copyEdgeTag()method 
public function copyEdgeTag(edge:IEdge):Object

Copies the user tag of a given edge.

If the tag implements ICloneable a clone of the tag will be returned. Otherwise, the tag itself will be returned.

Parameters

edge:IEdge — The edge to copy the tag from.

Returns
Object — The tag. A clone of the original if the tag implements ICloneable.

See also

copyLabelModelParameter()method 
public function copyLabelModelParameter(graph:IGraph, label:ILabel):ILabelModelParameter

Copies a ILabelModelParameter for a given label.

This implementation uses the ICloneable.Clone method to create a copy.

Parameters

graph:IGraph — The graph that contains the label.
 
label:ILabel — The label to copy the label model parameter from.

Returns
ILabelModelParameter — The copy of the parameter to apply for the copy.

See also

copyLabelStyle()method 
public function copyLabelStyle(graph:IGraph, label:ILabel):ILabelStyle

Copies an ILabelStyle instance.

This implementation uses the ICloneable.clone() method to create a copy.

Parameters

graph:IGraph — The graph that contains the label.
 
label:ILabel — The label to copy the style from.

Returns
ILabelStyle — The style to apply for the copy.

See also

copyLabelTag()method 
public function copyLabelTag(label:ILabel):Object

Copies the user tag of a given label.

If the tag implements ICloneable a clone of the tag will be returned. Otherwise, the tag itself will be returned.

Parameters

label:ILabel — The label to copy the tag from.

Returns
Object — The tag. A clone of the original if the tag implements ICloneable.

See also

copyNodeStyle()method 
public function copyNodeStyle(graph:IGraph, node:INode):INodeStyle

Copies an INodeStyle instance.

This implementation uses the ICloneable.clone() method to create a copy.

Parameters

graph:IGraph — The graph that contains the node.
 
node:INode — The node to copy the style from.

Returns
INodeStyle — The style to apply for the copy.

See also

copyNodeTag()method 
public function copyNodeTag(node:INode):Object

Copies the user tag of a given node.

If the tag implements ICloneable a clone of the tag will be returned. Otherwise, the tag itself will be returned.

Parameters

node:INode — The node to copy the tag from.

Returns
Object — The tag. A clone of the original if the tag implements ICloneable.

See also

copyPortStyle()method 
public function copyPortStyle(graph:IGraph, port:IPort):IPortStyle

Copies an IPortStyle instance.

This implementation uses the ICloneable.clone() method to create a copy.

Parameters

graph:IGraph — The graph that contains the port.
 
port:IPort — The port to copy the style from.

Returns
IPortStyle — The style to apply for the copy.

See also

copyPortTag()method 
public function copyPortTag(port:IPort):Object

Copies the user tag of a given port.

If the tag implements ICloneable a clone of the tag will be returned. Otherwise, the tag itself will be returned.

Parameters

port:IPort — The port to copy the tag from.

Returns
Object — The tag. A clone of the original if the tag implements ICloneable.

See also