Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.uci.ics.jung.visualization
Class PersistentLayoutImpl

    java.lang.Object
      edu.uci.ics.jung.visualization.LayoutDecorator
          edu.uci.ics.jung.visualization.PersistentLayoutImpl

All Implemented Interfaces:
  ChangeEventSupport, Layout, PersistentLayout, VertexLocationFunction

public class PersistentLayoutImpl
extends LayoutDecorator
implements PersistentLayout

Implementation of PersistentLayout. Defers to another layout until 'restore' is called, then it uses the saved vertex locations

Author:
  Tom Nelson - RABA Technologies

Nested Class Summary

Nested classes inherited from class edu.uci.ics.jung.visualization.PersistentLayout
`PersistentLayout.Point`

Field Summary
`protected ChangeEventSupport` | `changeSupport`
`protected Set` | `dontmove` a collection of Vertices that should not move
`protected RadiusGraphElementAccessor` | `elementAccessor`
`protected Object` | `key` a key for this class
`protected boolean` | `locked` whether the graph is locked (stops the VisualizationViewer rendering thread)
`protected Map` | `map` a container for Vertices

Fields inherited from class edu.uci.ics.jung.visualization.LayoutDecorator
`delegate`

Constructor Summary
`PersistentLayoutImpl(Layout layout)` create an instance with a passed layout create containers for graph components

Method Summary
`void` | `addChangeListener(ChangeListener l)`
`void` | `fireStateChanged()`
`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`.
`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, 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(String fileName)` save the Vertex locations to a file
`void` | `removeChangeListener(ChangeListener l)` Removes a ChangeListener.
`void` | `restore(String fileName)` Restore the graph Vertex locations from a file
`void` | `unlockVertex(Vertex v)` Allows this vertex to be moved.
`void` | `update()`

Methods inherited from class edu.uci.ics.jung.visualization.LayoutDecorator
`advancePositions, applyFilter, forceMove, getCurrentSize, getDelegate, getGraph, getLocation, getStatus, getVertex, getVertex, getVertexIterator, getVisibleEdges, getVisibleVertices, getX, getY, initialize, isIncremental, isLocked, resize, restart, setDelegate`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface edu.uci.ics.jung.visualization.Layout
`advancePositions, applyFilter, forceMove, getCurrentSize, getGraph, getLocation, getStatus, getVertex, getVertex, getVisibleEdges, getVisibleVertices, getX, getY, initialize, isIncremental, isLocked, resize, restart`

Methods inherited from interface edu.uci.ics.jung.visualization.VertexLocationFunction
`getVertexIterator`

Field Detail

### changeSupport

    protected ChangeEventSupport changeSupport

### map

    protected Map map

  a container for Vertices

### key

    protected Object key

  a key for this class

### dontmove

    protected Set dontmove

  a collection of Vertices that should not move

### locked

    protected boolean locked

  whether the graph is locked (stops the VisualizationViewer rendering thread)

### elementAccessor

    protected RadiusGraphElementAccessor elementAccessor

Constructor Detail

### PersistentLayoutImpl

    public PersistentLayoutImpl(Layout layout)

  create an instance with a passed layout create containers for graph components

Parameters:
  `layout` -

Method Detail

### initializeLocations

    protected void initializeLocations()

  This method calls `initialize_local_vertex` for each vertex, and also adds initial coordinate information for each vertex. (The vertex's initial location is set by calling `initializeLocation`.

### initializeLocation

    protected void initializeLocation(Vertex v,
                                      Coordinates coord,
                                      Dimension d)

  Sets persisted location for a vertex within the dimensions of the space. If the vertex has not been persisted, sets a random location. If you want to initialize in some different way, override this method.

  Parameters:
    `v` -
    `coord` -
    `d` -

### persist

    public void persist(String fileName)
                 throws IOException

  save the Vertex locations to a file

  Specified by:
    `persist` in interface `PersistentLayout`
  Parameters:
    `fileName` - the file to save to
  Throws:
    `an` - IOException if the file cannot be used
    `IOException`

### restore

    public void restore(String fileName)
                 throws IOException,
                        ClassNotFoundException

  Restore the graph Vertex locations from a file

  Specified by:
    `restore` in interface `PersistentLayout`
  Parameters:
    `fileName` - the file to use
  Throws:
    `IOException` - for file problems
    `ClassNotFoundException` - for classpath problems

### lock

    public void lock(boolean locked)

  Specified by:
    `lock` in interface `PersistentLayout`

### incrementsAreDone

    public boolean incrementsAreDone()

  Description copied from interface: `Layout`
  If this visualization is incremental, tells whether it has stabilized at a satisfactory spot yet.

  Specified by:
    `incrementsAreDone` in interface `Layout`
  Overrides:
    `incrementsAreDone` in class `LayoutDecorator`
  See Also:
    `Layout.incrementsAreDone()`

### lockVertex

    public void lockVertex(Vertex v)

  Description copied from interface: `Layout`
  Sets a flag which fixes this vertex in place.

  Specified by:
    `lockVertex` in interface `Layout`
  Overrides:
    `lockVertex` in class `LayoutDecorator`
  See Also:
    `Layout.lockVertex(edu.uci.ics.jung.graph.Vertex)`

### unlockVertex

    public void unlockVertex(Vertex v)

  Description copied from interface: `Layout`
  Allows this vertex to be moved.

  Specified by:
    `unlockVertex` in interface `Layout`
  Overrides:
    `unlockVertex` in class `LayoutDecorator`
  See Also:
    `Layout.unlockVertex(edu.uci.ics.jung.graph.Vertex)`

### getBaseKey

    public 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`.

### update

    public void update()

### addChangeListener

    public void addChangeListener(ChangeListener l)

  Specified by:
    `addChangeListener` in interface `ChangeEventSupport`
  Overrides:
    `addChangeListener` in class `LayoutDecorator`

### removeChangeListener

    public void removeChangeListener(ChangeListener l)

  Description copied from interface: `ChangeEventSupport`
  Removes a ChangeListener.

  Specified by:
    `removeChangeListener` in interface `ChangeEventSupport`
  Overrides:
    `removeChangeListener` in class `LayoutDecorator`

### getChangeListeners

    public ChangeListener[] getChangeListeners()

  Description copied from interface: `ChangeEventSupport`
  Returns an array of all the `ChangeListener`s added with addChangeListener().

  Specified by:
    `getChangeListeners` in interface `ChangeEventSupport`
  Overrides:
    `getChangeListeners` in class `LayoutDecorator`

### fireStateChanged

    public void fireStateChanged()

  Specified by:
    `fireStateChanged` in interface `ChangeEventSupport`
  Overrides:
    `fireStateChanged` in class `LayoutDecorator`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD