See Also
Developer's Guide
Members
Constructors
Properties
Gets or sets the types of items that should be cloned for the copy operation.
By default, all types of items except tags are cloned.
Only items which implement ICloneable can be cloned by this class. If you want to clone specific items that are not ICloneable you can overwrite the respective copy method, e.g., ClipboardGraphCopier.copyTag, or do the cloning in an event listener for the corresponding copy event, e.g., ClipboardGraphCopier.onNodeCopied.
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
- sourceGraph: IGraph
- The source graph.
- targetGraph: IGraph
- The target graph.
- targetEdge: IEdge
- The target edge to add the bend to.
- sourceBend: IBend
- The source bend to copy the values from.
- offset: Point
- The offset to apply to the copied bend.
- index: number
- The index to add the bend at.
Return Value
- IBend | null
- The newly created bend or
nullif none is created.
Parameters
- type: string
- A string which represents the type of the event to register as listed in events.
- listener: function(EventArgs, this): void
- The function which will be invoked when the event is raised.
- options?: ListenerOptions
- Options which specify how the listener will be invoked.
addLabel
(sourceGraph: IGraphtargetGraph: IGraphtargetOwner: ILabelOwnersourceLabel: ILabel): ILabel | nullprotectedAdds a label to the targetOwner in the targetGraph as a copy of the sourceLabel.
addLabel
(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 | null
- The newly created label or
nullif none is created.
addPort
(sourceGraph: IGraphtargetGraph: IGraphtargetOwner: IPortOwnersourcePort: IPort): IPort | nullprotectedAdds a port to the targetOwner in the targetGraph as a copy of the sourcePort.
addPort
(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 | null
- The newly created port or
nullif none is created.
Type Parameters
T
- The type of the item to cache.
Parameters
- original: T | null
- The original item.
- copy: T | null
- 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 FoldingManager.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.Function Details
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 | null
- 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.
Function Details
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 FoldingManager.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 | null
- 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.
Function Details
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.
Parameters
- graph: IGraph
- The graph that contains the edge.
- edge: IEdge
- The edge to copy the style from.
Return Value
- IEdgeStyle
- The style to apply for the copy.
Copies the ITagOwner.tag of an IEdge.
Parameters
- edge: IEdge
- The old edge.
- tag: IEdge['tag'] | null
- The tag to copy.
Return Value
- any | null
- The copy of the tag.
Copies a ILabelModelParameter for a given label.
Parameters
- graph: IGraph
- The graph that contains the label.
- label: ILabel
- The label to copy the label model parameter from.
Return Value
- ILabelModelParameter
- The copy of the parameter to apply for the copy.
Copies an ILabelStyle instance.
Parameters
- graph: IGraph
- The graph that contains the label.
- label: ILabel
- The label to copy the style from.
Return Value
- ILabelStyle
- The style to apply for the copy.
Copies the ITagOwner.tag of an ILabel.
Parameters
- label: ILabel
- The old label.
- tag: ILabel['tag'] | null
- The tag to copy.
Return Value
- any | null
- The copy of the tag.
Copies an INodeStyle instance.
Parameters
- graph: IGraph
- The graph that contains the node.
- node: INode
- The node to copy the style from.
Return Value
- INodeStyle
- The style to apply for the copy.
Copies the ITagOwner.tag of an INode.
Parameters
- node: INode
- The old node.
- tag: INode['tag'] | null
- The tag to copy.
Return Value
- any | null
- The copy of the tag.
Copies a IPortLocationModelParameter for a given port.
Parameters
- graph: IGraph
- The graph that contains the port.
- port: IPort
- The port to copy the model parameter from.
Return Value
- IPortLocationModelParameter
- The copy of the parameter to apply for the copy.
Copies an IPortStyle instance.
Parameters
- graph: IGraph
- The graph that contains the port.
- port: IPort
- The port to copy the style from.
Return Value
- IPortStyle
- The style to apply for the copy.
Copies the ITagOwner.tag of an IPort.
Parameters
- port: IPort
- The old port.
- tag: IPort['tag'] | null
- The tag to copy.
Return Value
- any | null
- The copy of the tag.
Callback that will copy a ITagOwner.tag for the target graph.
tag if the cloneTypes property has the CloneTypes.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'] | null
- The tag to copy.
Return Value
- any | null
- A copy of the tag.
See Also
Developer's Guide
createEdge
(sourceGraph: IGraphtargetGraph: IGraphsourceEdge: IEdgetargetSourcePort: IPorttargetTargetPort: IPort): IEdge | nullprotectedAdds an edge to the targetGraph as a copy of the sourceEdge.
createEdge
(targetGraph as a copy of the sourceEdge.sourceEdge, nor should it copy IPorts or ILabels. This implementation uses copyEdgeStyle and copyEdgeTag as callbacks.Parameters
- sourceGraph: IGraph
- The source graph.
- targetGraph: IGraph
- The target graph.
- sourceEdge: IEdge
- The edge in the source graph.
- targetSourcePort: IPort
- The new source port in the target graph.
- targetTargetPort: IPort
- The new target port in the target graph.
Return Value
- IEdge | null
- The newly created edge or
nullif none is created.
Parameters
- sourceGraph: IGraph
- The source graph.
- targetGraph: IGraph
- The target graph.
- sourceGroupNode: INode
- The source node to create a copy of in the
targetGraph. - targetParent: INode | null
- The parent of the group node in the target graph.
- offset: Point
- The offset to apply to the copied node.
Return Value
- INode | null
- The newly created node or
nullif none is created.
false. Otherwise, createNode and createGroupNode are called instead.Parameters
- sourceGraph: IGraph
- The source graph.
- targetGraph: IGraph
- The target graph.
- sourceNode: INode
- The source node to create a copy of in the
targetGraph. - offset: Point
- The offset to apply to the copied node.
Return Value
- INode | null
- The newly created node or
nullif none is created.
Parameters
- sourceGraph: IGraph
- The source graph.
- targetGraph: IGraph
- The target graph.
- sourceNode: INode
- The source node to create a copy of in the
targetGraph. - targetParent: INode | null
- The parent of the group node in the target graph.
- offset: Point
- The offset to apply to the copied node.
Return Value
- INode | null
- 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.Type Parameters
T
- The type of the item to copy.
Parameters
- itemType: Constructor<T>
- The type of the item to copy.
- original: T | null
- The original item.
Return Value
- T | null
- The copy of
originalor NO_COPY if no copy has been found.
See Also
getOrCreateCopy
<T> (tType: Constructor<T>original: T | nullcopyDelegate: function(T): T): T | nullprotectedEither yields a previously cached copy for the given original or uses the copyDelegate to create the copy of the original.
getOrCreateCopy
<T> (copyDelegate to create the copy of the original.Type Parameters
T
- The type of the item to copy.
Parameters
- tType: Constructor<T>
- The type of the item to copy.
- original: T | null
- The original item.
- copyDelegate: function(T): T
- The copy delegate to create the copy.
Function Details
Encapsulates a method that has one parameters and returns a value of the type specified by theTResultparameter.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 | null
- 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 | null
- 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 | null
- The folding manager as obtained from the lookup of the graph.
Parameters
- original: IBend
- The original of the copied bend.
- copy: IBend
- The copied bend.
Parameters
- original: IEdge
- The original of the copied edge.
- copy: IEdge
- The copied edge.
Parameters
- sourceGraph: IGraph
- The source graph from which the items have been copied.
- targetGraph: IGraph
- The graph to which the items have been copied.
Parameters
- original: ILabel
- The original of the copied label.
- copy: ILabel
- The copied label.
Parameters
- original: INode
- The original of the copied node.
- copy: INode
- The copied node.
Triggers the object-copied event.
Parameters
- evt: ItemCopiedEventArgs<any>
- The event data to use.
Parameters
- original: IPort
- The original of the copied port.
- copy: IPort
- The copied port.
Parameters
- type: string
- A string which represents the type of the event to register as listed in events.
- listener: function(EventArgs, 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 GraphClipboard.toClipboardCopier (Cut/Copy) and the source graph is a folding view graph the ItemCopiedEventArgs.original<T> item is a master item, i.e. it belongs to the FoldingManager.masterGraph.
If this GraphCopier instance is used as GraphClipboard's GraphClipboard.fromClipboardCopier (Paste) and the target graph is a folding view graph the copied item is a master item, i.e. it belongs to the FoldingManager.masterGraph.
For folding edge bends, their view state representation is passed. These items are neither part of the FoldingManager.masterGraph nor the view graph.
Properties of ItemCopiedEventArgs<IBend>
- 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 GraphClipboard.toClipboardCopier (Cut/Copy) and the source graph is a folding view graph the ItemCopiedEventArgs.original<T> item is a master item, i.e. it belongs to the FoldingManager.masterGraph.
If this GraphCopier instance is used as GraphClipboard's GraphClipboard.fromClipboardCopier (Paste) and the target graph is a folding view graph the copied item is a master item, i.e. it belongs to the FoldingManager.masterGraph.
Properties of ItemCopiedEventArgs<IEdge>
- 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 GraphClipboard.toClipboardCopier (Cut/Copy) and the source graph is a folding view graph the source graph item is the FoldingManager.masterGraph of the folding view.
If this GraphCopier instance is used as GraphClipboard's GraphClipboard.fromClipboardCopier (Paste) and the target graph is a folding view graph the target graph is the FoldingManager.masterGraph of the folding view.
Properties of ItemCopiedEventArgs<IGraph>
- 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 GraphClipboard.toClipboardCopier (Cut/Copy) and the source graph is a folding view graph the ItemCopiedEventArgs.original<T> item is a master item, i.e. it belongs to the FoldingManager.masterGraph.
If this GraphCopier instance is used as GraphClipboard's GraphClipboard.fromClipboardCopier (Paste) and the target graph is a folding view graph the copied item is a master item, i.e. it belongs to the FoldingManager.masterGraph.
For folding edge or helper node labels, their view state representation is passed. These items are neither part of the FoldingManager.masterGraph nor the view graph.
Properties of ItemCopiedEventArgs<ILabel>
- 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 GraphClipboard.toClipboardCopier (Cut/Copy) and the source graph is a folding view graph the ItemCopiedEventArgs.original<T> item is a master item, i.e. it belongs to the FoldingManager.masterGraph.
If this GraphCopier instance is used as GraphClipboard's GraphClipboard.fromClipboardCopier (Paste) and the target graph is a folding view graph the copied item is a master item, i.e. it belongs to the FoldingManager.masterGraph.
Properties of ItemCopiedEventArgs<INode>
- 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.
Properties of ItemCopiedEventArgs<any>
- 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 GraphClipboard.toClipboardCopier (Cut/Copy) and the source graph is a folding view graph the ItemCopiedEventArgs.original<T> item is a master item, i.e. it belongs to the FoldingManager.masterGraph.
If this GraphCopier instance is used as GraphClipboard's GraphClipboard.fromClipboardCopier (Paste) and the target graph is a folding view graph the copied item is a master item, i.e. it belongs to the FoldingManager.masterGraph.
Properties of ItemCopiedEventArgs<IPort>
- copy: Tfinal
- Gets the copied item.
- original: Tfinal
- Gets the original of the copied item.