Class GraphLayout<N,E>
java.lang.Object
org.netbeans.api.visual.graph.layout.GraphLayout<N,E>
- Direct Known Subclasses:
GridGraphLayout
,TreeGraphLayout
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addGraphLayoutListener
(GraphLayoutListener<N, E> listener) Adds a graph layout listener.final boolean
Returns whether the layout uses animations.final void
layoutGraph
(GraphPinScene<N, E, ?> graphPinScene) Invokes graph-oriented layout on a GraphPinScene.final void
layoutGraph
(GraphScene<N, E> graphScene) Invokes graph-oriented layout on a GraphScene.final void
layoutNodes
(GraphPinScene<N, E, ?> graphPinScene, Collection<N> nodes) Invokes resolving of locations for a collection of nodes in a GraphPinScene.final void
layoutNodes
(GraphScene<N, E> graphScene, Collection<N> nodes) Invokes resolving of locations for a collection of nodes in a GraphScene.protected abstract void
performGraphLayout
(UniversalGraph<N, E> graph) Implements and performs particular graph-oriented algorithm of a UniversalGraph.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.final void
removeGraphLayoutListener
(GraphLayoutListener<N, E> listener) Removes a graph layout listener.final void
setAnimated
(boolean animated) Sets whether the layout is animated.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.
-
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
Adds a graph layout listener.- Parameters:
listener
- the graph layout listener
-
removeGraphLayoutListener
Removes a graph layout listener.- Parameters:
listener
- the graph layout listener
-
layoutGraph
Invokes graph-oriented layout on a GraphScene.- Parameters:
graphScene
- the graph scene
-
layoutGraph
Invokes graph-oriented layout on a GraphPinScene.- Parameters:
graphPinScene
- the graph pin scene
-
layoutNodes
Invokes resolving of locations for a collection of nodes in a GraphScene.- Parameters:
graphScene
- the graph scenenodes
- the collection of nodes to resolve
-
layoutNodes
Invokes resolving of locations for a collection of nodes in a GraphPinScene.- Parameters:
graphPinScene
- the graph pin scenenodes
- 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 graphnode
- the node with resolved locationnewPreferredLocation
- the new resolved location
-
performGraphLayout
Implements and performs particular graph-oriented algorithm of a UniversalGraph. CallGraphLayout.setResolvedNodeLocation
method for setting the resolved node location.- Parameters:
graph
- the universal graph on which the layout should be performed
-
performNodesLayout
Implements and performs particular location resolution of a collection of nodes in a UniversalGraph. CallGraphLayout.setResolvedNodeLocation
method for setting the resolved node location.- Parameters:
graph
- the universal graph on which the nodes should be resolvednodes
- the collection of nodes to be resolved
-