edu.uci.ics.jung.visualization.layout
Class ObservableCachingLayout<V,E>

java.lang.Object
  extended by edu.uci.ics.jung.algorithms.layout.LayoutDecorator<V,E>
      extended by edu.uci.ics.jung.visualization.layout.ObservableCachingLayout<V,E>
All Implemented Interfaces:
Layout<V,E>, IterativeContext, Caching, ChangeEventSupport, org.apache.commons.collections15.Transformer<V,Point2D>
Direct Known Subclasses:
PersistentLayoutImpl

public class ObservableCachingLayout<V,E>
extends LayoutDecorator<V,E>
implements ChangeEventSupport, Caching

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
protected  ChangeEventSupport changeSupport
           
protected  Map<V,Point2D> locationMap
           
 
Fields inherited from class edu.uci.ics.jung.algorithms.layout.LayoutDecorator
delegate
 
Constructor Summary
ObservableCachingLayout(Layout<V,E> delegate)
           
 
Method Summary
 void addChangeListener(ChangeListener l)
           
 void clear()
          clear cache
 boolean done()
          Returns true if this iterative process is finished, and false otherwise.
 void fireStateChanged()
           
 ChangeListener[] getChangeListeners()
          Returns an array of all the ChangeListeners added with addChangeListener().
 void init()
          ititialize resources for a cache
 void initialize()
          Initializes fields in the node that may not have been set during the constructor.
 void removeChangeListener(ChangeListener l)
          Removes a ChangeListener.
 void setGraph(Graph<V,E> graph)
          setter for graph
 void setLocation(V v, Point2D location)
          set the location of a vertex
 void step()
          Advances one step.
 Point2D transform(V v)
           
 
Methods inherited from class edu.uci.ics.jung.algorithms.layout.LayoutDecorator
getDelegate, getGraph, getSize, isLocked, lock, reset, setDelegate, setInitializer, setSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

changeSupport

protected ChangeEventSupport changeSupport

locationMap

protected Map<V,Point2D> locationMap
Constructor Detail

ObservableCachingLayout

public ObservableCachingLayout(Layout<V,E> delegate)
Method Detail

step

public void step()
Description copied from interface: IterativeContext
Advances one step.

Specified by:
step in interface IterativeContext
Overrides:
step in class LayoutDecorator<V,E>
See Also:
edu.uci.ics.jung.algorithms.layout.Layout#step()

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 interface Layout<V,E>
Overrides:
initialize in class LayoutDecorator<V,E>
See Also:
Layout.initialize()

done

public boolean done()
Description copied from interface: IterativeContext
Returns true if this iterative process is finished, and false otherwise.

Specified by:
done in interface IterativeContext
Overrides:
done in class LayoutDecorator<V,E>
See Also:
IterativeContext.done()

setLocation

public void setLocation(V v,
                        Point2D location)
Description copied from interface: Layout
set the location of a vertex

Specified by:
setLocation in interface Layout<V,E>
Overrides:
setLocation in class LayoutDecorator<V,E>
Parameters:
v -
location -
See Also:
Layout.setLocation(java.lang.Object, java.awt.geom.Point2D)

addChangeListener

public void addChangeListener(ChangeListener l)
Specified by:
addChangeListener in interface ChangeEventSupport

removeChangeListener

public void removeChangeListener(ChangeListener l)
Description copied from interface: ChangeEventSupport
Removes a ChangeListener.

Specified by:
removeChangeListener in interface ChangeEventSupport
Parameters:
l - the listener to be removed

getChangeListeners

public ChangeListener[] getChangeListeners()
Description copied from interface: ChangeEventSupport
Returns an array of all the ChangeListeners added with addChangeListener().

Specified by:
getChangeListeners in interface ChangeEventSupport
Returns:
all of the ChangeListeners added or an empty array if no listeners have been added

fireStateChanged

public void fireStateChanged()
Specified by:
fireStateChanged in interface ChangeEventSupport

setGraph

public void setGraph(Graph<V,E> graph)
Description copied from interface: Layout
setter for graph

Specified by:
setGraph in interface Layout<V,E>
Overrides:
setGraph in class LayoutDecorator<V,E>

clear

public void clear()
Description copied from interface: Caching
clear cache

Specified by:
clear in interface Caching

init

public void init()
Description copied from interface: Caching
ititialize resources for a cache

Specified by:
init in interface Caching

transform

public Point2D transform(V v)
Specified by:
transform in interface org.apache.commons.collections15.Transformer<V,Point2D>
Overrides:
transform in class LayoutDecorator<V,E>
See Also:
Transformer.transform(Object)


Copyright © 2009. All Rights Reserved.