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 ChangeListenerlistens for changes in the layout, forwards to the viewer(package private) ChangeEventSupportthe layout algorithm currently in useprotected Relaxermanages 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 TypeMethodDescriptionvoidAdds aChangeListener.voidNotifies all listeners that have registered interest for notification on this event type.Returns an array of all theChangeListeners added with addChangeListener().Returns the current graph layout.voidRemoves a ChangeListener.voidsetGraphLayout(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(Layout<V, E> layout, Dimension viewSize) Removes the current graph layout, and adds a new one.voidsetRelaxer(VisRunner relaxer)
-
Field Details
-
changeSupport
ChangeEventSupport changeSupport -
relaxer
manages the thread that applies the current layout algorithm -
layout
-
changeListener
listens for changes in the layout, forwards to the viewer
-
-
Constructor Details
-
DefaultVisualizationModel
-
DefaultVisualizationModel
-
-
Method Details
-
setGraphLayout
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
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> - Parameters:
layout- the layout to use
-
getGraphLayout
Returns the current graph layout.- Specified by:
getGraphLayoutin interfaceVisualizationModel<V,E> - Returns:
- the current graph layout
-
getRelaxer
- Specified by:
getRelaxerin interfaceVisualizationModel<V,E> - Returns:
- the relaxer
-
setRelaxer
- Parameters:
relaxer- the relaxer to set
-
addChangeListener
Adds aChangeListener.- Specified by:
addChangeListenerin interfaceChangeEventSupport- Specified by:
addChangeListenerin interfaceVisualizationModel<V,E> - Parameters:
l- the listener to be added
-
removeChangeListener
Removes a ChangeListener.- Specified by:
removeChangeListenerin interfaceChangeEventSupport- Specified by:
removeChangeListenerin interfaceVisualizationModel<V,E> - Parameters:
l- the listener to be removed
-
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:
-