Class AggregateLayout<V,​E>

  • Type Parameters:
    V - the vertex type
    E - the edge type
    All Implemented Interfaces:
    Layout<V,​E>, IterativeContext, org.apache.commons.collections4.Transformer<V,​java.awt.geom.Point2D>

    public class AggregateLayout<V,​E>
    extends java.lang.Object
    implements Layout<V,​E>, IterativeContext
    A Layout implementation that combines multiple other layouts so that they may be manipulated as one layout. The relaxer thread will step each layout in sequence.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Layout<V,​E> delegate  
      protected java.util.Map<Layout<V,​E>,​java.awt.geom.Point2D> layouts  
    • Constructor Summary

      Constructors 
      Constructor Description
      AggregateLayout​(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()
      Check all sublayouts.keySet() and the delegate layout, returning done == true iff all are done.
      java.awt.geom.Point2D get​(Layout<V,​E> layout)
      Returns the center of the passed layout.
      Layout<V,​E> getDelegate()  
      edu.uci.ics.jung.graph.Graph<V,​E> getGraph()
      Returns the graph for which this layout is defined.
      java.util.Map<Layout<V,​E>,​java.awt.geom.Point2D> getLayouts()
      Returns a map from each Layout instance to its center point.
      java.awt.Dimension getSize()
      Returns the size of the underlying layout.
      void initialize()
      Initializes fields in the node that may not have been set during the constructor.
      boolean isLocked​(V v)
      Override to test if the passed vertex is locked in any of the layouts.
      void lock​(V v, boolean state)
      override to lock or unlock this vertex in any layout with a subgraph containing it
      void put​(Layout<V,​E> layout, java.awt.geom.Point2D center)
      adds the passed layout as a sublayout, also specifying the center of where this sublayout should appear
      void remove​(Layout<V,​E> layout)
      Removes layout from this instance.
      void removeAll()
      Removes all layouts from this instance.
      void reset()  
      void setDelegate​(Layout<V,​E> delegate)  
      void setGraph​(edu.uci.ics.jung.graph.Graph<V,​E> graph)
      setter for graph
      void setInitializer​(org.apache.commons.collections4.Transformer<V,​java.awt.geom.Point2D> initializer)
      provides initial locations for all vertices.
      void setLocation​(V v, java.awt.geom.Point2D location)
      set the location of a vertex
      void setSize​(java.awt.Dimension d)  
      void step()
      call step on any sublayout that is also an IterativeContext and is not done
      java.awt.geom.Point2D transform​(V v)
      Returns the location of the vertex.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • delegate

        protected Layout<V,​E> delegate
      • layouts

        protected java.util.Map<Layout<V,​E>,​java.awt.geom.Point2D> layouts
    • Constructor Detail

      • AggregateLayout

        public AggregateLayout​(Layout<V,​E> delegate)
        Creates an instance backed by the specified delegate.
        Parameters:
        delegate -
    • Method Detail

      • getDelegate

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

        public void setDelegate​(Layout<V,​E> delegate)
        Parameters:
        delegate - the delegate to set
      • put

        public void put​(Layout<V,​E> layout,
                        java.awt.geom.Point2D center)
        adds the passed layout as a sublayout, also specifying the center of where this sublayout should appear
        Parameters:
        layout -
        center -
      • get

        public java.awt.geom.Point2D get​(Layout<V,​E> layout)
        Returns the center of the passed layout.
        Parameters:
        layout -
        Returns:
        the center of the passed layout
      • remove

        public void remove​(Layout<V,​E> layout)
        Removes layout from this instance.
      • removeAll

        public void removeAll()
        Removes all layouts from this instance.
      • getGraph

        public edu.uci.ics.jung.graph.Graph<V,​E> getGraph()
        Returns the graph for which this layout is defined.
        Specified by:
        getGraph in interface Layout<V,​E>
        Returns:
        the graph for which this layout is defined
        See Also:
        Layout.getGraph()
      • getSize

        public java.awt.Dimension getSize()
        Returns the size of the underlying layout.
        Specified by:
        getSize in interface Layout<V,​E>
        Returns:
        the size of the underlying layout
        See Also:
        Layout.getSize()
      • 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>
        See Also:
        Layout.initialize()
      • isLocked

        public boolean isLocked​(V v)
        Override to test if the passed vertex is locked in any of the layouts.
        Specified by:
        isLocked in interface Layout<V,​E>
        Parameters:
        v -
        Returns:
        true if v is locked in any of the layouts, and false otherwise
        See Also:
        Layout.isLocked(java.lang.Object)
      • lock

        public void lock​(V v,
                         boolean state)
        override to lock or unlock this vertex in any layout with a subgraph containing it
        Specified by:
        lock in interface Layout<V,​E>
        Parameters:
        v -
        state -
        See Also:
        Layout.lock(java.lang.Object, boolean)
      • getLayouts

        public java.util.Map<Layout<V,​E>,​java.awt.geom.Point2D> getLayouts()
        Returns a map from each Layout instance to its center point.
      • transform

        public java.awt.geom.Point2D transform​(V v)
        Returns the location of the vertex. The location is specified first by the sublayouts, and then by the base layout if no sublayouts operate on this vertex.
        Specified by:
        transform in interface org.apache.commons.collections4.Transformer<V,​E>
        Returns:
        the location of the vertex
        See Also:
        Transformer.transform(java.lang.Object)
      • done

        public boolean done()
        Check all sublayouts.keySet() and the delegate layout, returning done == true iff all are done.
        Specified by:
        done in interface IterativeContext
      • step

        public void step()
        call step on any sublayout that is also an IterativeContext and is not done
        Specified by:
        step in interface IterativeContext