Class HierarchyLayout<V,E>
- java.lang.Object
-
- org.opennms.features.topology.app.internal.jung.HierarchyLayout<V,E>
-
- Type Parameters:
V
-E
-
- All Implemented Interfaces:
edu.uci.ics.jung.algorithms.layout.Layout<V,E>
,org.apache.commons.collections15.Transformer<V,Point2D>
public class HierarchyLayout<V,E> extends Object implements edu.uci.ics.jung.algorithms.layout.Layout<V,E>
A custom layout to be able to draw a hierarchy. This implementation is inspired byTreeLayout
, which only works if 2 parents do not have the same child (seeTreeUtils.getRoots(Forest)
).
-
-
Constructor Summary
Constructors Constructor Description HierarchyLayout(edu.uci.ics.jung.graph.Graph<V,E> g, int distx, int disty)
Creates an instance for the specified graph, X distance, and Y distance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description edu.uci.ics.jung.graph.Graph<V,E>
getGraph()
Dimension
getSize()
void
horizontalSqueeze(List<V> vertices)
Shifts the vertices horizontally ensuring that there is no more than "distx" units between each column of vertices.void
initialize()
boolean
isLocked(V v)
void
lock(V v, boolean state)
void
reset()
void
setGraph(edu.uci.ics.jung.graph.Graph<V,E> graph)
void
setInitializer(org.apache.commons.collections15.Transformer<V,Point2D> initializer)
void
setLocation(V v, Point2D location)
void
setSize(Dimension d)
Point2D
transform(V v)
-
-
-
Method Detail
-
horizontalSqueeze
public void horizontalSqueeze(List<V> vertices)
Shifts the vertices horizontally ensuring that there is no more than "distx" units between each column of vertices. The resulting layout is a denser visual that maintains the existing structure of the original layout. For the purposes of this algorithm, vertices with the same value of the X coordinate are deemed to be in the same "column".- Parameters:
vertices
- list of vertices that will be displayed
-
getSize
public Dimension getSize()
-
initialize
public void initialize()
-
isLocked
public boolean isLocked(V v)
-
lock
public void lock(V v, boolean state)
-
reset
public void reset()
-
setSize
public void setSize(Dimension d)
-
setInitializer
public void setInitializer(org.apache.commons.collections15.Transformer<V,Point2D> initializer)
-
-