Class GridGraphLayout<N,E>

java.lang.Object
org.netbeans.api.visual.graph.layout.GraphLayout<N,E>
org.netbeans.api.visual.graph.layout.GridGraphLayout<N,E>

public final class GridGraphLayout<N,E> extends GraphLayout<N,E>
This class represents a graph-oriented layout which organizes nodes into a grid.

You can call setChecker method to enable checker style. If the parameter is true, that the layout uses only half of nodes on a grid like a single color on a chess board.

You can define horizontal and vertical gaps between nodes using the setGaps method.

  • Constructor Details

    • GridGraphLayout

      public GridGraphLayout()
      Creates a grid graph layout.
  • Method Details

    • setChecker

      public GridGraphLayout<N,E> setChecker(boolean checker)
      Sets a checker style.
      Parameters:
      checker - if true, then checker style is enabled and nodes are organized like a single color on a chess board.
      Returns:
      the instance of the grid graph layout
    • setGaps

      public GridGraphLayout<N,E> setGaps(int horizontalGap, int verticalGap)
      Sets horizontal and vertical gap between nodes.
      Parameters:
      horizontalGap - the horizontal gap
      verticalGap - the vertical gap
      Returns:
      the instance of the grid graph layout
    • performGraphLayout

      protected void performGraphLayout(UniversalGraph<N,E> graph)
      Performs the grid graph layout on an universal graph.
      Specified by:
      performGraphLayout in class GraphLayout<N,E>
      Parameters:
      graph - the universal graph
    • performNodesLayout

      protected void performNodesLayout(UniversalGraph<N,E> graph, Collection<N> nodes)
      Should perform nodes layout. Currently unsupported.
      Specified by:
      performNodesLayout in class GraphLayout<N,E>
      Parameters:
      graph - the universal graph
      nodes - the collection of nodes to resolve