Class LayoutDecorator<V,​E>

  • All Implemented Interfaces:
    com.google.common.base.Function<V,​java.awt.geom.Point2D>, Layout<V,​E>, IterativeContext, java.util.function.Function<V,​java.awt.geom.Point2D>
    Direct Known Subclasses:
    CachingLayout, ObservableCachingLayout

    public abstract class LayoutDecorator<V,​E>
    extends java.lang.Object
    implements Layout<V,​E>, IterativeContext
    a pure decorator for the Layout interface. Intended to be overridden to provide specific behavior decoration
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Layout<V,​E> delegate  
    • Constructor Summary

      Constructors 
      Constructor Description
      LayoutDecorator​(Layout<V,​E> delegate)
      Creates an instance backed by the specified delegate.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean done()  
      Layout<V,​E> getDelegate()  
      Graph<V,​E> getGraph()  
      java.awt.Dimension getSize()  
      void initialize()
      Initializes fields in the node that may not have been set during the constructor.
      boolean isLocked​(V v)  
      void lock​(V v, boolean state)
      Locks or unlocks the specified vertex.
      void reset()  
      void setDelegate​(Layout<V,​E> delegate)  
      void setGraph​(Graph<V,​E> graph)  
      void setInitializer​(com.google.common.base.Function<V,​java.awt.geom.Point2D> initializer)  
      void setLocation​(V v, java.awt.geom.Point2D location)
      Changes the layout coordinates of v to location.
      void setSize​(java.awt.Dimension d)  
      void step()
      Advances one step.
      java.awt.geom.Point2D transform​(V v)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.google.common.base.Function

        apply, equals
      • Methods inherited from interface java.util.function.Function

        andThen, compose
    • Field Detail

      • delegate

        protected Layout<V,​E> delegate
    • Constructor Detail

      • LayoutDecorator

        public LayoutDecorator​(Layout<V,​E> delegate)
        Creates an instance backed by the specified delegate.
        Parameters:
        delegate - the layout to which this instance is delegating
    • Method Detail

      • getDelegate

        public Layout<V,​E> getDelegate()
        Returns:
        the backing (delegate) layout.
      • setDelegate

        public void setDelegate​(Layout<V,​E> delegate)
      • 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>
      • setInitializer

        public void setInitializer​(com.google.common.base.Function<V,​java.awt.geom.Point2D> initializer)
        Specified by:
        setInitializer in interface Layout<V,​E>
        Parameters:
        initializer - a function that specifies initial locations for all vertices
      • setLocation

        public void setLocation​(V v,
                                java.awt.geom.Point2D location)
        Description copied from interface: Layout
        Changes the layout coordinates of v to location.
        Specified by:
        setLocation in interface Layout<V,​E>
        Parameters:
        v - the vertex whose location is to be specified
        location - the coordinates of the specified location
      • getSize

        public java.awt.Dimension getSize()
        Specified by:
        getSize in interface Layout<V,​E>
        Returns:
        the current size of the visualization's space
      • getGraph

        public Graph<V,​E> getGraph()
        Specified by:
        getGraph in interface Layout<V,​E>
        Returns:
        the graph that this Layout refers to
      • transform

        public java.awt.geom.Point2D transform​(V v)
      • done

        public boolean done()
        Specified by:
        done in interface IterativeContext
        Returns:
        true if this iterative process is finished, and false otherwise.
      • 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>
        Parameters:
        v - the vertex to lock/unlock
        state - true to lock the vertex, false to unlock it
      • isLocked

        public boolean isLocked​(V v)
        Specified by:
        isLocked in interface Layout<V,​E>
        Parameters:
        v - the vertex whose locked state is being queried
        Returns:
        true if the position of vertex v is locked
      • setSize

        public void setSize​(java.awt.Dimension d)
        Specified by:
        setSize in interface Layout<V,​E>
        Parameters:
        d - the space to use to lay out this graph
      • reset

        public void reset()
        Specified by:
        reset in interface Layout<V,​E>
      • setGraph

        public void setGraph​(Graph<V,​E> graph)
        Specified by:
        setGraph in interface Layout<V,​E>
        Parameters:
        graph - the graph that this algorithm is to operate on