Class GraphLayoutCursor
java.lang.Object
de.saar.chorus.domgraph.layout.treelayout.GraphLayoutCursor
- All Implemented Interfaces:
NodeCursorInterface
A class to determine the positions of nodes in a graph that
is a tree, relative to their direct parents. These positions are stored
in a given layout algorithm and converted later on by a
GraphDrawingCursor.
A subclass of GraphNodeCursor.- Author:
- Marco Kuhlmann, Michaela Regneri
-
Constructor Summary
ConstructorsConstructorDescriptionGraphLayoutCursor(org.jgraph.graph.DefaultGraphCell theNode, ImprovedJGraphLayout theLayout, ImprovedJGraph theGraph) Creates a newGraphLayoutCursorGraphLayoutCursor(org.jgraph.graph.DefaultGraphCell theNode, ImprovedJGraphLayout theLayout, ImprovedJGraph theGraph, Set<org.jgraph.graph.DefaultGraphCell> theNodes) Creates a newGraphLayoutCursor -
Method Summary
Modifier and TypeMethodDescriptionorg.jgraph.graph.DefaultGraphCellReturns the recently processed node.booleanChecking whether the current node has at least one child.booleanChecking whether the current node has a sibling on the right.booleanChecking whether the current node has a direct parent node.voidMoving to the current node's most left child (assuming that there is one).voidMoving to the current node's right sibling (assuming that there is one).voidMoving to the current node's parent node (assuming that there is one).voidComputes the x- and y-coordinates of the current node, both relative to the direct parent node.
-
Constructor Details
-
GraphLayoutCursor
public GraphLayoutCursor(org.jgraph.graph.DefaultGraphCell theNode, ImprovedJGraphLayout theLayout, ImprovedJGraph theGraph) Creates a newGraphLayoutCursor- Parameters:
theNode- the graph roottheLayout- the layout algorithm to store the coordinatestheGraph- the graph to layout
-
GraphLayoutCursor
public GraphLayoutCursor(org.jgraph.graph.DefaultGraphCell theNode, ImprovedJGraphLayout theLayout, ImprovedJGraph theGraph, Set<org.jgraph.graph.DefaultGraphCell> theNodes) Creates a newGraphLayoutCursor- Parameters:
theNode- the graph roottheLayout- the layout algorithm to store the coordinatestheGraph- the graph to layouttheNodes- nodes the layout shall arrange
-
-
Method Details
-
processCurrentNode
public void processCurrentNode()Computes the x- and y-coordinates of the current node, both relative to the direct parent node.- Specified by:
processCurrentNodein interfaceNodeCursorInterface
-
getCurrentNode
public org.jgraph.graph.DefaultGraphCell getCurrentNode()Returns the recently processed node.- Specified by:
getCurrentNodein interfaceNodeCursorInterface
-
mayMoveUpwards
public boolean mayMoveUpwards()Checking whether the current node has a direct parent node.- Specified by:
mayMoveUpwardsin interfaceNodeCursorInterface- Returns:
- true if there is a parent node
-
moveUpwards
public void moveUpwards()Moving to the current node's parent node (assuming that there is one).- Specified by:
moveUpwardsin interfaceNodeCursorInterface
-
mayMoveDownwards
public boolean mayMoveDownwards()Checking whether the current node has at least one child.- Specified by:
mayMoveDownwardsin interfaceNodeCursorInterface- Returns:
- true if there are one ore more children
-
moveDownwards
public void moveDownwards()Moving to the current node's most left child (assuming that there is one).- Specified by:
moveDownwardsin interfaceNodeCursorInterface
-
mayMoveSidewards
public boolean mayMoveSidewards()Checking whether the current node has a sibling on the right.- Specified by:
mayMoveSidewardsin interfaceNodeCursorInterface- Returns:
- true if there is a right sibling
-
moveSidewards
public void moveSidewards()Moving to the current node's right sibling (assuming that there is one).- Specified by:
moveSidewardsin interfaceNodeCursorInterface- See Also:
-
JDomGraph.getRightSibling(DefaultGraphCell node)
-