Class AggregateLayout<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.layout.AggregateLayout<V,E>
-
- Type Parameters:
V- the vertex typeE- the edge type
- All Implemented Interfaces:
Layout<V,E>,IterativeContext,org.apache.commons.collections4.Transformer<V,java.awt.geom.Point2D>
public class AggregateLayout<V,E> extends java.lang.Object implements Layout<V,E>, IterativeContext
ALayoutimplementation that combines multiple other layouts so that they may be manipulated as one layout. The relaxer thread will step each layout in sequence.
-
-
Constructor Summary
Constructors Constructor Description AggregateLayout(Layout<V,E> delegate)Creates an instance backed by the specifieddelegate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandone()Check all sublayouts.keySet() and the delegate layout, returning done == true iff all are done.java.awt.geom.Point2Dget(Layout<V,E> layout)Returns the center of the passed layout.Layout<V,E>getDelegate()edu.uci.ics.jung.graph.Graph<V,E>getGraph()Returns the graph for which this layout is defined.java.util.Map<Layout<V,E>,java.awt.geom.Point2D>getLayouts()Returns a map from eachLayoutinstance to its center point.java.awt.DimensiongetSize()Returns the size of the underlying layout.voidinitialize()Initializes fields in the node that may not have been set during the constructor.booleanisLocked(V v)Override to test if the passed vertex is locked in any of the layouts.voidlock(V v, boolean state)override to lock or unlock this vertex in any layout with a subgraph containing itvoidput(Layout<V,E> layout, java.awt.geom.Point2D center)adds the passed layout as a sublayout, also specifying the center of where this sublayout should appearvoidremove(Layout<V,E> layout)Removeslayoutfrom this instance.voidremoveAll()Removes all layouts from this instance.voidreset()voidsetDelegate(Layout<V,E> delegate)voidsetGraph(edu.uci.ics.jung.graph.Graph<V,E> graph)setter for graphvoidsetInitializer(org.apache.commons.collections4.Transformer<V,java.awt.geom.Point2D> initializer)provides initial locations for all vertices.voidsetLocation(V v, java.awt.geom.Point2D location)set the location of a vertexvoidsetSize(java.awt.Dimension d)voidstep()call step on any sublayout that is also an IterativeContext and is not donejava.awt.geom.Point2Dtransform(V v)Returns the location of the vertex.
-
-
-
Method Detail
-
setDelegate
public void setDelegate(Layout<V,E> delegate)
- Parameters:
delegate- the delegate to set
-
put
public void put(Layout<V,E> layout, java.awt.geom.Point2D center)
adds the passed layout as a sublayout, also specifying the center of where this sublayout should appear- Parameters:
layout-center-
-
get
public java.awt.geom.Point2D get(Layout<V,E> layout)
Returns the center of the passed layout.- Parameters:
layout-- Returns:
- the center of the passed layout
-
removeAll
public void removeAll()
Removes all layouts from this instance.
-
getGraph
public edu.uci.ics.jung.graph.Graph<V,E> getGraph()
Returns the graph for which this layout is defined.- Specified by:
getGraphin interfaceLayout<V,E>- Returns:
- the graph for which this layout is defined
- See Also:
Layout.getGraph()
-
getSize
public java.awt.Dimension getSize()
Returns the size of the underlying layout.- Specified by:
getSizein interfaceLayout<V,E>- Returns:
- the size of the underlying layout
- See Also:
Layout.getSize()
-
initialize
public void initialize()
Description copied from interface:LayoutInitializes fields in the node that may not have been set during the constructor. Must be called before the iterations begin.- Specified by:
initializein interfaceLayout<V,E>- See Also:
Layout.initialize()
-
isLocked
public boolean isLocked(V v)
Override to test if the passed vertex is locked in any of the layouts.- Specified by:
isLockedin interfaceLayout<V,E>- Parameters:
v-- Returns:
- true if v is locked in any of the layouts, and false otherwise
- See Also:
Layout.isLocked(java.lang.Object)
-
lock
public void lock(V v, boolean state)
override to lock or unlock this vertex in any layout with a subgraph containing it- Specified by:
lockin interfaceLayout<V,E>- Parameters:
v-state-- See Also:
Layout.lock(java.lang.Object, boolean)
-
reset
public void reset()
- Specified by:
resetin interfaceLayout<V,E>- See Also:
Layout.reset()
-
setGraph
public void setGraph(edu.uci.ics.jung.graph.Graph<V,E> graph)
Description copied from interface:Layoutsetter for graph- Specified by:
setGraphin interfaceLayout<V,E>- Parameters:
graph-- See Also:
Layout.setGraph(edu.uci.ics.jung.graph.Graph)
-
setInitializer
public void setInitializer(org.apache.commons.collections4.Transformer<V,java.awt.geom.Point2D> initializer)
Description copied from interface:Layoutprovides initial locations for all vertices.- Specified by:
setInitializerin interfaceLayout<V,E>- Parameters:
initializer-- See Also:
Layout.setInitializer(org.apache.commons.collections4.Transformer)
-
setLocation
public void setLocation(V v, java.awt.geom.Point2D location)
Description copied from interface:Layoutset the location of a vertex- Specified by:
setLocationin interfaceLayout<V,E>- Parameters:
v-location-- See Also:
Layout.setLocation(java.lang.Object, java.awt.geom.Point2D)
-
setSize
public void setSize(java.awt.Dimension d)
- Specified by:
setSizein interfaceLayout<V,E>- Parameters:
d-- See Also:
Layout.setSize(java.awt.Dimension)
-
getLayouts
public java.util.Map<Layout<V,E>,java.awt.geom.Point2D> getLayouts()
Returns a map from eachLayoutinstance to its center point.
-
transform
public java.awt.geom.Point2D transform(V v)
Returns the location of the vertex. The location is specified first by the sublayouts, and then by the base layout if no sublayouts operate on this vertex.
-
done
public boolean done()
Check all sublayouts.keySet() and the delegate layout, returning done == true iff all are done.- Specified by:
donein interfaceIterativeContext
-
step
public void step()
call step on any sublayout that is also an IterativeContext and is not done- Specified by:
stepin interfaceIterativeContext
-
-