|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.base.Graph y.layout.LayoutGraph y.layout.CopiedLayoutGraph
public class CopiedLayoutGraph
A CopiedLayoutGraph
is a LayoutGraph
that serves as a copy of another graph with layout information.
This graph can either be described by another LayoutGraph
instance or a combination of
GraphInterface
and GraphLayout
implementations.
A CopiedLayoutGraph
comes to use if a layout algorithm
should not run directly on
the original graph. Using a copy, the calculated layout will not be applied to the original graph before the
layout algorithm finished successfully.
This can prevent inconsistencies in case something goes wrong during layout calculations.
CopiedLayoutGraph
contains corresponding nodes and edges for each node and edge in the original graph and
copies the labels of the original nodes and edges. It also delegates all DataProvider
s registered with the
original graph.
To preserve the relations between the original elements and the copied elements in this graph,
CopiedLayoutGraph
updates mappings between those elements.
If there are structural changes to the original graph, they can be transferred to this copied graph using
syncStructure()
. Then the copied graph will be altered, adding and removing elements, until it
corresponds to the original again.
Method commitLayoutToOriginalGraph()
will transfer updated layout information to the original graph.
The original graph will stay unchanged until this method is called.
BufferedLayouter
Field Summary |
---|
Fields inherited from class y.base.Graph |
---|
AFTER, BEFORE |
Constructor Summary | |
---|---|
CopiedLayoutGraph(GraphInterface graph,
GraphLayout layout)
Creates a new CopiedLayoutGraph instance which is a copy of the graph specified by the given
GraphInterface and GraphLayout . |
|
CopiedLayoutGraph(LayoutGraph graph)
Creates a new CopiedLayoutGraph instance which is a copy of the given graph. |
Method Summary | |
---|---|
void |
commitLayoutToOriginalGraph()
Writes the current layout information of all elements of this copied graph to the original graph. |
Edge |
createEdge(java.lang.Object originalEdge)
Creates an edge in the copied graph that corresponds to the given original edge. |
protected GraphCopier.CopyFactory |
createGraphCopyFactory()
Creates a factory that creates a CopiedLayoutGraph when copying a graph using GraphCopier . |
protected LabelLayoutFactory |
createLabelFactory()
Creates a new LabelLayoutFactory for this CopiedLayoutGraph . |
Node |
createNode(java.lang.Object originalNode)
Creates a node in the copied graph that corresponds to the given original node. |
Edge |
getCopiedEdge(java.lang.Object originalEdge)
Returns the copied edge that corresponds to the given original edge. |
Node |
getCopiedNode(java.lang.Object originalNode)
Returns the copied node that corresponds to the given original node. |
Edge |
getFeature(EdgeLabelLayout labelLayout)
Returns the edge of the copied graph to which the given EdgeLabelLayout belongs. |
Node |
getFeature(NodeLabelLayout labelLayout)
Returns the node of the copied graph to which the given NodeLabelLayout belongs. |
EdgeLabelLayout[] |
getLabelLayout(Edge copiedEdge)
Returns the layout information for all labels associated with the given edge of the copied graph. |
NodeLabelLayout[] |
getLabelLayout(Node copiedNode)
Returns the layout information for all labels associated with the given node of the copied graph. |
EdgeLayout |
getLayout(Edge copiedEdge)
Returns the layout information for the given edge of the copied graph. |
NodeLayout |
getLayout(Node copiedNode)
Returns the layout information for the given node of the copied graph. |
GraphLayout |
getLayoutForOriginalGraph()
Returns a GraphLayout that is valid for the original graph. |
java.lang.Object |
getOriginalEdge(Edge copiedEdge)
Returns the original edge that corresponds to the given copied edge. |
GraphInterface |
getOriginalGraph()
Returns the original graph. |
GraphLayout |
getOriginalLayout()
Returns the original layout information of the graph. |
java.lang.Object |
getOriginalNode(Node copiedNode)
Returns the original node that corresponds to the given copied node. |
void |
syncStructure()
Synchronizes the structure of the CopiedLayoutGraph with the actual structure of the underlying original
graph. |
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CopiedLayoutGraph(LayoutGraph graph)
CopiedLayoutGraph
instance which is a copy of the given graph.
graph
- the original graphpublic CopiedLayoutGraph(GraphInterface graph, GraphLayout layout)
CopiedLayoutGraph
instance which is a copy of the graph specified by the given
GraphInterface
and GraphLayout
.
graph
- the original graphlayout
- the layout information for the original graphMethod Detail |
---|
public Edge createEdge(java.lang.Object originalEdge)
The edge will connect to the copies of the source and target of the original edge. All labels of the original edge will be also copied and assigned to this edge.
The mappings are updated. Hence, it is possible to look up the newly created
edge by using getCopiedEdge(Object)
or the original edge by using getOriginalEdge(Edge)
.
This method can be used for keeping the CopiedLayoutGraph
in sync with the original graph.
originalEdge
- the original edge
protected GraphCopier.CopyFactory createGraphCopyFactory()
CopiedLayoutGraph
when copying a graph using GraphCopier
.
Subclasses must delegate to the methods createNode(Object)
and createEdge(Object)
to create new
graph elements. Otherwise, the mappings are not correctly built.
createGraphCopyFactory
in class LayoutGraph
GraphCopier.CopyFactory
that builds up a CopiedLayoutGraph
public Node createNode(java.lang.Object originalNode)
All labels of the original node will be copied and assigned to this node.
The mappings are updated. Hence, it is possible to look up the newly created
node by using getCopiedNode(Object)
or the original node by using getOriginalNode(Node)
.
This method can be used for keeping the CopiedLayoutGraph
in sync with the original graph.
originalNode
- the original node
public void syncStructure()
CopiedLayoutGraph
with the actual structure of the underlying original
graph.
public NodeLayout getLayout(Node copiedNode)
If there is no layout information for this node, yet, a new implementation of NodeLayout
is returned.
getLayout
in class LayoutGraph
copiedNode
- the node
public EdgeLayout getLayout(Edge copiedEdge)
If there is no layout information for this edge, yet, a new implementation of EdgeLayout
is returned.
getLayout
in class LayoutGraph
copiedEdge
- the edge
public NodeLabelLayout[] getLabelLayout(Node copiedNode)
If there is no layout information for a label, yet, a new implementation of NodeLabelLayout
is created.
getLabelLayout
in class LayoutGraph
copiedNode
- the node
public EdgeLabelLayout[] getLabelLayout(Edge copiedEdge)
If there is no layout information for a label, yet, a new implementation of EdgeLabelLayout
is created.
getLabelLayout
in class LayoutGraph
copiedEdge
- the edge
public Node getFeature(NodeLabelLayout labelLayout)
NodeLabelLayout
belongs.
getFeature
in class LayoutGraph
labelLayout
- a label layout information of a node in the copied graph
public Edge getFeature(EdgeLabelLayout labelLayout)
EdgeLabelLayout
belongs.
getFeature
in class LayoutGraph
labelLayout
- a label layout information of an edge in the copied graph
public GraphLayout getLayoutForOriginalGraph()
GraphLayout
that is valid for the original graph.
The GraphLayout
contains the identical layout information as the copied graph. However, it uses the original
graph elements as lookup domain. Therefore, this GraphLayout
will return the same layout information
for an original node as getLayout(Node)
does for the corresponding copied node.
LayoutGraph
or GraphLayout
is not altered by this method.GraphLayout
of the copied graph adjusted to the original graphpublic void commitLayoutToOriginalGraph()
public java.lang.Object getOriginalNode(Node copiedNode)
copiedNode
- the node in this graph that is a copy of the returned node
public java.lang.Object getOriginalEdge(Edge copiedEdge)
copiedEdge
- the edge in this graph that is a copy of the returned edge
public Node getCopiedNode(java.lang.Object originalNode)
originalNode
- a node of the original graph whose copy resides in this graph
public Edge getCopiedEdge(java.lang.Object originalEdge)
originalEdge
- an edge of the original graph whose copy resides in this graph
public GraphInterface getOriginalGraph()
public GraphLayout getOriginalLayout()
protected LabelLayoutFactory createLabelFactory()
LabelLayoutFactory
for this CopiedLayoutGraph
.
Subclasses overriding this method must provide an instance that manages the mapping between
copied and original LabelLayout
s.
createLabelFactory
in class LayoutGraph
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |