Search this API

y.layout
Class CopiedLayoutGraph

java.lang.Object
  extended by y.base.Graph
      extended by y.layout.LayoutGraph
          extended by y.layout.CopiedLayoutGraph
All Implemented Interfaces:
GraphInterface, GraphLayout

public class CopiedLayoutGraph
extends LayoutGraph

This is a LayoutGraph implementation that serves as a copy of another LayoutGraph or as copy of a combined GraphInterface and and GraphLayout interface implementation.


Field Summary
 
Fields inherited from class y.base.Graph
AFTER, BEFORE
 
Constructor Summary
CopiedLayoutGraph(GraphInterface graph, GraphLayout layout)
          Initializes this graph as a copy of the given graph interface and graph layout.
CopiedLayoutGraph(LayoutGraph graph)
          Initializes this graph as a copy of the given graph
 
Method Summary
 void commitLayoutToOriginalGraph()
          Writes the current layout information to the original graph.
 Edge createEdge(Object origEdge)
          Creates an copied edge.
protected  GraphCopier.CopyFactory createGraphCopyFactory()
          Creates a factory that delegates to the createNode(Object) and createEdge(Object) methods of this instance.
 Node createNode(Object origNode)
          Creates a copy of the given original node.
 Edge getCopiedEdge(Object e)
          Returns the copied edge that corresponds to the given original edge.
 Node getCopiedNode(Object v)
          Returns the copied node that corresponds to the given original node.
 Edge getFeature(EdgeLabelLayout labelLayout)
          Returns the edge which is described by a given label layout.
 Node getFeature(NodeLabelLayout labelLayout)
          Returns the node which is described by a given label layout.
 EdgeLabelLayout[] getLabelLayout(Edge e)
          Returns EdgeLabelLayout objects which describe the layouts of the labels that belong to the given edge.
 NodeLabelLayout[] getLabelLayout(Node v)
          Returns NodeLabelLayout objects which describe the layouts of the labels that belong to the given node.
 EdgeLayout getLayout(Edge e)
          Returns the layout information for an edge in the drawing.
 NodeLayout getLayout(Node v)
          Returns the layout information for a node in the drawing.
 GraphLayout getLayoutForOriginalGraph()
          Returns the GraphLayout that is valid for the original graph.
 Object getOriginalEdge(Edge e)
          Returns the original edge that corresponds to the given edge.
 GraphInterface getOriginalGraph()
          Returns the original graph
 GraphLayout getOriginalLayout()
          Returns the original layout
 Object getOriginalNode(Node v)
          Returns the original node that corresponds to the given node.
 void syncStructure()
          Synchronizes the structure of the CopiedLayoutGraph with the actual structure of the underlying LayoutGraph.
 
Methods inherited from class y.layout.LayoutGraph
getBoundingBox, getCenter, getCenterX, getCenterY, getEdgeLabelLayout, getEdgeLayout, getEdgeList, getHeight, getLocation, getNodeLabelLayout, getNodeLayout, getPath, getPathList, getPointList, getPoints, getRectangle, getSize, getSourcePointAbs, getSourcePointRel, getTargetPointAbs, getTargetPointRel, getWidth, getX, getY, moveBy, setCenter, setCenter, setEndPointsAbs, setLocation, setLocation, setPath, setPath, setPoints, setPoints, setSize, setSize, setSourcePointAbs, setSourcePointRel, setTargetPointAbs, setTargetPointRel
 
Methods inherited from class y.base.Graph
addDataProvider, addGraphListener, changeEdge, changeEdge, changeEdge, clear, contains, contains, containsEdge, createCopy, createEdge, createEdge, createEdgeMap, createGraph, createNode, createNodeMap, disposeEdgeMap, disposeNodeMap, E, edgeCount, edgeObjects, edges, fireGraphEvent, firePostEvent, firePostEvent, firePreEvent, firePreEvent, firstEdge, firstNode, firstOutEdge, getDataProvider, getDataProviderKeys, getEdgeArray, getGraphCopyFactory, getGraphListeners, getNodeArray, getRegisteredEdgeMaps, getRegisteredNodeMaps, getSource, getTarget, hasListeners, hide, hide, isEmpty, lastEdge, lastNode, moveSubGraph, moveToFirst, moveToFirst, moveToLast, moveToLast, N, nodeCount, nodeObjects, nodes, printNodeSlotSize, reInsertEdge, reInsertNode, removeDataProvider, removeEdge, removeGraphListener, removeNode, reverseEdge, setGraphCopyFactory, sortEdges, sortEdges, sortNodes, toString, unhide, unhide
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CopiedLayoutGraph

public CopiedLayoutGraph(LayoutGraph graph)
Initializes this graph as a copy of the given graph


CopiedLayoutGraph

public CopiedLayoutGraph(GraphInterface graph,
                         GraphLayout layout)
Initializes this graph as a copy of the given graph interface and graph layout.

Method Detail

createEdge

public Edge createEdge(Object origEdge)
Creates an copied edge. The mappings are updated so that it is possible to look up the newly created node by using getCopiedEdge(Object).
This method can be used to keep the CopiedLayoutGraph in sync with the original graph.

Parameters:
origEdge - the original edge the copied edge is based on
Returns:
the newly created edge (belongs to the copied graph)

createGraphCopyFactory

protected GraphCopier.CopyFactory createGraphCopyFactory()
Creates a factory that delegates to the createNode(Object) and createEdge(Object) methods of this instance.

Specified by:
createGraphCopyFactory in class LayoutGraph
Returns:
the (possibly shared) instance.

createNode

public Node createNode(Object origNode)
Creates a copy of the given original node. The mappings are updated so that the lookup methods (getOriginalNode(y.base.Node) and getCopiedNode(Object) can be used.
This method is especially useful to keep the CopiedLayoutGraph in sync with the original graph.

Parameters:
origNode - the node of the original graph the copy will be created for
Returns:
the newly created node that represents a copy of the given node.

syncStructure

public void syncStructure()
Synchronizes the structure of the CopiedLayoutGraph with the actual structure of the underlying LayoutGraph.


getLayout

public NodeLayout getLayout(Node v)
Returns the layout information for a node in the drawing.

Specified by:
getLayout in class LayoutGraph
Parameters:
v - a node in the drawing.
Returns:
the layout information for node.

getLayout

public EdgeLayout getLayout(Edge e)
Returns the layout information for an edge in the drawing.

Specified by:
getLayout in class LayoutGraph
Parameters:
e - an edge in the drawing.
Returns:
the layout information for the given edge.

getLabelLayout

public NodeLabelLayout[] getLabelLayout(Node v)
Returns NodeLabelLayout objects which describe the layouts of the labels that belong to the given node.

Specified by:
getLabelLayout in class LayoutGraph
Parameters:
v - a node in the drawing.
Returns:
the node label layout information for node.

getLabelLayout

public EdgeLabelLayout[] getLabelLayout(Edge e)
Returns EdgeLabelLayout objects which describe the layouts of the labels that belong to the given edge.

Specified by:
getLabelLayout in class LayoutGraph
Parameters:
e - an edge in the drawing.
Returns:
the edge label layout information for the given edge.

getFeature

public Node getFeature(NodeLabelLayout labelLayout)
Returns the node which is described by a given label layout.

Specified by:
getFeature in class LayoutGraph

getFeature

public Edge getFeature(EdgeLabelLayout labelLayout)
Returns the edge which is described by a given label layout.

Specified by:
getFeature in class LayoutGraph

getLayoutForOriginalGraph

public GraphLayout getLayoutForOriginalGraph()
Returns the GraphLayout that is valid for the original graph. The information contained in the GraphLayout is identical to the graph layout associated with this graph, but it uses the original graph elements as lookup domain, i.e. getLayout(copiedNode) corresponds to getLayoutForOriginalGraph().getLayout(getOriginalNode(copiedNode)).


commitLayoutToOriginalGraph

public void commitLayoutToOriginalGraph()
Writes the current layout information to the original graph. Works only when the graph was constructed as copy of another graph.


getOriginalNode

public Object getOriginalNode(Node v)
Returns the original node that corresponds to the given node.

Parameters:
v - a node in this graph that is a copy of the returned node
Returns:
a node in the original graph whose copy is the given node

getOriginalEdge

public Object getOriginalEdge(Edge e)
Returns the original edge that corresponds to the given edge.

Parameters:
e - an edge in this graph that is a copy of the returned edge
Returns:
an edge in the original graph whose copy is the given edge

getCopiedNode

public Node getCopiedNode(Object v)
Returns the copied node that corresponds to the given original node.

Parameters:
v - a node in the original graph whose copy is in this graph
Returns:
a node in this graph that is the copy of the given original node

getCopiedEdge

public Edge getCopiedEdge(Object e)
Returns the copied edge that corresponds to the given original edge.

Parameters:
e - an edge in the original graph whose copy is in this graph
Returns:
an edge in this graph that is the copy of the given original edge

getOriginalGraph

public GraphInterface getOriginalGraph()
Returns the original graph

Returns:
the original graph

getOriginalLayout

public GraphLayout getOriginalLayout()
Returns the original layout

Returns:
the original layout

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