Package edu.uci.ics.jung.visualization
Class DefaultVisualizationModel<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.visualization.DefaultVisualizationModel<V,E>
-
- All Implemented Interfaces:
ChangeEventSupport,VisualizationModel<V,E>
public class DefaultVisualizationModel<V,E> extends java.lang.Object implements VisualizationModel<V,E>, ChangeEventSupport
The model containing state values for visualizations of graphs. Refactored and extracted from the 1.6.0 version of VisualizationViewer
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.event.ChangeListenerchangeListenerlistens for changes in the layout, forwards to the viewerprotected edu.uci.ics.jung.algorithms.layout.Layout<V,E>layoutthe layout algorithm currently in useprotected edu.uci.ics.jung.algorithms.layout.util.Relaxerrelaxermanages the thread that applies the current layout algorithm
-
Constructor Summary
Constructors Constructor Description DefaultVisualizationModel(edu.uci.ics.jung.algorithms.layout.Layout<V,E> layout)DefaultVisualizationModel(edu.uci.ics.jung.algorithms.layout.Layout<V,E> layout, java.awt.Dimension d)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(javax.swing.event.ChangeListener l)Adds aChangeListener.voidfireStateChanged()Notifies all listeners that have registered interest for notification on this event type.javax.swing.event.ChangeListener[]getChangeListeners()Returns an array of all theChangeListeners added with addChangeListener().edu.uci.ics.jung.algorithms.layout.Layout<V,E>getGraphLayout()Returns the current graph layout.edu.uci.ics.jung.algorithms.layout.util.RelaxergetRelaxer()voidremoveChangeListener(javax.swing.event.ChangeListener l)Removes a ChangeListener.voidsetGraphLayout(edu.uci.ics.jung.algorithms.layout.Layout<V,E> layout)set the graph Layout and if it is not already initialized, initialize it to the default VisualizationViewer preferred size of 600x600voidsetGraphLayout(edu.uci.ics.jung.algorithms.layout.Layout<V,E> layout, java.awt.Dimension viewSize)Removes the current graph layout, and adds a new one.voidsetRelaxer(edu.uci.ics.jung.algorithms.layout.util.VisRunner relaxer)
-
-
-
Field Detail
-
relaxer
protected edu.uci.ics.jung.algorithms.layout.util.Relaxer relaxer
manages the thread that applies the current layout algorithm
-
layout
protected edu.uci.ics.jung.algorithms.layout.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
-
-
Method Detail
-
setGraphLayout
public void setGraphLayout(edu.uci.ics.jung.algorithms.layout.Layout<V,E> layout, java.awt.Dimension viewSize)
Removes the current graph layout, and adds a new one.- Specified by:
setGraphLayoutin interfaceVisualizationModel<V,E>- Parameters:
layout- the new layout to useviewSize- the size of the View that will display this layout
-
setGraphLayout
public void setGraphLayout(edu.uci.ics.jung.algorithms.layout.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:
setGraphLayoutin interfaceVisualizationModel<V,E>
-
getGraphLayout
public edu.uci.ics.jung.algorithms.layout.Layout<V,E> getGraphLayout()
Returns the current graph layout.- Specified by:
getGraphLayoutin interfaceVisualizationModel<V,E>
-
getRelaxer
public edu.uci.ics.jung.algorithms.layout.util.Relaxer getRelaxer()
- Specified by:
getRelaxerin interfaceVisualizationModel<V,E>- Returns:
- the relaxer
-
setRelaxer
public void setRelaxer(edu.uci.ics.jung.algorithms.layout.util.VisRunner relaxer)
- Parameters:
relaxer- the relaxer to set
-
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener l)
Adds aChangeListener.- Specified by:
addChangeListenerin interfaceChangeEventSupport- Specified by:
addChangeListenerin interfaceVisualizationModel<V,E>- Parameters:
l- the listener to be added
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener.- Specified by:
removeChangeListenerin interfaceChangeEventSupport- Specified by:
removeChangeListenerin interfaceVisualizationModel<V,E>- Parameters:
l- the listener to be removed
-
getChangeListeners
public javax.swing.event.ChangeListener[] getChangeListeners()
Returns an array of all theChangeListeners added with addChangeListener().- Specified by:
getChangeListenersin interfaceChangeEventSupport- Specified by:
getChangeListenersin interfaceVisualizationModel<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:
fireStateChangedin interfaceChangeEventSupport- See Also:
EventListenerList
-
-