public class GraphCopier extends Object
IGraph
to another instance.
Instances of this class can be used in GraphClipboard
, e.g.
Modifier and Type | Class and Description |
---|---|
static class |
GraphCopier.CloneTypes
|
Constructor and Description |
---|
GraphCopier() |
Modifier and Type | Method and Description |
---|---|
protected IBend |
addBend(IGraph sourceGraph,
IGraph targetGraph,
IEdge targetEdge,
IBend sourceBend,
PointD offset,
int index)
Callback method that adds a bend to the targetEdge in the targetGraph as a copy of the source bend.
|
void |
addBendCopiedListener(IEventHandler<ItemCopiedEventArgs<IBend>> bendCopiedEvent)
Adds the given listener for the
BendCopied event that occurs after a bend has been copied. |
void |
addEdgeCopiedListener(IEventHandler<ItemCopiedEventArgs<IEdge>> edgeCopiedEvent)
Adds the given listener for the
EdgeCopied event that occurs after an edge has been copied. |
void |
addGraphCopiedListener(IEventHandler<ItemCopiedEventArgs<IGraph>> graphCopiedEvent)
Adds the given listener for the
GraphCopied event that occurs after the entire graph has been copied. |
protected ILabel |
addLabel(IGraph sourceGraph,
IGraph targetGraph,
ILabelOwner targetOwner,
ILabel sourceLabel)
Callback method that adds a label to the target item in the targetGraph as a copy of the source label.
|
void |
addLabelCopiedListener(IEventHandler<ItemCopiedEventArgs<ILabel>> labelCopiedEvent)
Adds the given listener for the
LabelCopied event that occurs after a label has been copied. |
void |
addNodeCopiedListener(IEventHandler<ItemCopiedEventArgs<INode>> nodeCopiedEvent)
Adds the given listener for the
NodeCopied event that occurs after a node has been copied. |
void |
addObjectCopiedListener(IEventHandler<ItemCopiedEventArgs<Object>> objectCopiedEvent)
Adds the given listener for the
ObjectCopied event that occurs after a style has been copied. |
protected IPort |
addPort(IGraph sourceGraph,
IGraph targetGraph,
IPortOwner targetOwner,
IPort sourcePort)
Callback method that adds a port to the targetPortOwner in the targetGraph as a copy of the source port.
|
void |
addPortCopiedListener(IEventHandler<ItemCopiedEventArgs<IPort>> portCopiedEvent)
Adds the given listener for the
PortCopied event that occurs after a port has been copied. |
protected <T> void |
cacheCopy(T original,
T copy)
This method places the given copy into an internal cache.
|
protected void |
clearCopyCache()
Clears the cache for the
cached copies of the instance copied using this class. |
void |
copy(IGraph sourceGraph,
IGraph targetGraph)
Copies
sourceGraph to targetGraph . |
void |
copy(IGraph sourceGraph,
Predicate<IModelItem> filter,
IGraph targetGraph,
INode targetRootNode,
PointD offset,
IElementCopiedCallback elementCopiedCallback)
|
void |
copy(IGraph sourceGraph,
Predicate<IModelItem> filter,
IGraph targetGraph,
PointD offset,
IElementCopiedCallback elementCopiedCallback)
|
protected IEdge |
copyEdge(IGraph sourceGraph,
IGraph targetGraph,
IEdge sourceEdge,
IPort targetSourcePort,
IPort targetTargetPort)
Callback method that adds an edge to the targetGraph as a copy of the source edge.
|
IEdgeStyle |
copyEdgeStyle(IGraph graph,
IEdge edge)
Copies an
IEdgeStyle instance. |
protected Object |
copyEdgeTag(IEdge edge,
Object tag)
|
protected INode |
copyGroupNode(IGraph sourceGraph,
IGraph targetGraph,
INode sourceGroupNode,
INode targetParent,
PointD offset)
Callback method that creates a copy of the
sourceGroupNode in the targetGraph . |
ILabelModelParameter |
copyLabelLayoutParameter(IGraph graph,
ILabel label)
Copies a
ILabelModelParameter for a given label. |
ILabelStyle |
copyLabelStyle(IGraph graph,
ILabel label)
Copies an
ILabelStyle instance. |
protected Object |
copyLabelTag(ILabel label,
Object tag)
|
protected INode |
copyNode(IGraph sourceGraph,
IGraph targetGraph,
INode node,
INode targetParent,
PointD offset)
Callback method that creates a copy of the
node in the targetGraph . |
protected INode |
copyNode(IGraph sourceGraph,
IGraph targetGraph,
INode node,
PointD offset)
Callback method that creates a copy of the
node in the targetGraph . |
INodeStyle |
copyNodeStyle(IGraph graph,
INode node)
Copies an
INodeStyle instance. |
protected Object |
copyNodeTag(INode node,
Object tag)
|
IPortLocationModelParameter |
copyPortLocationParameter(IGraph graph,
IPort port)
Copies a
IPortLocationModelParameter for a given port. |
IPortStyle |
copyPortStyle(IGraph graph,
IPort port)
Copies an
IPortStyle instance. |
protected Object |
copyPortTag(IPort port,
Object tag)
|
protected Object |
copyTag(IModelItem owner,
Object tag)
Callback that will copy a
Tag for the target graph. |
GraphCopier.CloneTypes |
getClone()
Gets the types of items that should be
cloned for the copy operation. |
protected <T> boolean |
getCopy(Class<T> tType,
T original,
com.yworks.yfiles.utils.ObjectReference<T> copy)
Tries to obtain a previously
cached copy for the given original. |
<T> T |
getOrCreateCopy(Class<T> tType,
T original,
Function<T,T> copyDelegate)
Convenience method that either yields a previously
cached copy for the given original
or uses the copyDelegate to create the copy of the original. |
GraphCopier.CloneTypes |
getReferentialIdentityTypes()
Gets the types of objects where the referential identity should be kept across clipboard operations.
|
protected FoldingManager |
getSourceFoldingManager(IGraph sourceGraph)
Callback method that retrieves the
FoldingManager from the given source graph. |
protected FoldingManager |
getTargetFoldingManager(IGraph targetGraph)
Callback method that retrieves the
FoldingManager from the given target graph. |
boolean |
isFoldingStateCopyingEnabled()
Gets a property that determines whether
additional folding states . |
boolean |
isHierarchyCopyingEnabled()
Gets a property that determines whether grouping information should be copied to target graphs.
|
protected void |
onBendCopied(IBend original,
IBend copy)
Called after a bend has been copied.
|
protected void |
onEdgeCopied(IEdge original,
IEdge copy)
Called after an edge has been copied.
|
protected void |
onGraphCopied(IGraph sourceGraph,
IGraph targetGraph)
Called after the entire graph has been copied.
|
protected void |
onLabelCopied(ILabel original,
ILabel copy)
Called after a label has been copied.
|
protected void |
onNodeCopied(INode original,
INode copy)
Called after a node has been copied.
|
protected void |
onObjectCopied(ItemCopiedEventArgs<Object> itemCopiedEventArgs)
Emits the
ObjectCopied event. |
protected void |
onPortCopied(IPort original,
IPort copy)
Called after a port has been copied.
|
void |
removeBendCopiedListener(IEventHandler<ItemCopiedEventArgs<IBend>> bendCopiedEvent)
Removes the given listener for the
BendCopied event that occurs after a bend has been copied. |
void |
removeEdgeCopiedListener(IEventHandler<ItemCopiedEventArgs<IEdge>> edgeCopiedEvent)
Removes the given listener for the
EdgeCopied event that occurs after an edge has been copied. |
void |
removeGraphCopiedListener(IEventHandler<ItemCopiedEventArgs<IGraph>> graphCopiedEvent)
Removes the given listener for the
GraphCopied event that occurs after the entire graph has been copied. |
void |
removeLabelCopiedListener(IEventHandler<ItemCopiedEventArgs<ILabel>> labelCopiedEvent)
Removes the given listener for the
LabelCopied event that occurs after a label has been copied. |
void |
removeNodeCopiedListener(IEventHandler<ItemCopiedEventArgs<INode>> nodeCopiedEvent)
Removes the given listener for the
NodeCopied event that occurs after a node has been copied. |
void |
removeObjectCopiedListener(IEventHandler<ItemCopiedEventArgs<Object>> objectCopiedEvent)
Removes the given listener for the
ObjectCopied event that occurs after a style has been copied. |
void |
removePortCopiedListener(IEventHandler<ItemCopiedEventArgs<IPort>> portCopiedEvent)
Removes the given listener for the
PortCopied event that occurs after a port has been copied. |
void |
setClone(GraphCopier.CloneTypes value)
Sets the types of items that should be
cloned for the copy operation. |
void |
setFoldingStateCopyingEnabled(boolean value)
Sets a property that determines whether
additional folding states . |
void |
setHierarchyCopyingEnabled(boolean value)
Sets a property that determines whether grouping information should be copied to target graphs.
|
void |
setReferentialIdentityTypes(GraphCopier.CloneTypes value)
Sets the types of objects where the referential identity should be kept across clipboard operations.
|
protected IBend addBend(IGraph sourceGraph, IGraph targetGraph, IEdge targetEdge, IBend sourceBend, PointD offset, int index)
sourceGraph
- The source graph.targetGraph
- The target graph.targetEdge
- The target edge to add the bend to.sourceBend
- The source bend to copy the values from.offset
- The offset to apply to the copied bend.index
- The index to add the bend at.public final void addBendCopiedListener(IEventHandler<ItemCopiedEventArgs<IBend>> bendCopiedEvent)
BendCopied
event that occurs after a bend has been copied.
This event is dispatched after the IElementCopiedCallback
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 elements are neither part of the MasterGraph
nor the
view graph
.
bendCopiedEvent
- The listener to add.removeBendCopiedListener(IEventHandler)
public final void addEdgeCopiedListener(IEventHandler<ItemCopiedEventArgs<IEdge>> edgeCopiedEvent)
EdgeCopied
event that occurs after an edge has been copied.
This event is dispatched after the IElementCopiedCallback
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
.
edgeCopiedEvent
- The listener to add.removeEdgeCopiedListener(IEventHandler)
public final void addGraphCopiedListener(IEventHandler<ItemCopiedEventArgs<IGraph>> graphCopiedEvent)
GraphCopied
event that occurs after the entire graph has been copied.
This event is dispatched at the end of the copy(IGraph, Predicate, IGraph, INode, PointD, IElementCopiedCallback)
method.
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 master graph
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 master graph
of the folding view.
graphCopiedEvent
- The listener to add.removeGraphCopiedListener(IEventHandler)
protected ILabel addLabel(IGraph sourceGraph, IGraph targetGraph, ILabelOwner targetOwner, ILabel sourceLabel)
This implementation uses copyLabelLayoutParameter(IGraph, ILabel)
, copyLabelStyle(IGraph, ILabel)
, and
copyLabelTag(ILabel, Object)
as callbacks.
sourceGraph
- The source graph.targetGraph
- The target graph.targetOwner
- The item owner in the target graph to add the label to.sourceLabel
- The source label in the source graph.public final void addLabelCopiedListener(IEventHandler<ItemCopiedEventArgs<ILabel>> labelCopiedEvent)
LabelCopied
event that occurs after a label has been copied.
This event is dispatched after the IElementCopiedCallback
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 dummy node labels, their view state
representation is passed. These elements are neither part of the MasterGraph
nor
the view graph
.
labelCopiedEvent
- The listener to add.removeLabelCopiedListener(IEventHandler)
public final void addNodeCopiedListener(IEventHandler<ItemCopiedEventArgs<INode>> nodeCopiedEvent)
NodeCopied
event that occurs after a node has been copied.
This event is dispatched after the IElementCopiedCallback
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
.
nodeCopiedEvent
- The listener to add.removeNodeCopiedListener(IEventHandler)
public final void addObjectCopiedListener(IEventHandler<ItemCopiedEventArgs<Object>> objectCopiedEvent)
ObjectCopied
event that occurs after a style has been copied.
This event is triggered for all minor objects the graph items are made up of, e.g. the
styles
, tags
,
labels
, and port
parameters.
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.
objectCopiedEvent
- The listener to add.removeObjectCopiedListener(IEventHandler)
protected IPort addPort(IGraph sourceGraph, IGraph targetGraph, IPortOwner targetOwner, IPort sourcePort)
This implementation does not need to copy the adjacent IEdge
s of the sourcePort
. This implementation
uses copyPortLocationParameter(IGraph, IPort)
, copyPortStyle(IGraph, IPort)
, and copyPortTag(IPort, Object)
as callbacks.
sourceGraph
- The source graph.targetGraph
- The target graph.targetOwner
- The port owner in the target graph to add the port to.sourcePort
- The source port in the source graph.public final void addPortCopiedListener(IEventHandler<ItemCopiedEventArgs<IPort>> portCopiedEvent)
PortCopied
event that occurs after a port has been copied.
This event is dispatched after the IElementCopiedCallback
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
.
portCopiedEvent
- The listener to add.removePortCopiedListener(IEventHandler)
protected <T> void cacheCopy(T original, T copy)
The cache can be queried using getCopy(Class, Object, ObjectReference)
. The cache is held until clearCopyCache()
is called.
T
- The type of the item to cache.original
- The original item.copy
- The copy of the item.getOrCreateCopy(Class, Object, Function)
protected void clearCopyCache()
cached copies
of the instance copied using this class.
This method is called before and after a copy operation.
public void copy(IGraph sourceGraph, IGraph targetGraph)
sourceGraph
to targetGraph
.
This method actually delegates to copy(IGraph, Predicate, IGraph, INode, PointD, IElementCopiedCallback)
and
provides the root as the "targetGraph" parameter if there is a hierarchy associated with targetGraph
.
sourceGraph
- The graph to copy.targetGraph
- The graph to copy to.public void copy(IGraph sourceGraph, Predicate<IModelItem> filter, IGraph targetGraph, INode targetRootNode, PointD offset, IElementCopiedCallback elementCopiedCallback)
Predicate
from the sourceGraph
to the targetGraph
.
For each element that has been copied, the elementCopiedCallback
will be invoked.
IllegalArgumentException
- if targetRootNode
is not in targetGraph
sourceGraph
- The graph to copy the elements from.filter
- The filter that decides which elements to copy.targetGraph
- The graph to copy the elements to.targetRootNode
- The group node that should act as the root node for the pasted elements. May be null
if there is no such node.offset
- The offset to apply to the copied items. Only nodes and bends will be offset explicitly, while other items will move
implicitly.elementCopiedCallback
- A delegate to invoke for each element being copied.public void copy(IGraph sourceGraph, Predicate<IModelItem> filter, IGraph targetGraph, PointD offset, IElementCopiedCallback elementCopiedCallback)
Predicate
from the sourceGraph
to the targetGraph
.
For each element that has been copied, the elementCopiedCallback
will be invoked. This method actually delegates
to copy(IGraph, Predicate, IGraph, INode, PointD, IElementCopiedCallback)
and provides the root as the
"targetGraph" parameter if there is a hierarchy associated with targetGraph
.
sourceGraph
- The graph to copy the elements from.filter
- The filter that decides which elements to copy.targetGraph
- The graph to copy the elements to.offset
- The offset to apply to the copied items. Only nodes and bends will be offset explicitly, while other items will move
implicitly.elementCopiedCallback
- A delegate to invoke for each element being copied.protected IEdge copyEdge(IGraph sourceGraph, IGraph targetGraph, IEdge sourceEdge, IPort targetSourcePort, IPort targetTargetPort)
This implementation does not need to copy the IBend
s of the sourceEdge
, nor should it copy
IPort
s or ILabel
s. This implementation uses copyEdgeStyle(IGraph, IEdge)
and copyEdgeTag(IEdge, Object)
as callbacks.
sourceGraph
- The source graph.targetGraph
- The target graph.sourceEdge
- The edge in the source graph.targetSourcePort
- The new source port in the target graph.targetTargetPort
- The new target port in the target graph.public IEdgeStyle copyEdgeStyle(IGraph graph, IEdge edge)
IEdgeStyle
instance.
This implementation uses the ICloneable.clone()
method to create a copy.
graph
- The graph that contains the edge.edge
- The edge to copy the style from.copy(IGraph, Predicate, IGraph, INode, PointD, IElementCopiedCallback)
protected Object copyEdgeTag(IEdge edge, Object tag)
Tag
of an IEdge
.
This implementation simply delegates to copyTag(IModelItem, Object)
edge
- The old edge.tag
- The tag to copy.protected INode copyGroupNode(IGraph sourceGraph, IGraph targetGraph, INode sourceGroupNode, INode targetParent, PointD offset)
sourceGroupNode
in the targetGraph
.
This implementation does not need to copy IPort
s or ILabel
s. This implementation uses copyNodeStyle(IGraph, INode)
and copyNodeTag(INode, Object)
as callbacks.
sourceGraph
- The source graph.targetGraph
- The target graph.sourceGroupNode
- The source node to create a copy of in the targetGraph
.targetParent
- The parent of the group node in the target graph.offset
- The offset to apply to the copied node.public ILabelModelParameter copyLabelLayoutParameter(IGraph graph, ILabel label)
ILabelModelParameter
for a given label.
This implementation uses the ICloneable.clone()
method to create a copy.
graph
- The graph that contains the label.label
- The label to copy the label model parameter from.copy(IGraph, Predicate, IGraph, INode, PointD, IElementCopiedCallback)
public ILabelStyle copyLabelStyle(IGraph graph, ILabel label)
ILabelStyle
instance.
This implementation uses the ICloneable.clone()
method to create a copy.
graph
- The graph that contains the label.label
- The label to copy the style from.copy(IGraph, Predicate, IGraph, INode, PointD, IElementCopiedCallback)
protected Object copyLabelTag(ILabel label, Object tag)
Tag
of a ILabel
.
This implementation simply delegates to copyTag(IModelItem, Object)
label
- The old label.tag
- The tag to copy.protected INode copyNode(IGraph sourceGraph, IGraph targetGraph, INode node, INode targetParent, PointD offset)
node
in the targetGraph
.
This implementation does not need to copy IPort
s or ILabel
s. This implementation uses copyNodeStyle(IGraph, INode)
and copyNodeTag(INode, Object)
as callbacks.
sourceGraph
- The source graph.targetGraph
- The target graph.targetParent
- The parent of the group node in the target graph.node
- The source node to create a copy of in the targetGraph
.offset
- The offset to apply to the copied node.protected INode copyNode(IGraph sourceGraph, IGraph targetGraph, INode node, PointD offset)
node
in the targetGraph
.
This implementation does not need to copy IPort
s or ILabel
s. This implementation uses copyNodeStyle(IGraph, INode)
and copyNodeTag(INode, Object)
as callbacks.
sourceGraph
- The source graph.targetGraph
- The target graph.node
- The source node to create a copy of in the targetGraph
.offset
- The offset to apply to the copied node.public INodeStyle copyNodeStyle(IGraph graph, INode node)
INodeStyle
instance.
This implementation uses the ICloneable.clone()
method to create a copy.
graph
- The graph that contains the node.node
- The node to copy the style from.copy(IGraph, Predicate, IGraph, INode, PointD, IElementCopiedCallback)
protected Object copyNodeTag(INode node, Object tag)
Tag
of a INode
.
This implementation simply delegates to copyTag(IModelItem, Object)
node
- The old node.tag
- The tag to copy.public IPortLocationModelParameter copyPortLocationParameter(IGraph graph, IPort port)
IPortLocationModelParameter
for a given port.
This implementation uses the ICloneable.clone()
method to create a copy.
graph
- The graph that contains the port.port
- The port to copy the model parameter from.copy(IGraph, Predicate, IGraph, INode, PointD, IElementCopiedCallback)
public IPortStyle copyPortStyle(IGraph graph, IPort port)
IPortStyle
instance.
This implementation uses the ICloneable.clone()
method to create a copy.
graph
- The graph that contains the port.port
- The port to copy the style from.copy(IGraph, Predicate, IGraph, INode, PointD, IElementCopiedCallback)
protected Object copyPortTag(IPort port, Object tag)
Tag
of a IPort
.
This implementation simply delegates to copyTag(IModelItem, Object)
port
- The old port.tag
- The tag to copy.protected Object copyTag(IModelItem owner, Object tag)
Tag
for the target graph.
This implementation will try to ICloneable.clone()
the tag
if the Clone
property has
the GraphCopier.CloneTypes.TAGS
flag set. If this is not the case or the tag is not
ICloneable
, the instance will be returned.
owner
- The old owner of the tag.tag
- The tag to copy.public final GraphCopier.CloneTypes getClone()
cloned
for the copy operation.setClone(CloneTypes)
protected <T> boolean getCopy(Class<T> tType, T original, com.yworks.yfiles.utils.ObjectReference<T> copy)
cached
copy for the given original.
Values will be stored in the cache until the next call to clearCopyCache()
.
T
- The type of the item to copy.tType
- The type of the item to copy.original
- The original item.copy
- The copy will be returned via this parameter if this method yields true
.cacheCopy(Object, Object)
,
getOrCreateCopy(Class, Object, Function)
public final <T> T getOrCreateCopy(Class<T> tType, T original, Function<T,T> copyDelegate)
cached
copy for the given original
or uses the copyDelegate
to create the copy of the original.
If there is a cache miss, the delegate will be used to create the copy and the copy will be placed into the
cache
.
T
- The type of the item to copy.tType
- The type of the item to copy.original
- The original item.copyDelegate
- The copy delegate to create the copy.public final GraphCopier.CloneTypes getReferentialIdentityTypes()
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(Class, Object, ObjectReference)
), that
instance will instead be returned, otherwise, this implementation will clone the original instance (depending on the
setting of Clone
) and cache the copy
until after the operation
the cache is cleared
. This feature is implemented directly by the various CopyXXX
methods.
getOrCreateCopy(Class, Object, Function)
,
setReferentialIdentityTypes(CloneTypes)
protected FoldingManager getSourceFoldingManager(IGraph sourceGraph)
FoldingManager
from the given source graph.sourceGraph
- The source graph.protected FoldingManager getTargetFoldingManager(IGraph targetGraph)
FoldingManager
from the given target graph.targetGraph
- The target graph.public final boolean isFoldingStateCopyingEnabled()
additional folding states
.
Should be copied to target graphs.
If the source and target graphs have an instance of FoldingManager
in their lookup, the additional folding state
of the nodes and edges will be copied. The default is true
.
setFoldingStateCopyingEnabled(boolean)
public final boolean isHierarchyCopyingEnabled()
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
.
setHierarchyCopyingEnabled(boolean)
protected void onBendCopied(IBend original, IBend copy)
Raises the BendCopied
event.
original
- The original of the copied bend.copy
- The copied bend.protected void onEdgeCopied(IEdge original, IEdge copy)
Raises the EdgeCopied
event.
original
- The original of the copied edge.copy
- The copied edge.protected void onGraphCopied(IGraph sourceGraph, IGraph targetGraph)
Raises the GraphCopied
event.
sourceGraph
- The source graph from which the elements have been copied.targetGraph
- The graph to which the elements have been copied.protected void onLabelCopied(ILabel original, ILabel copy)
Raises the LabelCopied
event.
original
- The original of the copied label.copy
- The copied label.protected void onNodeCopied(INode original, INode copy)
Raises the NodeCopied
event.
original
- The original of the copied node.copy
- The copied node.protected void onObjectCopied(ItemCopiedEventArgs<Object> itemCopiedEventArgs)
ObjectCopied
event.itemCopiedEventArgs
- The argument to use.protected void onPortCopied(IPort original, IPort copy)
Raises the PortCopied
event.
original
- The original of the copied port.copy
- The copied port.public final void removeBendCopiedListener(IEventHandler<ItemCopiedEventArgs<IBend>> bendCopiedEvent)
BendCopied
event that occurs after a bend has been copied.
This event is dispatched after the IElementCopiedCallback
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 elements are neither part of the MasterGraph
nor the
view graph
.
bendCopiedEvent
- The listener to remove.addBendCopiedListener(IEventHandler)
public final void removeEdgeCopiedListener(IEventHandler<ItemCopiedEventArgs<IEdge>> edgeCopiedEvent)
EdgeCopied
event that occurs after an edge has been copied.
This event is dispatched after the IElementCopiedCallback
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
.
edgeCopiedEvent
- The listener to remove.addEdgeCopiedListener(IEventHandler)
public final void removeGraphCopiedListener(IEventHandler<ItemCopiedEventArgs<IGraph>> graphCopiedEvent)
GraphCopied
event that occurs after the entire graph has been copied.
This event is dispatched at the end of the copy(IGraph, Predicate, IGraph, INode, PointD, IElementCopiedCallback)
method.
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 master graph
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 master graph
of the folding view.
graphCopiedEvent
- The listener to remove.addGraphCopiedListener(IEventHandler)
public final void removeLabelCopiedListener(IEventHandler<ItemCopiedEventArgs<ILabel>> labelCopiedEvent)
LabelCopied
event that occurs after a label has been copied.
This event is dispatched after the IElementCopiedCallback
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 dummy node labels, their view state
representation is passed. These elements are neither part of the MasterGraph
nor
the view graph
.
labelCopiedEvent
- The listener to remove.addLabelCopiedListener(IEventHandler)
public final void removeNodeCopiedListener(IEventHandler<ItemCopiedEventArgs<INode>> nodeCopiedEvent)
NodeCopied
event that occurs after a node has been copied.
This event is dispatched after the IElementCopiedCallback
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
.
nodeCopiedEvent
- The listener to remove.addNodeCopiedListener(IEventHandler)
public final void removeObjectCopiedListener(IEventHandler<ItemCopiedEventArgs<Object>> objectCopiedEvent)
ObjectCopied
event that occurs after a style has been copied.
This event is triggered for all minor objects the graph items are made up of, e.g. the
styles
, tags
,
labels
, and port
parameters.
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.
objectCopiedEvent
- The listener to remove.addObjectCopiedListener(IEventHandler)
public final void removePortCopiedListener(IEventHandler<ItemCopiedEventArgs<IPort>> portCopiedEvent)
PortCopied
event that occurs after a port has been copied.
This event is dispatched after the IElementCopiedCallback
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
.
portCopiedEvent
- The listener to remove.addPortCopiedListener(IEventHandler)
public final void setClone(GraphCopier.CloneTypes value)
cloned
for the copy operation.value
- A bitwise combination of the types to clone.getClone()
public final void setFoldingStateCopyingEnabled(boolean value)
additional folding states
.
Should be copied to target graphs.
If the source and target graphs have an instance of FoldingManager
in their lookup, the additional folding state
of the nodes and edges will be copied. The default is true
.
value
- The FoldingStateCopyingEnabled to set.isFoldingStateCopyingEnabled()
public final void setHierarchyCopyingEnabled(boolean value)
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
.
value
- The HierarchyCopyingEnabled to set.isHierarchyCopyingEnabled()
public final void setReferentialIdentityTypes(GraphCopier.CloneTypes value)
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(Class, Object, ObjectReference)
), that
instance will instead be returned, otherwise, this implementation will clone the original instance (depending on the
setting of Clone
) and cache the copy
until after the operation
the cache is cleared
. This feature is implemented directly by the various CopyXXX
methods.
value
- The referential identity types.getOrCreateCopy(Class, Object, Function)
,
getReferentialIdentityTypes()