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.- Author:
- Tom Nelson
- See Also:
LayoutDecorator
-
-
Field Summary
Fields Modifier and Type Field Description protected ChangeEventSupport
changeSupport
protected 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 void
addChangeListener(javax.swing.event.ChangeListener l)
void
addLayoutChangeListener(LayoutChangeListener<V,E> listener)
java.awt.geom.Point2D
apply(V v)
void
clear()
clear cacheboolean
done()
void
fireStateChanged()
javax.swing.event.ChangeListener[]
getChangeListeners()
Returns an array of all theChangeListener
s added with addChangeListener().void
init()
ititialize resources for a cachevoid
initialize()
Initializes fields in the node that may not have been set during the constructor.void
removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener.void
removeLayoutChangeListener(LayoutChangeListener<V,E> listener)
void
setGraph(Graph<V,E> graph)
void
setLocation(V v, java.awt.geom.Point2D location)
Changes the layout coordinates ofv
tolocation
.void
step()
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
-
-
Method Detail
-
step
public void step()
Description copied from interface:IterativeContext
Advances one step.- Specified by:
step
in interfaceIterativeContext
- Overrides:
step
in classLayoutDecorator<V,E>
-
initialize
public void initialize()
Description copied from interface:Layout
Initializes fields in the node that may not have been set during the constructor. Must be called before the iterations begin.- Specified by:
initialize
in interfaceLayout<V,E>
- Overrides:
initialize
in classLayoutDecorator<V,E>
-
done
public boolean done()
- Specified by:
done
in interfaceIterativeContext
- Overrides:
done
in classLayoutDecorator<V,E>
- Returns:
true
if this iterative process is finished, andfalse
otherwise.
-
setLocation
public void setLocation(V v, java.awt.geom.Point2D location)
Description copied from interface:Layout
Changes the layout coordinates ofv
tolocation
.- Specified by:
setLocation
in interfaceLayout<V,E>
- Overrides:
setLocation
in 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:
addChangeListener
in interfaceChangeEventSupport
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
Description copied from interface:ChangeEventSupport
Removes a ChangeListener.- Specified by:
removeChangeListener
in interfaceChangeEventSupport
- Parameters:
l
- the listener to be removed
-
getChangeListeners
public javax.swing.event.ChangeListener[] getChangeListeners()
Description copied from interface:ChangeEventSupport
Returns an array of all theChangeListener
s added with addChangeListener().- Specified by:
getChangeListeners
in interfaceChangeEventSupport
- Returns:
- all of the
ChangeListener
s added or an empty array if no listeners have been added
-
fireStateChanged
public void fireStateChanged()
- Specified by:
fireStateChanged
in interfaceChangeEventSupport
-
clear
public void clear()
Description copied from interface:Caching
clear cache
-
init
public void init()
Description copied from interface:Caching
ititialize resources for a cache
-
apply
public java.awt.geom.Point2D apply(V v)
-
addLayoutChangeListener
public void addLayoutChangeListener(LayoutChangeListener<V,E> listener)
- Specified by:
addLayoutChangeListener
in interfaceLayoutEventSupport<V,E>
-
removeLayoutChangeListener
public void removeLayoutChangeListener(LayoutChangeListener<V,E> listener)
- Specified by:
removeLayoutChangeListener
in interfaceLayoutEventSupport<V,E>
-
-