Class PersistentLayoutImpl<V,​E>

    • Field Detail

      • dontmove

        protected java.util.Set<V> dontmove
        a collection of Vertices that should not move
      • locked

        protected boolean locked
        whether the graph is locked (stops the VisualizationViewer rendering thread)
    • Constructor Detail

      • PersistentLayoutImpl

        public PersistentLayoutImpl​(Layout<V,​E> layout)
        create an instance with a passed layout create containers for graph components
        Parameters:
        layout - the layout whose positions are to be persisted
    • 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​(V v,
                                          java.awt.geom.Point2D coord)
        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 - the vertex whose location is to be initialized
        coord - the location
      • persist

        public void persist​(java.lang.String fileName)
                     throws java.io.IOException
        save the Vertex locations to a file
        Specified by:
        persist in interface PersistentLayout<V,​E>
        Parameters:
        fileName - the file to save to
        Throws:
        java.io.IOException - if the file cannot be used
      • restore

        public void restore​(java.lang.String fileName)
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
        Restore the graph Vertex locations from a file
        Specified by:
        restore in interface PersistentLayout<V,​E>
        Parameters:
        fileName - the file to use
        Throws:
        java.io.IOException - for file problems
        java.lang.ClassNotFoundException - for classpath problems
      • lock

        public void lock​(V v,
                         boolean state)
        Description copied from interface: Layout
        Locks or unlocks the specified vertex. Locking the vertex fixes it at its current position, so that it will not be affected by the layout algorithm. Unlocking it allows the layout algorithm to change the vertex's position.
        Specified by:
        lock in interface Layout<V,​E>
        Overrides:
        lock in class LayoutDecorator<V,​E>
        Parameters:
        v - the vertex to lock/unlock
        state - true to lock the vertex, false to unlock it