Class ObservableCachingLayout<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.layout.LayoutDecorator<V,E>
-
- edu.uci.ics.jung.visualization.layout.ObservableCachingLayout<V,E>
-
- All Implemented Interfaces:
com.google.common.base.Function<V,java.awt.geom.Point2D>,Layout<V,E>,IterativeContext,LayoutEventSupport<V,E>,Caching,ChangeEventSupport,java.util.function.Function<V,java.awt.geom.Point2D>
- Direct Known Subclasses:
PersistentLayoutImpl
public class ObservableCachingLayout<V,E> extends LayoutDecorator<V,E> implements ChangeEventSupport, Caching, LayoutEventSupport<V,E>
A LayoutDecorator that fires ChangeEvents when certain methods are called. Used to wrap a Layout so that the visualization components can be notified of changes.- See Also:
LayoutDecorator
-
-
Field Summary
Fields Modifier and Type Field Description protected ChangeEventSupportchangeSupportprivate java.util.List<LayoutChangeListener<V,E>>layoutChangeListenersprotected com.google.common.cache.LoadingCache<V,java.awt.geom.Point2D>locations-
Fields inherited from class edu.uci.ics.jung.algorithms.layout.LayoutDecorator
delegate
-
-
Constructor Summary
Constructors Constructor Description ObservableCachingLayout(Layout<V,E> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(javax.swing.event.ChangeListener l)voidaddLayoutChangeListener(LayoutChangeListener<V,E> listener)java.awt.geom.Point2Dapply(V v)voidclear()clear cachebooleandone()private voidfireLayoutChanged(V v)voidfireStateChanged()javax.swing.event.ChangeListener[]getChangeListeners()Returns an array of all theChangeListeners added with addChangeListener().voidinit()ititialize resources for a cachevoidinitialize()Initializes fields in the node that may not have been set during the constructor.voidremoveChangeListener(javax.swing.event.ChangeListener l)Removes a ChangeListener.voidremoveLayoutChangeListener(LayoutChangeListener<V,E> listener)voidsetGraph(Graph<V,E> graph)voidsetLocation(V v, java.awt.geom.Point2D location)Changes the layout coordinates ofvtolocation.voidstep()Advances one step.-
Methods inherited from class edu.uci.ics.jung.algorithms.layout.LayoutDecorator
getDelegate, getGraph, getSize, isLocked, lock, reset, setDelegate, setInitializer, setSize, transform
-
-
-
-
Field Detail
-
changeSupport
protected ChangeEventSupport changeSupport
-
locations
protected com.google.common.cache.LoadingCache<V,java.awt.geom.Point2D> locations
-
layoutChangeListeners
private java.util.List<LayoutChangeListener<V,E>> layoutChangeListeners
-
-
Method Detail
-
step
public void step()
Description copied from interface:IterativeContextAdvances one step.- Specified by:
stepin interfaceIterativeContext- Overrides:
stepin classLayoutDecorator<V,E>
-
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>- Overrides:
initializein classLayoutDecorator<V,E>
-
done
public boolean done()
- Specified by:
donein interfaceIterativeContext- Overrides:
donein classLayoutDecorator<V,E>- Returns:
trueif this iterative process is finished, andfalseotherwise.
-
setLocation
public void setLocation(V v, java.awt.geom.Point2D location)
Description copied from interface:LayoutChanges the layout coordinates ofvtolocation.- Specified by:
setLocationin interfaceLayout<V,E>- Overrides:
setLocationin classLayoutDecorator<V,E>- Parameters:
v- the vertex whose location is to be specifiedlocation- the coordinates of the specified location
-
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener l)
- Specified by:
addChangeListenerin interfaceChangeEventSupport
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
Description copied from interface:ChangeEventSupportRemoves a ChangeListener.- Specified by:
removeChangeListenerin interfaceChangeEventSupport- Parameters:
l- the listener to be removed
-
getChangeListeners
public javax.swing.event.ChangeListener[] getChangeListeners()
Description copied from interface:ChangeEventSupportReturns an array of all theChangeListeners added with addChangeListener().- Specified by:
getChangeListenersin interfaceChangeEventSupport- Returns:
- all of the
ChangeListeners added or an empty array if no listeners have been added
-
fireStateChanged
public void fireStateChanged()
- Specified by:
fireStateChangedin interfaceChangeEventSupport
-
clear
public void clear()
Description copied from interface:Cachingclear cache
-
init
public void init()
Description copied from interface:Cachingititialize resources for a cache
-
apply
public java.awt.geom.Point2D apply(V v)
-
fireLayoutChanged
private void fireLayoutChanged(V v)
-
addLayoutChangeListener
public void addLayoutChangeListener(LayoutChangeListener<V,E> listener)
- Specified by:
addLayoutChangeListenerin interfaceLayoutEventSupport<V,E>
-
removeLayoutChangeListener
public void removeLayoutChangeListener(LayoutChangeListener<V,E> listener)
- Specified by:
removeLayoutChangeListenerin interfaceLayoutEventSupport<V,E>
-
-