Class DefaultLayoutModel<V>
- java.lang.Object
-
- org.jungrapht.visualization.layout.model.AbstractLayoutModel<V>
-
- org.jungrapht.visualization.layout.model.DefaultLayoutModel<V>
-
- Type Parameters:
V- the vertex type
- All Implemented Interfaces:
Function<V,Point>,LayoutSizeChange.Producer<V>,LayoutStateChange.Producer,LayoutVertexPositionChange.Listener<V>,LayoutVertexPositionChange.Producer<V>,ModelChange.Producer,ViewChange.Producer,LayoutModel<V>,Caching
public class DefaultLayoutModel<V> extends AbstractLayoutModel<V> implements LayoutModel<V>, Caching
A LayoutModel that uses a ConcurrentHashMap. Values not already in the Map are loaded with an initializer and computeIfAbsent.- Author:
- Tom Nelson
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jungrapht.visualization.layout.model.AbstractLayoutModel
AbstractLayoutModel.Builder<V,T extends AbstractLayoutModel<V>,B extends AbstractLayoutModel.Builder<V,T,B>>
-
Nested classes/interfaces inherited from interface org.jungrapht.visualization.layout.model.LayoutModel
LayoutModel.Builder<V,T extends DefaultLayoutModel<V>,B extends LayoutModel.Builder<V,T,B>>
-
-
Field Summary
Fields Modifier and Type Field Description protected Function<V,Point>initializerprotected Map<V,Point>locations-
Fields inherited from class org.jungrapht.visualization.layout.model.AbstractLayoutModel
appendageCount, createVisRunnable, graph, height, initialDimensionFunction, layoutSizeChangeSupport, layoutStateChangeSupport, layoutVertexPositionSupport, locked, lockedVertices, modelChangeSupport, preferredHeight, preferredWidth, relaxing, viewChangeSupport, visRunnable, width
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultLayoutModel(LayoutModel.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Pointapply(V vertex)voidclear()clear cachestatic <V> DefaultLayoutModel<V>from(LayoutModel<V> other)Pointget(V vertex)Map<V,Point>getLocations()voidset(V vertex, double x, double y)Changes the layout coordinates ofvertextox, y.voidset(V vertex, Point location)Changes the layout coordinates ofvertextolocation.voidsetGraph(org.jgrapht.Graph<V,?> graph)voidsetInitializer(Function<V,Point> initializer)-
Methods inherited from class org.jungrapht.visualization.layout.model.AbstractLayoutModel
accept, appendLayoutModel, getGraph, getHeight, getLayoutSizeChangeSupport, getLayoutStateChangeSupport, getLayoutVertexPositionSupport, getModelChangeSupport, getPreferredHeight, getPreferredWidth, getViewChangeSupport, getWidth, isLocked, isLocked, isRelaxing, layoutVertexPositionChanged, layoutVertexPositionChanged, lock, lock, offsetvertex, resizeToSurroundingRectangle, setInitialDimensionFunction, setPreferredSize, setRelaxing, setSize, setSize, setupVisRunner, stop, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jungrapht.visualization.layout.model.LayoutModel
accept, appendLayoutModel, getCenter, getGraph, getHeight, getPreferredHeight, getPreferredWidth, getWidth, isLocked, isLocked, isRelaxing, lock, lock, resizeToSurroundingRectangle, setFireEvents, setInitialDimensionFunction, setPreferredSize, setRelaxing, setSize, stop
-
Methods inherited from interface org.jungrapht.visualization.layout.event.LayoutSizeChange.Producer
getLayoutSizeChangeSupport
-
Methods inherited from interface org.jungrapht.visualization.layout.event.LayoutStateChange.Producer
getLayoutStateChangeSupport
-
Methods inherited from interface org.jungrapht.visualization.layout.event.LayoutVertexPositionChange.Listener
layoutVertexPositionChanged, layoutVertexPositionChanged
-
Methods inherited from interface org.jungrapht.visualization.layout.event.LayoutVertexPositionChange.Producer
getLayoutVertexPositionSupport
-
Methods inherited from interface org.jungrapht.visualization.layout.event.ModelChange.Producer
getModelChangeSupport
-
Methods inherited from interface org.jungrapht.visualization.layout.event.ViewChange.Producer
getViewChangeSupport
-
-
-
-
Constructor Detail
-
DefaultLayoutModel
protected DefaultLayoutModel(LayoutModel.Builder builder)
-
-
Method Detail
-
from
public static <V> DefaultLayoutModel<V> from(LayoutModel<V> other)
-
setInitializer
public void setInitializer(Function<V,Point> initializer)
- Specified by:
setInitializerin interfaceLayoutModel<V>
-
getLocations
public Map<V,Point> getLocations()
- Specified by:
getLocationsin interfaceLayoutModel<V>- Returns:
- a mapping of Vertices to Point locations
-
set
public void set(V vertex, Point location)
Description copied from interface:LayoutModelChanges the layout coordinates ofvertextolocation.- Specified by:
setin interfaceLayoutModel<V>- Overrides:
setin classAbstractLayoutModel<V>- Parameters:
vertex- the vertex whose location is to be specifiedlocation- the coordinates of the specified location
-
setGraph
public void setGraph(org.jgrapht.Graph<V,?> graph)
- Specified by:
setGraphin interfaceLayoutModel<V>- Overrides:
setGraphin classAbstractLayoutModel<V>- Parameters:
graph- theGraphto set
-
set
public void set(V vertex, double x, double y)
Description copied from interface:LayoutModelChanges the layout coordinates ofvertextox, y.- Specified by:
setin interfaceLayoutModel<V>- Overrides:
setin classAbstractLayoutModel<V>- Parameters:
vertex- the vertex to set location forx- coordinate to sety- coordinate to set
-
get
public Point get(V vertex)
- Specified by:
getin interfaceLayoutModel<V>- Parameters:
vertex- the vertex of interest- Returns:
- the Point location for vertex
-
-