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
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
  
Copies an IEdgeStyle instance.
GraphCopier
  
Copies a ILabelModelParameter for a given label.
GraphCopier
  
Copies an ILabelStyle instance.
GraphCopier
  
Copies an INodeStyle instance.
GraphCopier
  
Copies an IPortStyle instance.
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

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.

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

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

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

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