public class PersistentLayoutImpl extends LayoutDecorator implements PersistentLayout
PersistentLayout.Point
Modifier and Type | Field and Description |
---|---|
protected ChangeEventSupport |
changeSupport |
protected java.util.Set |
dontmove
a collection of Vertices that should not move
|
protected RadiusGraphElementAccessor |
elementAccessor |
protected java.lang.Object |
key
a key for this class
|
protected boolean |
locked
whether the graph is locked (stops the VisualizationViewer rendering thread)
|
protected java.util.Map |
map
a container for Vertices
|
delegate
Constructor and Description |
---|
PersistentLayoutImpl(Layout layout)
create an instance with a passed layout
create containers for graph components
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(javax.swing.event.ChangeListener l) |
void |
fireStateChanged() |
java.lang.Object |
getBaseKey()
Returns a visualization-specific key (that is, specific to
the layout in use) that can be used to access
UserData related to the AbstractLayout.
|
javax.swing.event.ChangeListener[] |
getChangeListeners()
Returns an array of all the
ChangeListener s added
with addChangeListener(). |
boolean |
incrementsAreDone()
If this visualization is incremental, tells whether it has
stabilized at a satisfactory spot yet.
|
protected void |
initializeLocation(Vertex v,
Coordinates coord,
java.awt.Dimension d)
Sets persisted location for a vertex within the dimensions of the space.
|
protected void |
initializeLocations()
This method calls initialize_local_vertex for each vertex, and
also adds initial coordinate information for each vertex.
|
void |
lock(boolean locked) |
void |
lockVertex(Vertex v)
Sets a flag which fixes this vertex in place.
|
void |
persist(java.lang.String fileName)
save the Vertex locations to a file
|
void |
removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener.
|
void |
restore(java.lang.String fileName)
Restore the graph Vertex locations from a file
|
void |
unlockVertex(Vertex v)
Allows this vertex to be moved.
|
void |
update() |
advancePositions, applyFilter, forceMove, getCurrentSize, getDelegate, getGraph, getLocation, getStatus, getVertex, getVertex, getVertexIterator, getVisibleEdges, getVisibleVertices, getX, getY, initialize, isIncremental, isLocked, resize, restart, setDelegate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
advancePositions, applyFilter, forceMove, getCurrentSize, getGraph, getLocation, getStatus, getVertex, getVertex, getVisibleEdges, getVisibleVertices, getX, getY, initialize, isIncremental, isLocked, resize, restart
getVertexIterator
protected ChangeEventSupport changeSupport
protected java.util.Map map
protected java.lang.Object key
protected java.util.Set dontmove
protected boolean locked
protected RadiusGraphElementAccessor elementAccessor
public PersistentLayoutImpl(Layout layout)
layout
- protected void initializeLocations()
protected void initializeLocation(Vertex v, Coordinates coord, java.awt.Dimension d)
v
- coord
- d
- public void persist(java.lang.String fileName) throws java.io.IOException
persist
in interface PersistentLayout
fileName
- the file to save toan
- IOException if the file cannot be usedjava.io.IOException
public void restore(java.lang.String fileName) throws java.io.IOException, java.lang.ClassNotFoundException
restore
in interface PersistentLayout
fileName
- the file to usejava.io.IOException
- for file problemsjava.lang.ClassNotFoundException
- for classpath problemspublic void lock(boolean locked)
lock
in interface PersistentLayout
public boolean incrementsAreDone()
Layout
incrementsAreDone
in interface Layout
incrementsAreDone
in class LayoutDecorator
Layout.incrementsAreDone()
public void lockVertex(Vertex v)
Layout
lockVertex
in interface Layout
lockVertex
in class LayoutDecorator
v
- vertexLayout.lockVertex(edu.uci.ics.jung.graph.Vertex)
public void unlockVertex(Vertex v)
Layout
unlockVertex
in interface Layout
unlockVertex
in class LayoutDecorator
v
- vertexLayout.unlockVertex(edu.uci.ics.jung.graph.Vertex)
public java.lang.Object getBaseKey()
public void update()
public void addChangeListener(javax.swing.event.ChangeListener l)
addChangeListener
in interface ChangeEventSupport
addChangeListener
in class LayoutDecorator
public void removeChangeListener(javax.swing.event.ChangeListener l)
ChangeEventSupport
removeChangeListener
in interface ChangeEventSupport
removeChangeListener
in class LayoutDecorator
l
- the listener to be removedpublic javax.swing.event.ChangeListener[] getChangeListeners()
ChangeEventSupport
ChangeListener
s added
with addChangeListener().getChangeListeners
in interface ChangeEventSupport
getChangeListeners
in class LayoutDecorator
ChangeListener
s added or an empty
array if no listeners have been addedpublic void fireStateChanged()
fireStateChanged
in interface ChangeEventSupport
fireStateChanged
in class LayoutDecorator