|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.uci.ics.jung.visualization.DefaultVisualizationModel
public class DefaultVisualizationModel
The model containing state values for visualizations of graphs. Refactored and extracted from the 1.6.0 version of VisualizationViewer
Nested Class Summary | |
---|---|
protected class |
DefaultVisualizationModel.VisRunner
the relaxer thread that applies the Layout algorithm to the graph |
Field Summary | |
---|---|
protected ChangeListener |
changeListener
|
protected Layout |
layout
the layout algorithm currently in use |
Object |
pauseObject
|
protected long |
relaxerThreadSleepTime
how long the relaxer thread pauses between iteration loops. |
protected StatusCallback |
statusCallback
a callback called during relaxer iteration |
Constructor Summary | |
---|---|
DefaultVisualizationModel(Layout layout)
|
|
DefaultVisualizationModel(Layout layout,
Dimension d)
|
Method Summary | |
---|---|
void |
addChangeListener(ChangeListener l)
Adds a ChangeListener . |
protected double |
average(long[] paintTimes)
Returns the double average of a number of long values. |
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 |
getGraphLayout()
Returns the current graph layout. |
long |
getRelaxerThreadSleepTime()
Returns the time between iterations of the Relaxer thread. |
void |
init()
Pre-relaxes and starts a visRunner thread |
boolean |
isVisRunnerRunning()
Returns a flag that says whether the visRunner thread is running. |
void |
prerelax()
Runs the visualization forward a few hundred iterations (for half a second) |
void |
removeChangeListener(ChangeListener l)
Removes a ChangeListener. |
void |
restart()
Restarts layout, then calls init(); |
void |
restartThreadOnly()
starts a visRunner thread without prerelaxing |
void |
setGraphLayout(Layout 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 layout,
Dimension viewSize)
Removes the current graph layout, and adds a new one. |
void |
setRelaxerThreadSleepTime(long relaxerThreadSleepTime)
Sets the relaxerThreadSleepTime. |
void |
setTextCallback(StatusCallback scb)
set a callback to be called during the relaxer iteration |
void |
start()
If the visualization runner is not yet running, kick it off. |
void |
stop()
set a flag to stop the VisRunner relaxer thread |
void |
suspend()
set a flag to suspend the relaxer thread |
void |
unsuspend()
un-set the suspend flag for the relaxer thead |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected StatusCallback statusCallback
protected Layout layout
protected long relaxerThreadSleepTime
protected ChangeListener changeListener
public Object pauseObject
Constructor Detail |
---|
public DefaultVisualizationModel(Layout layout)
layout
- The Layout to apply, with its associated Graphpublic DefaultVisualizationModel(Layout layout, Dimension d)
layout
- d
- The preferred size of the View that will display this graphMethod Detail |
---|
public long getRelaxerThreadSleepTime()
getRelaxerThreadSleepTime
in interface VisualizationModel
public void setRelaxerThreadSleepTime(long relaxerThreadSleepTime)
setRelaxerThreadSleepTime
in interface VisualizationModel
relaxerThreadSleepTime
- The relaxerThreadSleepTime to set.getRelaxerThreadSleepTime()
public void setGraphLayout(Layout layout, Dimension viewSize)
setGraphLayout
in interface VisualizationModel
layout
- the new layout to useviewSize
- the size of the View that will display this layoutpublic void setGraphLayout(Layout layout)
setGraphLayout
in interface VisualizationModel
public Layout getGraphLayout()
getGraphLayout
in interface VisualizationModel
public void restartThreadOnly()
restartThreadOnly
in interface VisualizationModel
public void init()
init
in interface VisualizationModel
public void restart()
restart
in interface VisualizationModel
public void prerelax()
prerelax
in interface VisualizationModel
public void start()
start
in interface VisualizationModel
public void suspend()
suspend
in interface VisualizationModel
public void unsuspend()
unsuspend
in interface VisualizationModel
public boolean isVisRunnerRunning()
isVisRunnerRunning
in interface VisualizationModel
protected double average(long[] paintTimes)
paintTimes
- an array of longs
public void setTextCallback(StatusCallback scb)
VisualizationModel
setTextCallback
in interface VisualizationModel
scb
- public void stop()
stop
in interface VisualizationModel
public void addChangeListener(ChangeListener l)
ChangeListener
.
addChangeListener
in interface ChangeEventSupport
addChangeListener
in interface VisualizationModel
l
- the listener to be addedpublic void removeChangeListener(ChangeListener l)
removeChangeListener
in interface ChangeEventSupport
removeChangeListener
in interface VisualizationModel
l
- the listener to be removedpublic ChangeListener[] getChangeListeners()
ChangeListener
s added
with addChangeListener().
getChangeListeners
in interface ChangeEventSupport
getChangeListeners
in interface VisualizationModel
ChangeListener
s added or an empty
array if no listeners have been addedpublic void fireStateChanged()
fireStateChanged
in interface ChangeEventSupport
EventListenerList
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |