public class DefaultVisualizationModel<V,E> extends Object implements VisualizationModel<V,E>, ChangeEventSupport
Modifier and Type | Field and Description |
---|---|
protected ChangeListener |
changeListener
listens for changes in the layout, forwards to the viewer
|
protected Layout<V,E> |
layout
the layout algorithm currently in use
|
protected Relaxer |
relaxer
manages the thread that applies the current layout algorithm
|
Constructor and Description |
---|
DefaultVisualizationModel(Layout<V,E> layout) |
DefaultVisualizationModel(Layout<V,E> layout,
Dimension d)
Create an instance with the specified layout and dimension.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ChangeListener l)
Adds a
ChangeListener . |
void |
fireStateChanged()
Notifies all listeners that have registered interest for
notification on this event type.
|
ChangeListener[] |
getChangeListeners()
Returns an array of all the
ChangeListener s added
with addChangeListener(). |
Layout<V,E> |
getGraphLayout()
Returns the current graph layout.
|
Relaxer |
getRelaxer() |
void |
removeChangeListener(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 600x600
|
void |
setGraphLayout(Layout<V,E> layout,
Dimension viewSize)
Removes the current graph layout, and adds a new one.
|
void |
setRelaxer(VisRunner relaxer) |
protected Relaxer relaxer
protected ChangeListener changeListener
public DefaultVisualizationModel(Layout<V,E> layout)
layout
- The Layout to apply, with its associated Graphpublic void setGraphLayout(Layout<V,E> layout, Dimension viewSize)
setGraphLayout
in interface VisualizationModel<V,E>
layout
- the new layout to useviewSize
- the size of the View that will display this layoutpublic void setGraphLayout(Layout<V,E> layout)
setGraphLayout
in interface VisualizationModel<V,E>
layout
- the layout to usepublic Layout<V,E> getGraphLayout()
getGraphLayout
in interface VisualizationModel<V,E>
public Relaxer getRelaxer()
getRelaxer
in interface VisualizationModel<V,E>
public void setRelaxer(VisRunner relaxer)
relaxer
- the relaxer to setpublic void addChangeListener(ChangeListener l)
ChangeListener
.addChangeListener
in interface ChangeEventSupport
addChangeListener
in interface VisualizationModel<V,E>
l
- the listener to be addedpublic void removeChangeListener(ChangeListener l)
removeChangeListener
in interface ChangeEventSupport
removeChangeListener
in interface VisualizationModel<V,E>
l
- the listener to be removedpublic ChangeListener[] getChangeListeners()
ChangeListener
s added
with addChangeListener().getChangeListeners
in interface ChangeEventSupport
getChangeListeners
in interface VisualizationModel<V,E>
ChangeListener
s added or an empty
array if no listeners have been addedpublic void fireStateChanged()
fireStateChanged
in interface ChangeEventSupport
EventListenerList
Copyright © 2015. All rights reserved.