|
||||||||||
| 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 ChangeListeners 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 Graph
public DefaultVisualizationModel(Layout layout,
Dimension d)
layout - d - The preferred size of the View that will display this graph| Method Detail |
|---|
public long getRelaxerThreadSleepTime()
getRelaxerThreadSleepTime in interface VisualizationModelpublic void setRelaxerThreadSleepTime(long relaxerThreadSleepTime)
setRelaxerThreadSleepTime in interface VisualizationModelrelaxerThreadSleepTime - The relaxerThreadSleepTime to set.getRelaxerThreadSleepTime()
public void setGraphLayout(Layout layout,
Dimension viewSize)
setGraphLayout in interface VisualizationModellayout - the new layout to useviewSize - the size of the View that will display this layoutpublic void setGraphLayout(Layout layout)
setGraphLayout in interface VisualizationModelpublic Layout getGraphLayout()
getGraphLayout in interface VisualizationModelpublic void restartThreadOnly()
restartThreadOnly in interface VisualizationModelpublic void init()
init in interface VisualizationModelpublic void restart()
restart in interface VisualizationModelpublic void prerelax()
prerelax in interface VisualizationModelpublic void start()
start in interface VisualizationModelpublic void suspend()
suspend in interface VisualizationModelpublic void unsuspend()
unsuspend in interface VisualizationModelpublic boolean isVisRunnerRunning()
isVisRunnerRunning in interface VisualizationModelprotected double average(long[] paintTimes)
paintTimes - an array of longs
public void setTextCallback(StatusCallback scb)
VisualizationModel
setTextCallback in interface VisualizationModelscb - public void stop()
stop in interface VisualizationModelpublic void addChangeListener(ChangeListener l)
ChangeListener.
addChangeListener in interface ChangeEventSupportaddChangeListener in interface VisualizationModell - the listener to be addedpublic void removeChangeListener(ChangeListener l)
removeChangeListener in interface ChangeEventSupportremoveChangeListener in interface VisualizationModell - the listener to be removedpublic ChangeListener[] getChangeListeners()
ChangeListeners added
with addChangeListener().
getChangeListeners in interface ChangeEventSupportgetChangeListeners in interface VisualizationModelChangeListeners added or an empty
array if no listeners have been addedpublic void fireStateChanged()
fireStateChanged in interface ChangeEventSupportEventListenerList
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||