com.yworks.yfiles.server.graphml.folding
Class FoldingLayoutStage

java.lang.Object
  extended byy.layout.AbstractLayoutStage
      extended bycom.yworks.yfiles.server.graphml.folding.FoldingLayoutStage
All Implemented Interfaces:
Layouter, LayoutStage
Direct Known Subclasses:
GraphRoundtripSupportBase.RoundtripGraphMLLayoutGraphIOHandler.LocalViewModeConfigurator

public class FoldingLayoutStage
extends AbstractLayoutStage

A layout stage that allows to calculate layouts for folded graph structures.

The layout stage will pass a temporary graph structure to the layout algorithm that corresponds to the view defined by the graph's current expansion state, node view states, and edge view states.

The dummyEdgeMode property determines how dummy edges are created for edges whose source and/or target node are not visible because either the source/target node itself or a parent group node is collapsed.

The layout stage can be used to calculate layouts for a single view or recursively for inner graphs of collapsed group nodes.

This stage uses its own graph buffering and should not be wrapped in a BufferedLayouter.

See Also:
FoldingSupport, FoldedLayoutGraph

Field Summary
static byte DUMMY_EDGE_MODE_EXCLUDE
          A dummy edge mode that prevents the creation of dummy edges.
static byte DUMMY_EDGE_MODE_MERGE
          A dummy edge mode that merges multiple dummy edges between the same source and target nodes to a single dummy edge.
static byte DUMMY_EDGE_MODE_SEPARATE
          The default dummy edge mode.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
FoldingLayoutStage()
           
 
Method Summary
protected  void applyEdgeLabelLayouts(LabelLayoutSetter labelLayoutSetter, Edge dummyEdge, YList labels)
           
protected  void applyEdgeViewState(LayoutGraph graph, Edge dummyEdge, EdgeViewState edgeViewState)
           
protected  void applyLabelLayouts(LayoutGraph graph, LabelLayoutSetter labelLayoutSetter)
           
protected  void applyNodeLabelLayouts(LabelLayoutSetter labelLayoutSetter, Node node, java.util.List labels)
           
protected  void applyNodeViewState(LayoutGraph graph, Node node, NodeViewState nodeViewState)
           
 boolean canLayout(LayoutGraph graph)
           
protected  void commitEdgeLabelLayout(Edge edge, EdgeLabelLayout dummyLayout, Label label)
          Commit the label layout that has been calculated by the layout algorithm to the dummy edge's label.
protected  void commitNodeLabelLayout(Node node, NodeLabelLayout dummyLayout, Label label)
          Commit the label layout that has been calculated by the layout algorithm to the dummy node's label.
protected  void copyEdgeLabel(Label label, EdgeLabelLayoutImpl layout)
          Copy the label layout information of a dummy edge label to a label layout implementation that can be handled by the layout algorithm.
protected  void copyNodeLabel(Label label, NodeLabelLayoutImpl layout)
          Copy the label layout information of a dummy node label to a label layout implementation that can be handled by the layout algorithm.
protected  void createDummyEdge(LayoutGraph graph, Edge masterEdge)
           
protected  Edge createDummyEdgeCore(LayoutGraph graph, Node sourceRepresentative, Node targetRepresentative, DummyEdgeId dummyEdgeId)
           
 void doLayout(LayoutGraph graph)
          Calculates a layout using the graph's current local root.
 byte getDummyEdgeMode()
          The strategy that determines how hidden edges are mapped to dummy edges.
protected  void handleCollapsedNode(LayoutGraph graph, Node parentNode)
          hide children and edges of a hidden node (also: create dummy edge), hide the node
 boolean isRecursive()
          Whether the layout should be performed recursively for the inner graphs of collapsed group nodes.
 void prepare(LayoutGraph graph, Node root)
           
 void restore(LayoutGraph graph)
           
 void setDummyEdgeMode(byte dummyEdgeMode)
          The strategy that determines how hidden edges are mapped to dummy edges.
 void setRecursive(boolean recursive)
          Whether the layout should be performed recursively for the inner graphs of collapsed group nodes.
 
Methods inherited from class y.layout.AbstractLayoutStage
canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DUMMY_EDGE_MODE_SEPARATE

public static final byte DUMMY_EDGE_MODE_SEPARATE
The default dummy edge mode.

For each edge whose source and/or target node is not visible because either the source/target node itself or a parent group node is collapsed, a separate dummy edge will be created.

See Also:
setDummyEdgeMode(byte), Constant Field Values

DUMMY_EDGE_MODE_MERGE

public static final byte DUMMY_EDGE_MODE_MERGE
A dummy edge mode that merges multiple dummy edges between the same source and target nodes to a single dummy edge.

See Also:
setDummyEdgeMode(byte), Constant Field Values

DUMMY_EDGE_MODE_EXCLUDE

public static final byte DUMMY_EDGE_MODE_EXCLUDE
A dummy edge mode that prevents the creation of dummy edges.

See Also:
setDummyEdgeMode(byte), Constant Field Values
Constructor Detail

FoldingLayoutStage

public FoldingLayoutStage()
Method Detail

canLayout

public boolean canLayout(LayoutGraph graph)

setRecursive

public void setRecursive(boolean recursive)
Whether the layout should be performed recursively for the inner graphs of collapsed group nodes.

If set to true, the layout algorithm will be performed for each inner graph of a collapsed group node that is a descendant of the passed root node.


isRecursive

public boolean isRecursive()
Whether the layout should be performed recursively for the inner graphs of collapsed group nodes.

If set to true, the layout algorithm will be performed for each inner graph of a collapsed group node that is a descendant of the graph's root node.

A recursive layout will result in valid layout results for all views that result from entering or exiting closed group nodes that are descendants of the local root.


setDummyEdgeMode

public void setDummyEdgeMode(byte dummyEdgeMode)
The strategy that determines how hidden edges are mapped to dummy edges.

In a client-server application, the chosen dummy edge mode should match the dummy edge converter that is used on the client.

Available dummy edge modes:

Parameters:
dummyEdgeMode - One of the dummy edge mode constants defined in this class.

getDummyEdgeMode

public byte getDummyEdgeMode()
The strategy that determines how hidden edges are mapped to dummy edges.

In a client-server application, the chosen dummy edge mode should match the dummy edge converter that is used on the client.

Available dummy edge modes:

Returns:
One of the dummy edge mode constants defined in this class.

doLayout

public void doLayout(LayoutGraph graph)
Calculates a layout using the graph's current local root.

Depending on the recursive property, the layout will be calculated only for the view defined by the current local root and the current node expansion state, or the layout will be calculated recursively by "entering" collapsed descendants of the local root.


applyLabelLayouts

protected void applyLabelLayouts(LayoutGraph graph,
                                 LabelLayoutSetter labelLayoutSetter)

prepare

public void prepare(LayoutGraph graph,
                    Node root)

applyNodeViewState

protected void applyNodeViewState(LayoutGraph graph,
                                  Node node,
                                  NodeViewState nodeViewState)

applyNodeLabelLayouts

protected void applyNodeLabelLayouts(LabelLayoutSetter labelLayoutSetter,
                                     Node node,
                                     java.util.List labels)

copyNodeLabel

protected void copyNodeLabel(Label label,
                             NodeLabelLayoutImpl layout)
Copy the label layout information of a dummy node label to a label layout implementation that can be handled by the layout algorithm.

Parameters:
label - A label of dummy NodeViewState
layout - A node label layout instance that will be seen by the layout algorithm.
See Also:
commitNodeLabelLayout(Node, NodeLabelLayout, Label)

copyEdgeLabel

protected void copyEdgeLabel(Label label,
                             EdgeLabelLayoutImpl layout)
Copy the label layout information of a dummy edge label to a label layout implementation that can be handled by the layout algorithm.

Parameters:
label - A label of dummy EdgeViewState
layout - An edge label layout instance that will be seen by the layout algorithm.
See Also:
commitEdgeLabelLayout(Edge, EdgeLabelLayout, Label)

handleCollapsedNode

protected void handleCollapsedNode(LayoutGraph graph,
                                   Node parentNode)
hide children and edges of a hidden node (also: create dummy edge), hide the node


createDummyEdge

protected void createDummyEdge(LayoutGraph graph,
                               Edge masterEdge)

createDummyEdgeCore

protected Edge createDummyEdgeCore(LayoutGraph graph,
                                   Node sourceRepresentative,
                                   Node targetRepresentative,
                                   DummyEdgeId dummyEdgeId)

applyEdgeViewState

protected void applyEdgeViewState(LayoutGraph graph,
                                  Edge dummyEdge,
                                  EdgeViewState edgeViewState)

applyEdgeLabelLayouts

protected void applyEdgeLabelLayouts(LabelLayoutSetter labelLayoutSetter,
                                     Edge dummyEdge,
                                     YList labels)

commitNodeLabelLayout

protected void commitNodeLabelLayout(Node node,
                                     NodeLabelLayout dummyLayout,
                                     Label label)
Commit the label layout that has been calculated by the layout algorithm to the dummy node's label.

Parameters:
node - The label's owner
dummyLayout - The label layout instance that might have been modified by the layout algorithm.
label - The dummy NodeViewState's label.
See Also:
copyNodeLabel(Label, NodeLabelLayoutImpl)

commitEdgeLabelLayout

protected void commitEdgeLabelLayout(Edge edge,
                                     EdgeLabelLayout dummyLayout,
                                     Label label)
Commit the label layout that has been calculated by the layout algorithm to the dummy edge's label.

Parameters:
edge - The label's owner
dummyLayout - The label layout instance that might have been modified by the layout algorithm.
label - The dummy EdgeViewState's label.
See Also:
copyEdgeLabel(Label, EdgeLabelLayoutImpl)

restore

public void restore(LayoutGraph graph)


Copyright © 2000-2013 yWorks GmbH. All rights reserved