See Also
Developer's Guide
Members
Constructors
Creates a new instance of an GraphCopier with the default settings.
Parameters
Properties
Gets or sets the types of items that should be cloned for the copy operation.
Property Value
See Also
Developer's Guide
Gets or sets a property that determines whether additional folding states should be copied to target graphs.
true.See Also
Developer's Guide
With this property set to false the GraphCopier can be used to flatten a grouped graph, i.e. remove the grouping information.
The default is true.
See Also
Developer's Guide
Gets or sets the types of objects where the referential identity should be kept across clipboard operations.
For each of the types that are set via this property, this implementation will use a caching copy mechanism as follows: If there has already been an instance copied via this clipboard (getCopy), that instance will instead be returned, otherwise, this implementation will clone the original instance (depending on the setting of cloneTypes) and cache the copy until after the operation the cache is cleared. This feature is implemented directly by the various CopyXXX methods.
Let's say nodes n1 and n2 share the same style instance s1. Then its copies share the same style instance s2 which is, however, another reference than the original s1.
By default, this is enabled for all types.
Property Value
See Also
Developer's Guide
API
- getOrCreateCopy
Methods
Parameters
- type: string
- A string which represents the type of the event to register as listed in events.
- listener: function(evt:EventArgs, sender:this): void
- The function which will be invoked when the event is raised.
- options?: ListenerOptions
- Options which specify how the listener will be invoked.
Adds a label to the targetOwner in the targetGraph as a copy of the sourceLabel.
targetOwner in the targetGraph as a copy of the sourceLabel.Parameters
- sourceGraph: IGraph
- The source graph.
- targetGraph: IGraph
- The target graph.
- targetOwner: ILabelOwner
- The item owner in the target graph to add the label to.
- sourceLabel: ILabel
- The source label in the source graph.
Return Value
- ILabel
- The newly created label or
nullif none is created.
Adds a port to the targetOwner in the targetGraph as a copy of the sourcePort.
targetOwner in the targetGraph as a copy of the sourcePort.sourcePort. This implementation uses copyPortLocationParameter, copyPortStyle, and copyPortTag as callbacks.Parameters
- sourceGraph: IGraph
- The source graph.
- targetGraph: IGraph
- The target graph.
- targetOwner: IPortOwner
- The port owner in the target graph to add the port to.
- sourcePort: IPort
- The source port in the source graph.
Return Value
- IPort
- The newly created port or
nullif none is created.
Parameters
- original: T
- The original item.
- copy: T
- The copy of the item.
See Also
Clears the cache for the cached copies of the instance copied using this class.
For each item that has been copied, the itemCopiedCallback will be invoked.
If sourceGraph is a folding-enabled graph, only the currently visible view is copied.
sourceGraph and targetGraph must be a masterGraph. Furthermore, folding must be enabled on both graphs.Parameters
- sourceGraph: IGraph
- The graph to copy the items from.
- targetGraph: IGraph
- The graph to copy the items to.
- copyPredicate: function(IModelItem): boolean
- A predicate function which gets a model item and returns
trueif the given item should be copied.Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.Parameters- obj: IModelItem
- The object to compare against the criteria defined within the method represented by this delegate.
Return Value- boolean
trueif obj meets the criteria defined within the method represented by this delegate; otherwise,false.
- targetRootNode?: INode
- The group node that should act as the root node for the pasted items. May be
nullif there is no such node. - offset?: Point
- The offset to apply to the copied items. Only nodes and bends will be offset explicitly, while other items will move implicitly.
- itemCopiedCallback?: function(IModelItem, IModelItem): void
- A delegate to invoke for each item being copied.Callback delegate used by GraphCopier, ClipboardGraphCopier, and the like.Parameters
- original: IModelItem
- The element that has been copied.
- copy: IModelItem
- The copy of the original element.
Throws
- Exception ({ name: 'ArgumentError' })
- if
targetRootNodeis not intargetGraph
For each item that has been copied, the itemCopiedCallback will be invoked.
If sourceGraph is a folding-enabled graph, only the currently visible view is copied.
itemsToCopy contains an item instance multiple times, this method will create multiple copies of that item in targetGraph.sourceGraph and targetGraph must be a masterGraph. Furthermore, folding must be enabled on both graphs.Parameters
- sourceGraph: IGraph
- The graph to copy the items from.
- targetGraph: IGraph
- The graph to copy the items to.
- itemsToCopy?: IEnumerable<IModelItem>conversion
- The items to copy. If
null, the entiresourceGraphis copied. - targetRootNode?: INode
- The group node that should act as the root node for the pasted items. May be
nullif there is no such node. - itemOffset?: Point
- The offset to apply to the copied items. Only nodes and bends will be offset explicitly, while other items will move implicitly.
- itemCopiedCallback?: function(IModelItem, IModelItem): void
- A delegate to invoke for each item being copied.Callback delegate used by GraphCopier, ClipboardGraphCopier, and the like.Parameters
- original: IModelItem
- The element that has been copied.
- copy: IModelItem
- The copy of the original element.
Throws
- Exception ({ name: 'ArgumentError' })
- if
targetRootNodeis not intargetGraph
See Also
Developer's Guide
Copies an IEdgeStyle instance.
Return Value
- IEdgeStyle
- The style to apply for the copy.
Copies a ILabelModelParameter for a given label.
Parameters
Return Value
- ILabelModelParameter
- The copy of the parameter to apply for the copy.
Copies an ILabelStyle instance.
Parameters
Return Value
- ILabelStyle
- The style to apply for the copy.
Copies an INodeStyle instance.
Return Value
- INodeStyle
- The style to apply for the copy.
Copies a IPortLocationModelParameter for a given port.
Parameters
Return Value
- IPortLocationModelParameter
- The copy of the parameter to apply for the copy.
Copies an IPortStyle instance.
Return Value
- IPortStyle
- The style to apply for the copy.
Callback that will copy a tag for the target graph.
tag if the cloneTypes property has the TAGS flag set. If this is not the case or the tag is not ICloneable, the instance will be returned.Parameters
- owner: IModelItem
- The old owner of the tag.
- tag: IModelItem['tag']
- The tag to copy.
Return Value
- any
- A copy of the tag.
sourceEdge, nor should it copy IPorts or ILabels. This implementation uses copyEdgeStyle and copyEdgeTag as callbacks.Parameters
Return Value
- IEdge
- The newly created edge or
nullif none is created.
Parameters
Return Value
- INode
- The newly created node or
nullif none is created.
false. Otherwise, createNode and createGroupNode are called instead.Parameters
Return Value
- INode
- The newly created node or
nullif none is created.
Parameters
Return Value
- INode
- The newly created node or
nullif none is created.
Tries to obtain a previously cached copy for the given original.
null is a valid return value that is the copied value of the original.Parameters
- itemType: Constructor<T>
- The type of the item to copy.
- original: T
- The original item.
Return Value
- T
- The copy of
originalor NO_COPY if no copy has been found.
See Also
Either yields a previously cached copy for the given original or uses the copyDelegate to create the copy of the original.
copyDelegate to create the copy of the original.Parameters
- tType: Constructor<T>
- The type of the item to copy.
- original: T
- The original item.
- copyDelegate: function(T): T
- The copy delegate to create the copy.Encapsulates a method that has one parameters and returns a value of the type specified by the
TResultparameter.Parameters- arg: T
- The parameter of the method that this delegate encapsulates.
Return Value- T
- The return value of the method that this delegate encapsulates.
Return Value
- T
- A copy of the original, either cached, or newly created and then cached.
Retrieves the FoldingManager from the given source graph.
Parameters
- sourceGraph: IGraph
- The source graph.
Return Value
- FoldingManager
- The folding manager as obtained from the lookup of the graph.
Retrieves the FoldingManager from the given target graph.
Parameters
- targetGraph: IGraph
- The target graph.
Return Value
- FoldingManager
- The folding manager as obtained from the lookup of the graph.
Triggers the object-copied event.
Parameters
- evt: ItemCopiedEventArgs<any>
- The event argument to use.
Parameters
- type: string
- A string which represents the type of the event to register as listed in events.
- listener: function(evt:EventArgs, sender:this): void
- The function which will be invoked when the event is raised.
- options?: ListenerOptions
- Options which specify how the listener will be invoked.
Events
Occurs after a bend has been copied.
This event is dispatched after the item copied callback has been executed.
If this GraphCopier instance is used as GraphClipboard's toClipboardCopier (Cut/Copy) and the source graph is a folding view graph the original item is a master item, i.e. it belongs to the masterGraph.
If this GraphCopier instance is used as GraphClipboard's fromClipboardCopier (Paste) and the target graph is a folding view graph the copied item is a master item, i.e. it belongs to the masterGraph.
For folding edge bends, their view state representation is passed. These items are neither part of the masterGraph nor the view graph.
- copy: Tfinal
- Gets the copied item.
- original: Tfinal
- Gets the original of the copied item.
Occurs after an edge has been copied.
This event is dispatched after the item copied callback has been executed.
If this GraphCopier instance is used as GraphClipboard's toClipboardCopier (Cut/Copy) and the source graph is a folding view graph the original item is a master item, i.e. it belongs to the masterGraph.
If this GraphCopier instance is used as GraphClipboard's fromClipboardCopier (Paste) and the target graph is a folding view graph the copied item is a master item, i.e. it belongs to the masterGraph.
- copy: Tfinal
- Gets the copied item.
- original: Tfinal
- Gets the original of the copied item.
Occurs after the entire graph has been copied.
If this GraphCopier instance is used as GraphClipboard's toClipboardCopier (Cut/Copy) and the source graph is a folding view graph the source graph item is the masterGraph of the folding view.
If this GraphCopier instance is used as GraphClipboard's fromClipboardCopier (Paste) and the target graph is a folding view graph the target graph is the masterGraph of the folding view.
- copy: Tfinal
- Gets the copied item.
- original: Tfinal
- Gets the original of the copied item.
Occurs after a label has been copied.
This event is dispatched after the item copied callback has been executed.
If this GraphCopier instance is used as GraphClipboard's toClipboardCopier (Cut/Copy) and the source graph is a folding view graph the original item is a master item, i.e. it belongs to the masterGraph.
If this GraphCopier instance is used as GraphClipboard's fromClipboardCopier (Paste) and the target graph is a folding view graph the copied item is a master item, i.e. it belongs to the masterGraph.
For folding edge or helper node labels, their view state representation is passed. These items are neither part of the masterGraph nor the view graph.
- copy: Tfinal
- Gets the copied item.
- original: Tfinal
- Gets the original of the copied item.
Occurs after a node has been copied.
This event is dispatched after the item copied callback has been executed.
If this GraphCopier instance is used as GraphClipboard's toClipboardCopier (Cut/Copy) and the source graph is a folding view graph the original item is a master item, i.e. it belongs to the masterGraph.
If this GraphCopier instance is used as GraphClipboard's fromClipboardCopier (Paste) and the target graph is a folding view graph the copied item is a master item, i.e. it belongs to the masterGraph.
- copy: Tfinal
- Gets the copied item.
- original: Tfinal
- Gets the original of the copied item.
Occurs after a style or tag has been copied.
This event is triggered for all minor objects the graph items are made up of, e.g. the styles and tags.
This event will not be triggered for the graph items themselves and will not be triggered if the object reference is reused, i.e. it will only be triggered if the old and new references actually differ.
- copy: Tfinal
- Gets the copied item.
- original: Tfinal
- Gets the original of the copied item.
Occurs after a port has been copied.
This event is dispatched after the item copied callback has been executed.
If this GraphCopier instance is used as GraphClipboard's toClipboardCopier (Cut/Copy) and the source graph is a folding view graph the original item is a master item, i.e. it belongs to the masterGraph.
If this GraphCopier instance is used as GraphClipboard's fromClipboardCopier (Paste) and the target graph is a folding view graph the copied item is a master item, i.e. it belongs to the masterGraph.
- copy: Tfinal
- Gets the copied item.
- original: Tfinal
- Gets the original of the copied item.