Class AbstractTreeLayoutAlgorithm<V>
- java.lang.Object
 - 
- org.jungrapht.visualization.layout.algorithms.AbstractLayoutAlgorithm<V>
 - 
- org.jungrapht.visualization.layout.algorithms.AbstractTreeLayoutAlgorithm<V>
 
 
 
- 
- Type Parameters:
 V- vertex type
- All Implemented Interfaces:
 Consumer<Function<V,Rectangle>>,LayoutAlgorithm<V>,TreeLayout<V>,AfterRunnable,VertexBoundsFunctionConsumer<V>
- Direct Known Subclasses:
 TidierTreeLayoutAlgorithm,TreeLayoutAlgorithm
public abstract class AbstractTreeLayoutAlgorithm<V> extends AbstractLayoutAlgorithm<V> implements LayoutAlgorithm<V>, TreeLayout<V>
A base class for tree layout algorithms. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractTreeLayoutAlgorithm.Builder<V,T extends AbstractTreeLayoutAlgorithm<V>,B extends AbstractTreeLayoutAlgorithm.Builder<V,T,B>>ABuilderto create instances ofAbstractTreeLayoutAlgorithm- 
Nested classes/interfaces inherited from interface org.jungrapht.visualization.layout.algorithms.LayoutAlgorithm
LayoutAlgorithm.NoOp<V> 
 - 
 
- 
Field Summary
Fields Modifier and Type Field Description protected Map<V,Rectangle>baseBoundsa {}@link Map} of vertex to aRectanglethat will contain the vertex and all of its childrenprotected booleancorrectOverlapiftruethen move vertices that overlap non-incident edgesprotected Predicate<V>defaultRootPredicateprotected booleanexpandLayoutiftruethen expand the layout size to accomodate the entire tree.protected inthorizontalVertexSpacingThe horizontal vertex spacing.protected org.jgrapht.alg.util.NeighborCache<V,?>neighborCacheprotected Comparator<V>rootComparatorprotected Predicate<V>rootPredicatethe {}@link Predicate} to determine root verticesprotected Function<V,Rectangle>vertexBoundsFunctionif provided (non-null) then the horizontalVertexSpacing and verticalVertexSpacing values will be replaced by 2 times the average width and height of all vertex shapesprotected intverticalVertexSpacingThe vertical vertex spacing.protected Set<V>visitedVertices- 
Fields inherited from class org.jungrapht.visualization.layout.algorithms.AbstractLayoutAlgorithm
after 
- 
Fields inherited from interface org.jungrapht.visualization.layout.algorithms.TreeLayout
TREE_LAYOUT_HORIZONTAL_SPACING, TREE_LAYOUT_VERTICAL_SPACING 
 - 
 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTreeLayoutAlgorithm(AbstractTreeLayoutAlgorithm.Builder<V,?,?> builder)Create aAbstractTreeLayoutAlgorithminstance with the passedBuilder 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidadjustToFill(int largerWidth, int largerHeight)booleanconstrained()protected voidexpandToFill(LayoutModel<V> layoutModel)Map<V,Rectangle>getBaseBounds()protected <E> intmoveVerticesThatOverlapVerticalEdges(LayoutModel<V> layoutModel, int offset)voidsetRootComparator(Comparator<V> rootComparator)voidsetRootPredicate(Predicate<V> rootPredicate)voidsetVertexBoundsFunction(Function<V,Rectangle> vertexBoundsFunction)voidvisit(LayoutModel<V> layoutModel)visit aLayoutModelto set all of the graph vertex positions according to the LayoutAlgorithm logic.- 
Methods inherited from class org.jungrapht.visualization.layout.algorithms.AbstractLayoutAlgorithm
computeAverageVertexDimension, computeLayoutExtent, expandToFill, runAfter, setAfter 
- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface org.jungrapht.visualization.layout.algorithms.util.AfterRunnable
runAfter, setAfter 
- 
Methods inherited from interface org.jungrapht.visualization.layout.algorithms.LayoutAlgorithm
cancel 
- 
Methods inherited from interface org.jungrapht.visualization.layout.algorithms.util.VertexBoundsFunctionConsumer
accept 
 - 
 
 - 
 
- 
- 
Field Detail
- 
rootPredicate
protected Predicate<V> rootPredicate
the {}@link Predicate} to determine root vertices 
- 
rootComparator
protected Comparator<V> rootComparator
 
- 
neighborCache
protected org.jgrapht.alg.util.NeighborCache<V,?> neighborCache
 
- 
baseBounds
protected Map<V,Rectangle> baseBounds
a {}@link Map} of vertex to aRectanglethat will contain the vertex and all of its children 
- 
horizontalVertexSpacing
protected int horizontalVertexSpacing
The horizontal vertex spacing. Defaults toDEFAULT_HORIZONTAL_VERTEX_SPACING. 
- 
verticalVertexSpacing
protected int verticalVertexSpacing
The vertical vertex spacing. Defaults toDEFAULT_VERTICAL_VERTEX_SPACING. 
- 
vertexBoundsFunction
protected Function<V,Rectangle> vertexBoundsFunction
if provided (non-null) then the horizontalVertexSpacing and verticalVertexSpacing values will be replaced by 2 times the average width and height of all vertex shapes 
- 
expandLayout
protected boolean expandLayout
iftruethen expand the layout size to accomodate the entire tree. 
- 
correctOverlap
protected boolean correctOverlap
iftruethen move vertices that overlap non-incident edges 
 - 
 
- 
Constructor Detail
- 
AbstractTreeLayoutAlgorithm
protected AbstractTreeLayoutAlgorithm(AbstractTreeLayoutAlgorithm.Builder<V,?,?> builder)
Create aAbstractTreeLayoutAlgorithminstance with the passedBuilder- Parameters:
 builder- theBuilderwith configuration properties
 
 - 
 
- 
Method Detail
- 
setRootPredicate
public void setRootPredicate(Predicate<V> rootPredicate)
- Specified by:
 setRootPredicatein interfaceTreeLayout<V>
 
- 
setRootComparator
public void setRootComparator(Comparator<V> rootComparator)
- Specified by:
 setRootComparatorin interfaceTreeLayout<V>
 
- 
setVertexBoundsFunction
public void setVertexBoundsFunction(Function<V,Rectangle> vertexBoundsFunction)
- Specified by:
 setVertexBoundsFunctionin interfaceVertexBoundsFunctionConsumer<V>
 
- 
visit
public void visit(LayoutModel<V> layoutModel)
visit aLayoutModelto set all of the graph vertex positions according to the LayoutAlgorithm logic.- Specified by:
 visitin interfaceLayoutAlgorithm<V>- Parameters:
 layoutModel- the mediator between the container for vertices (the Graph) and the mapping
 
- 
getBaseBounds
public Map<V,Rectangle> getBaseBounds()
- Specified by:
 getBaseBoundsin interfaceTreeLayout<V>- Returns:
 - the 
Mapof vertex toRectanglethat will hold all of the subtree rooted at the vertex 
 
- 
adjustToFill
protected void adjustToFill(int largerWidth, int largerHeight) 
- 
expandToFill
protected void expandToFill(LayoutModel<V> layoutModel)
- Parameters:
 layoutModel-
 
- 
moveVerticesThatOverlapVerticalEdges
protected <E> int moveVerticesThatOverlapVerticalEdges(LayoutModel<V> layoutModel, int offset)
 
- 
constrained
public boolean constrained()
- Specified by:
 constrainedin interfaceLayoutAlgorithm<V>
 
 - 
 
 -