|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.graphstream.ui.layout.LayoutRunner
public class LayoutRunner
Allows to run a layout in a distinct thread.
A layout runner will run in its own thread and periodically activate a layout algorithm on a graph event stream (you do not need a graph). This implementation is mainly used by the graph viewer but could be used by any program that needs a layout algorithm that run continuously on a dynamic graph (adapting the layout as the graph changes).
The layout algorithms in GraphStream are iterative versions that can be called repeatedly
to take graph dynamics into account and may produce a result only after several invocations.
This is why the layout runner invokes the layout on a regular basis. The runner is temporized,
it will not run in a loop as fast as possible, instead it will wait a little between each
layout invocation. When the last layout invocation indicated the layout was good, it will wait
longer that when the last invocation indicated the layout was not good (stabilized). These
two times can be configured using setNaps(long, long)
.
Once you finished using the runner, you must call release()
to break the link with
the event source and stop the thread. The runner cannot be used after.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
LayoutRunner(Graph graph,
Layout layout,
boolean start,
boolean replay)
New layout runner that listen at the given graph and compute a layout on its graph structure in a distinct thread. |
|
LayoutRunner(Source source,
Layout layout)
New layout runner that listens at the given source and compute a layout on its graph structure in a distinct thread. |
|
LayoutRunner(Source source,
Layout layout,
boolean start)
New layout runner that listen at the given source and compute a layout on its graph structure in a distinct thread. |
Method Summary | |
---|---|
ProxyPipe |
newLayoutPipe()
Pipe out whose input is connected to the layout algorithm. |
void |
release()
Release any link to the source of events and stop the layout proces. |
void |
run()
|
void |
setNaps(long longNap,
long shortNap)
Configure the time to wait between each layout invocation. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LayoutRunner(Source source, Layout layout)
source
- The source of graph events.layout
- The layout algorithm to use.public LayoutRunner(Source source, Layout layout, boolean start)
source
- The source of graph events.layout
- The layout algorithm to use.start
- Start the layout thread immediately ? Else the start() method
must be called later.public LayoutRunner(Graph graph, Layout layout, boolean start, boolean replay)
graph
- The source of graph events.layout
- The layout algorithm to use.start
- Start the layout thread immediately ? Else the start() method
must be called later.replay
- If the graph already contains some data, replay events to create
the data, this is mostly always needed.Method Detail |
---|
public ProxyPipe newLayoutPipe()
public void run()
run
in interface Runnable
run
in class Thread
public void release()
public void setNaps(long longNap, long shortNap)
longNap
- The time to wait between stabilized layout invocations, by default 80.shortNap
- The time to wait between non stabilized layout invocations, by default 10.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |