de.saar.chorus.jgraph
Class GraphDrawingCursor

Object
  extended by GraphDrawingCursor
All Implemented Interfaces:
NodeCursorInterface

public class GraphDrawingCursor
extends Object

A class to determine the coordinates of a node relative to the graph root. This converts the positions (relative to the direct parent) computet by a GraphLayoutCursor into positions relative to the root. The computet coordinates are stored in maps of the given SolvedFormLayout and processed there. A subclass of GraphNodeCursor.

Author:
Marco Kuhlmann, Michaela Regneri

Constructor Summary
GraphDrawingCursor(DefaultGraphCell theNode, ImprovedJGraphLayout theLayout, ImprovedJGraph aGraph)
          Creates a new GraphDrawingCursor
GraphDrawingCursor(DefaultGraphCell theNode, ImprovedJGraphLayout theLayout, ImprovedJGraph aGraph, Set<DefaultGraphCell> theNodes)
          Creates a new GraphDrawingCursor
 
Method Summary
 DefaultGraphCell getCurrentNode()
          Returns the recently processed node.
 boolean mayMoveDownwards()
          Checking whether the current node has at least one child.
 boolean mayMoveSidewards()
          Checking whether the current node has a sibling on the right.
 boolean mayMoveUpwards()
          Checking whether the current node has a direct parent node.
 void moveDownwards()
          Move to the current node's most left child and compute the new coordinates (for the child node).
 void moveSidewards()
          Move to the current node's right sibling and compute the new coordinates (for the sibling).
 void moveUpwards()
          Move to the current node's parent and compute the new coordinates (for the parent node).
 void processCurrentNode()
          Computes the positions for the current node and stores it in a map of the given layout algorithm.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphDrawingCursor

public GraphDrawingCursor(DefaultGraphCell theNode,
                          ImprovedJGraphLayout theLayout,
                          ImprovedJGraph aGraph)
Creates a new GraphDrawingCursor

Parameters:
theNode - the graph root
theLayout - the layout algorithm to store the coordinates
aGraph - the graph to layout

GraphDrawingCursor

public GraphDrawingCursor(DefaultGraphCell theNode,
                          ImprovedJGraphLayout theLayout,
                          ImprovedJGraph aGraph,
                          Set<DefaultGraphCell> theNodes)
Creates a new GraphDrawingCursor

Parameters:
theNode - the graph root
theLayout - the layout algorithm to store the coordinates
aGraph - the graph to layout
theNodes - nodes the layout shall arrange
Method Detail

moveUpwards

public void moveUpwards()
Move to the current node's parent and compute the new coordinates (for the parent node).

Specified by:
moveUpwards in interface NodeCursorInterface

moveDownwards

public void moveDownwards()
Move to the current node's most left child and compute the new coordinates (for the child node).

Specified by:
moveDownwards in interface NodeCursorInterface

moveSidewards

public void moveSidewards()
Move to the current node's right sibling and compute the new coordinates (for the sibling).

Specified by:
moveSidewards in interface NodeCursorInterface
See Also:
JDomGraph.getRightSibling(DefaultGraphCell node)

processCurrentNode

public void processCurrentNode()
Computes the positions for the current node and stores it in a map of the given layout algorithm.

Specified by:
processCurrentNode in interface NodeCursorInterface

getCurrentNode

public DefaultGraphCell getCurrentNode()
Returns the recently processed node.

Specified by:
getCurrentNode in interface NodeCursorInterface

mayMoveUpwards

public boolean mayMoveUpwards()
Checking whether the current node has a direct parent node.

Specified by:
mayMoveUpwards in interface NodeCursorInterface
Returns:
true if there is a parent node

mayMoveDownwards

public boolean mayMoveDownwards()
Checking whether the current node has at least one child.

Specified by:
mayMoveDownwards in interface NodeCursorInterface
Returns:
true if there are one ore more children

mayMoveSidewards

public boolean mayMoveSidewards()
Checking whether the current node has a sibling on the right.

Specified by:
mayMoveSidewards in interface NodeCursorInterface
Returns:
true if there is a right sibling