java.lang.Object
de.saar.chorus.jgraph.improvedjgraph.layout.treelayout.GraphLayoutCursor
All Implemented Interfaces:
NodeCursorInterface

public class GraphLayoutCursor extends Object
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 Details

    • GraphLayoutCursor

      public GraphLayoutCursor(org.jgraph.graph.DefaultGraphCell theNode, ImprovedJGraphLayout theLayout, ImprovedJGraph theGraph)
      Creates a new GraphLayoutCursor
      Parameters:
      theNode - the graph root
      theLayout - the layout algorithm to store the coordinates
      theGraph - the graph to layout
    • GraphLayoutCursor

      public GraphLayoutCursor(org.jgraph.graph.DefaultGraphCell theNode, ImprovedJGraphLayout theLayout, ImprovedJGraph theGraph, Set<org.jgraph.graph.DefaultGraphCell> theNodes)
      Creates a new GraphLayoutCursor
      Parameters:
      theNode - the graph root
      theLayout - the layout algorithm to store the coordinates
      theGraph - the graph to layout
      theNodes - 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:
      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
    • moveUpwards

      public void moveUpwards()
      Moving to the current node's parent node (assuming that there is one).
      Specified by:
      moveUpwards in interface NodeCursorInterface
    • 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
    • moveDownwards

      public void moveDownwards()
      Moving to the current node's most left child (assuming that there is one).
      Specified by:
      moveDownwards in interface NodeCursorInterface
    • 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
    • moveSidewards

      public void moveSidewards()
      Moving to the current node's right sibling (assuming that there is one).
      Specified by:
      moveSidewards in interface NodeCursorInterface
      See Also:
      • JDomGraph.getRightSibling(DefaultGraphCell node)