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.ChangeListener
changeListener
listens for changes in the layout, forwards to the viewerprotected edu.uci.ics.jung.algorithms.layout.Layout<V,E>
layout
the layout algorithm currently in useprotected edu.uci.ics.jung.algorithms.layout.util.Relaxer
relaxer
manages 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 void
addChangeListener(javax.swing.event.ChangeListener l)
Adds aChangeListener
.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 theChangeListener
s 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.Relaxer
getRelaxer()
void
removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener.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 600x600void
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.void
setRelaxer(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:
setGraphLayout
in 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:
setGraphLayout
in interfaceVisualizationModel<V,E>
-
getGraphLayout
public edu.uci.ics.jung.algorithms.layout.Layout<V,E> getGraphLayout()
Returns the current graph layout.- Specified by:
getGraphLayout
in interfaceVisualizationModel<V,E>
-
getRelaxer
public edu.uci.ics.jung.algorithms.layout.util.Relaxer getRelaxer()
- Specified by:
getRelaxer
in 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:
addChangeListener
in interfaceChangeEventSupport
- Specified by:
addChangeListener
in interfaceVisualizationModel<V,E>
- Parameters:
l
- the listener to be added
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener.- Specified by:
removeChangeListener
in interfaceChangeEventSupport
- Specified by:
removeChangeListener
in interfaceVisualizationModel<V,E>
- Parameters:
l
- the listener to be removed
-
getChangeListeners
public javax.swing.event.ChangeListener[] getChangeListeners()
Returns an array of all theChangeListener
s added with addChangeListener().- Specified by:
getChangeListeners
in interfaceChangeEventSupport
- Specified by:
getChangeListeners
in interfaceVisualizationModel<V,E>
- Returns:
- all of the
ChangeListener
s 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 interfaceChangeEventSupport
- See Also:
EventListenerList
-
-