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 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
FieldsModifier and TypeFieldDescriptionprotected ChangeListener
listens for changes in the layout, forwards to the viewer(package private) ChangeEventSupport
the layout algorithm currently in useprotected Relaxer
manages the thread that applies the current layout algorithm -
Constructor Summary
ConstructorsConstructorDescriptionDefaultVisualizationModel
(Layout<V, E> layout) DefaultVisualizationModel
(Layout<V, E> layout, Dimension d) Create an instance with the specified layout and dimension. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds aChangeListener
.void
Notifies all listeners that have registered interest for notification on this event type.Returns an array of all theChangeListener
s added with addChangeListener().Returns the current graph layout.void
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, Dimension viewSize) Removes the current graph layout, and adds a new one.void
setRelaxer
(VisRunner relaxer)
-
Field Details
-
changeSupport
ChangeEventSupport changeSupport -
relaxer
manages the thread that applies the current layout algorithm -
layout
the layout algorithm currently in use -
changeListener
listens for changes in the layout, forwards to the viewer
-
-
Constructor Details
-
DefaultVisualizationModel
- Parameters:
layout
- The Layout to apply, with its associated Graph
-
DefaultVisualizationModel
Create an instance with the specified layout and dimension.- Parameters:
layout
- the layout to used
- The preferred size of the View that will display this graph
-
-
Method Details
-
setGraphLayout
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
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
Returns the current graph layout.- Specified by:
getGraphLayout
in interfaceVisualizationModel<V,
E> - Returns:
- the current graph layout
-
getRelaxer
- Specified by:
getRelaxer
in interfaceVisualizationModel<V,
E> - Returns:
- the relaxer
-
setRelaxer
- Parameters:
relaxer
- the relaxer to set
-
addChangeListener
Adds aChangeListener
.- Specified by:
addChangeListener
in interfaceChangeEventSupport
- Specified by:
addChangeListener
in interfaceVisualizationModel<V,
E> - Parameters:
l
- the listener to be added
-
removeChangeListener
Removes a ChangeListener.- Specified by:
removeChangeListener
in interfaceChangeEventSupport
- Specified by:
removeChangeListener
in interfaceVisualizationModel<V,
E> - Parameters:
l
- the listener to be removed
-
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:
-