Class GraphLayout<N,E>

java.lang.Object
org.netbeans.api.visual.graph.layout.GraphLayout<N,E>
Direct Known Subclasses:
GridGraphLayout, TreeGraphLayout

public abstract class GraphLayout<N,E> extends Object
This class represents a graph-orinted layout. The layout is invoked using layoutGraph methods. The layoutNodes method could be called for resolving locations of a sub-set of all nodes.

Internally the invoked method creates an UniversalGraph from the scene in the arguments. Then it calls the particular (performGraphLayout or performNodesLayout) methods with the UniversalGraph as a parameter. These protected methods are implemented by the GraphLayout based class and performs particular layout using an UniversalGraph.

  • Constructor Details

    • GraphLayout

      public GraphLayout()
  • Method Details

    • isAnimated

      public final boolean isAnimated()
      Returns whether the layout uses animations.
      Returns:
      true if animated
    • setAnimated

      public final void setAnimated(boolean animated)
      Sets whether the layout is animated.
      Parameters:
      animated - if true, then the layout is animated
    • addGraphLayoutListener

      public final void addGraphLayoutListener(GraphLayoutListener<N,E> listener)
      Adds a graph layout listener.
      Parameters:
      listener - the graph layout listener
    • removeGraphLayoutListener

      public final void removeGraphLayoutListener(GraphLayoutListener<N,E> listener)
      Removes a graph layout listener.
      Parameters:
      listener - the graph layout listener
    • layoutGraph

      public final void layoutGraph(GraphScene<N,E> graphScene)
      Invokes graph-oriented layout on a GraphScene.
      Parameters:
      graphScene - the graph scene
    • layoutGraph

      public final void layoutGraph(GraphPinScene<N,E,?> graphPinScene)
      Invokes graph-oriented layout on a GraphPinScene.
      Parameters:
      graphPinScene - the graph pin scene
    • layoutNodes

      public final void layoutNodes(GraphScene<N,E> graphScene, Collection<N> nodes)
      Invokes resolving of locations for a collection of nodes in a GraphScene.
      Parameters:
      graphScene - the graph scene
      nodes - the collection of nodes to resolve
    • layoutNodes

      public final void layoutNodes(GraphPinScene<N,E,?> graphPinScene, Collection<N> nodes)
      Invokes resolving of locations for a collection of nodes in a GraphPinScene.
      Parameters:
      graphPinScene - the graph pin scene
      nodes - the collection of nodes to resolve
    • setResolvedNodeLocation

      protected final void setResolvedNodeLocation(UniversalGraph<N,E> graph, N node, Point newPreferredLocation)
      Should be called to set a new resolved preferred location of a node.
      Parameters:
      graph - the universal graph
      node - the node with resolved location
      newPreferredLocation - the new resolved location
    • performGraphLayout

      protected abstract void performGraphLayout(UniversalGraph<N,E> graph)
      Implements and performs particular graph-oriented algorithm of a UniversalGraph. Call GraphLayout.setResolvedNodeLocation method for setting the resolved node location.
      Parameters:
      graph - the universal graph on which the layout should be performed
    • performNodesLayout

      protected abstract void performNodesLayout(UniversalGraph<N,E> graph, Collection<N> nodes)
      Implements and performs particular location resolution of a collection of nodes in a UniversalGraph. Call GraphLayout.setResolvedNodeLocation method for setting the resolved node location.
      Parameters:
      graph - the universal graph on which the nodes should be resolved
      nodes - the collection of nodes to be resolved