Class HierarchyLayoutAlgorithm
- java.lang.Object
-
- org.opennms.features.topology.app.internal.jung.AbstractLayoutAlgorithm
-
- org.opennms.features.topology.app.internal.jung.HierarchyLayoutAlgorithm
-
- All Implemented Interfaces:
LayoutAlgorithm
,LayoutConstants
public class HierarchyLayoutAlgorithm extends AbstractLayoutAlgorithm
Algorithm to transform a graph of vertices and edges into a hierarchical structure of a 2D plane. It is a geometric transformation which does not change the graph but the x and y position of its vertices.
The algorithm generates the layout correctly if only one root element exists or if there are no vertices at all If no root element exists, a random vertex from the graph is picked and defined as root. If multiple root elements exist, a parent of those is created and called dummy root element. This ensures that there is only one root element.
The current graph to be transformed is extracted from the
The Algorithm uses the JUNG library.GraphContainer
. Basically all its vertices are transformed and then the new layout is set back to the GraphContainer by executing theupdateLayout
method.
-
-
Field Summary
-
Fields inherited from interface org.opennms.features.topology.app.internal.jung.LayoutConstants
ELBOW_ROOM, LAYOUT_HEIGHT, LAYOUT_WIDTH, SPRING_FORCE_MULTIPLIER, SPRING_LAYOUT_REPULSION
-
-
Constructor Summary
Constructors Constructor Description HierarchyLayoutAlgorithm()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
updateLayout(Graph graph)
Updates the current layout by extracting the containers graph and then perform a (x,y) tranformation of all vertices.-
Methods inherited from class org.opennms.features.topology.app.internal.jung.AbstractLayoutAlgorithm
initializer, initializer, selectLayoutSize
-
-
-
-
Method Detail
-
updateLayout
public void updateLayout(Graph graph)
Updates the current layout by extracting the containers graph and then perform a (x,y) tranformation of all vertices.- Specified by:
updateLayout
in interfaceLayoutAlgorithm
- Specified by:
updateLayout
in classAbstractLayoutAlgorithm
- Parameters:
graph
- The container of the current graph. Contains all relevant information to perform the transformation of theGraph
by changing itsLayout
-
-