Class DefaultVisualizationModel<V,​E>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.swing.event.ChangeListener changeListener
      listens for changes in the layout, forwards to the viewer
      (package private) ChangeEventSupport changeSupport  
      protected Layout<V,​E> layout
      the layout algorithm currently in use
      protected Relaxer relaxer
      manages the thread that applies the current layout algorithm
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChangeListener​(javax.swing.event.ChangeListener l)
      Adds a ChangeListener.
      void fireStateChanged()
      Notifies all listeners that have registered interest for notification on this event type.
      javax.swing.event.ChangeListener[] getChangeListeners()
      Returns an array of all the ChangeListeners added with addChangeListener().
      Layout<V,​E> getGraphLayout()
      Returns the current graph layout.
      Relaxer getRelaxer()  
      void removeChangeListener​(javax.swing.event.ChangeListener l)
      Removes a ChangeListener.
      void setGraphLayout​(Layout<V,​E> layout)
      set the graph Layout and if it is not already initialized, initialize it to the default VisualizationViewer preferred size of 600x600
      void setGraphLayout​(Layout<V,​E> layout, java.awt.Dimension viewSize)
      Removes the current graph layout, and adds a new one.
      void setRelaxer​(VisRunner relaxer)  
      • Methods inherited from class java.lang.Object

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

      • relaxer

        protected Relaxer relaxer
        manages the thread that applies the current layout algorithm
      • layout

        protected Layout<V,​E> layout
        the layout algorithm currently in use
      • changeListener

        protected javax.swing.event.ChangeListener changeListener
        listens for changes in the layout, forwards to the viewer
    • Constructor Detail

      • DefaultVisualizationModel

        public DefaultVisualizationModel​(Layout<V,​E> layout)
        Parameters:
        layout - The Layout to apply, with its associated Graph
      • DefaultVisualizationModel

        public DefaultVisualizationModel​(Layout<V,​E> layout,
                                         java.awt.Dimension d)
        Create an instance with the specified layout and dimension.
        Parameters:
        layout - the layout to use
        d - The preferred size of the View that will display this graph
    • Method Detail

      • setGraphLayout

        public void setGraphLayout​(Layout<V,​E> layout,
                                   java.awt.Dimension viewSize)
        Removes the current graph layout, and adds a new one.
        Specified by:
        setGraphLayout in interface VisualizationModel<V,​E>
        Parameters:
        layout - the new layout to use
        viewSize - the size of the View that will display this layout
      • setGraphLayout

        public void setGraphLayout​(Layout<V,​E> layout)
        set the graph Layout and if it is not already initialized, initialize it to the default VisualizationViewer preferred size of 600x600
        Specified by:
        setGraphLayout in interface VisualizationModel<V,​E>
        Parameters:
        layout - the layout to use
      • setRelaxer

        public void setRelaxer​(VisRunner relaxer)
        Parameters:
        relaxer - the relaxer to set
      • getChangeListeners

        public javax.swing.event.ChangeListener[] getChangeListeners()
        Returns an array of all the ChangeListeners added with addChangeListener().
        Specified by:
        getChangeListeners in interface ChangeEventSupport
        Specified by:
        getChangeListeners in interface VisualizationModel<V,​E>
        Returns:
        all of the ChangeListeners added or an empty array if no listeners have been added
      • fireStateChanged

        public void fireStateChanged()
        Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created. The primary listeners will be views that need to be repainted because of changes in this model instance
        Specified by:
        fireStateChanged in interface ChangeEventSupport
        See Also:
        EventListenerList