Search this API

y.layout
Class LayoutGraphCopyFactory

java.lang.Object
  extended by y.layout.LayoutGraphCopyFactory
All Implemented Interfaces:
GraphCopier.CopyFactory

public class LayoutGraphCopyFactory
extends java.lang.Object
implements GraphCopier.CopyFactory

An implementation of the GraphCopier.CopyFactory interface used by GraphCopier that can be used by implementations of LayoutGraph.

 
Your browser does not support SVG content.

Nested Class Summary
static class LayoutGraphCopyFactory.HierarchicGraphCopyFactory
          An implementation of the copy factory interface used by GraphCopier that can be used by implementations of LayoutGraph that are hierarchically grouped using GroupingKeys.
 
Constructor Summary
LayoutGraphCopyFactory()
          Creates a new LayoutGraphCopyFactory instance.
 
Method Summary
 Edge copyEdge(Graph targetGraph, Node newSource, Node newTarget, Edge originalEdge)
          Copies the originalEdge from the source graph to the new targetGraph using the specified new source and target node in the target graph.
protected  EdgeLabelLayout copyEdgeLabelLayout(EdgeLabelLayout edgeLabelLayout)
          Returns a copy of the given EdgeLabelLayout.
protected  void copyLabels(LayoutGraph originalLayoutGraph, Edge originalEdge, LayoutGraph targetGraph, Edge edge)
          Copies the labels for the given edge.
protected  void copyLabels(LayoutGraph originalLayoutGraph, Node originalNode, LayoutGraph targetGraph, Node newNode)
          Copies the labels for the given node.
 Node copyNode(Graph targetGraph, Node originalNode)
          Copies the originalNode from the source graph to the new targetGraph
protected  NodeLabelLayout copyNodeLabelLayout(NodeLabelLayout nodeLabelLayout)
          Returns a copy of the given NodeLabelLayout.
 Graph createGraph()
          Creates a new DefaultLayoutGraph.
 void postCopyGraphData(Graph originalGraph, Graph newGraph, java.util.Map nodeMap, java.util.Map edgeMap)
          Callback that will be called after the copy operation has completed.
 void preCopyGraphData(Graph originalGraph, Graph newGraph)
          Callback that will be called before the copy operation takes place.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutGraphCopyFactory

public LayoutGraphCopyFactory()
Creates a new LayoutGraphCopyFactory instance.

Method Detail

copyNode

public Node copyNode(Graph targetGraph,
                     Node originalNode)
Description copied from interface: GraphCopier.CopyFactory
Copies the originalNode from the source graph to the new targetGraph

Specified by:
copyNode in interface GraphCopier.CopyFactory
Parameters:
targetGraph - the graph to create the new node in
originalNode - the original node from the source graph
Returns:
the newly created node

copyLabels

protected void copyLabels(LayoutGraph originalLayoutGraph,
                          Node originalNode,
                          LayoutGraph targetGraph,
                          Node newNode)
Copies the labels for the given node.

All labels that belong to the original node are copied to the new node including their layout information.

This implementation expects a DefaultLayoutGraph otherwise it does nothing. The method is called by copyNode(Graph, Node). It may be overridden to customize the copying of labels.

Parameters:
originalLayoutGraph - the original graph that is copied
originalNode - the original node whose labels are copied
targetGraph - the copy of the original graph
newNode - the copy of the original node

copyNodeLabelLayout

protected NodeLabelLayout copyNodeLabelLayout(NodeLabelLayout nodeLabelLayout)
Returns a copy of the given NodeLabelLayout.

Parameters:
nodeLabelLayout - the original layout information for a label
Returns:
the copy

copyEdge

public Edge copyEdge(Graph targetGraph,
                     Node newSource,
                     Node newTarget,
                     Edge originalEdge)
Description copied from interface: GraphCopier.CopyFactory
Copies the originalEdge from the source graph to the new targetGraph using the specified new source and target node in the target graph.

Specified by:
copyEdge in interface GraphCopier.CopyFactory
Parameters:
targetGraph - the graph to create the new node in
newSource - the source node in the target graph to use for the newly created edge
newTarget - the target node in the target graph to use for the newly created edge
originalEdge - the original edge from the source graph
Returns:
the newly created edge

createGraph

public Graph createGraph()
Creates a new DefaultLayoutGraph.

Specified by:
createGraph in interface GraphCopier.CopyFactory
Returns:
the newly created graph

copyLabels

protected void copyLabels(LayoutGraph originalLayoutGraph,
                          Edge originalEdge,
                          LayoutGraph targetGraph,
                          Edge edge)
Copies the labels for the given edge.

All labels that belong to the original edge are copied to the new edge including their layout information.

This implementation expects a DefaultLayoutGraph otherwise it does nothing. The method is called by copyNode(Graph, Node). It may be overridden to customize the copying of labels.

Parameters:
originalLayoutGraph - the original graph that is copied
originalEdge - the original edge whose labels are copied
targetGraph - the copy of the original graph
edge - the copy of the original edge

copyEdgeLabelLayout

protected EdgeLabelLayout copyEdgeLabelLayout(EdgeLabelLayout edgeLabelLayout)
Returns a copy of the given EdgeLabelLayout.

Parameters:
edgeLabelLayout - the original layout information for a label
Returns:
the copy

preCopyGraphData

public void preCopyGraphData(Graph originalGraph,
                             Graph newGraph)
Description copied from interface: GraphCopier.CopyFactory
Callback that will be called before the copy operation takes place. At that point in time no entities have been copied to the new graph.

Specified by:
preCopyGraphData in interface GraphCopier.CopyFactory
Parameters:
originalGraph - the graph that will be used to copy the entities from.
newGraph - the graph that will be used to copy the entities to.

postCopyGraphData

public void postCopyGraphData(Graph originalGraph,
                              Graph newGraph,
                              java.util.Map nodeMap,
                              java.util.Map edgeMap)
Description copied from interface: GraphCopier.CopyFactory
Callback that will be called after the copy operation has completed. At that point in time all entities have been copied to the new graph.

Specified by:
postCopyGraphData in interface GraphCopier.CopyFactory
Parameters:
originalGraph - the graph that was used to copy the entities from.
newGraph - the graph that was used to copy the entities to.
nodeMap - a map that contains a mapping between the nodes in the source graph to their corresponding nodes in the new graph.
edgeMap - a map that contains a mapping between the edges in the source graph to their corresponding edges in the new graph.

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.