Class GraphDrawingCursor

java.lang.Object
de.saar.chorus.jgraph.improvedjgraph.layout.treelayout.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 Details

    • GraphDrawingCursor

      public GraphDrawingCursor(org.jgraph.graph.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(org.jgraph.graph.DefaultGraphCell theNode, ImprovedJGraphLayout theLayout, ImprovedJGraph aGraph, Set<org.jgraph.graph.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 Details

    • 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 org.jgraph.graph.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