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 viewer(package private) ChangeEventSupport
changeSupport
protected Layout<V,E>
layout
the layout algorithm currently in useprotected Relaxer
relaxer
manages the thread that applies the current layout algorithm
-
Constructor Summary
Constructors Constructor Description DefaultVisualizationModel(Layout<V,E> layout)
DefaultVisualizationModel(Layout<V,E> layout, java.awt.Dimension d)
Create an instance with the specified layout and dimension.
-
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().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 600x600void
setGraphLayout(Layout<V,E> layout, java.awt.Dimension viewSize)
Removes the current graph layout, and adds a new one.void
setRelaxer(VisRunner relaxer)
-
-
-
Field Detail
-
changeSupport
ChangeEventSupport changeSupport
-
relaxer
protected Relaxer relaxer
manages the thread that applies the current layout algorithm
-
changeListener
protected javax.swing.event.ChangeListener changeListener
listens for changes in the layout, forwards to the viewer
-
-
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 interfaceVisualizationModel<V,E>
- Parameters:
layout
- the new layout to useviewSize
- 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 interfaceVisualizationModel<V,E>
- Parameters:
layout
- the layout to use
-
getGraphLayout
public Layout<V,E> getGraphLayout()
Returns the current graph layout.- Specified by:
getGraphLayout
in interfaceVisualizationModel<V,E>
- Returns:
- the current graph layout
-
getRelaxer
public Relaxer getRelaxer()
- Specified by:
getRelaxer
in interfaceVisualizationModel<V,E>
- Returns:
- the relaxer
-
setRelaxer
public void setRelaxer(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
-
-