Viewer
must exist on a local file system at the client side; even other javassist.*
classes are not needed at the client side. Viewer
uses only Java core API classes. Note: since a Viewer
object is a class loader, a program loaded by this object can call a method in Viewer
. For example, you can write something like this:
Viewer v = (Viewer)this.getClass().getClassLoader(); String port = v.getPort();
A viewer can be created as an adapter on a pre-existing control (e.g., creating a ListViewer
on an existing List
control). All viewers also provide a convenience constructor for creating the control.
Implementing a concrete viewer typically involves the following steps:
setSelection
, getSelection
) The viewer class is in charge of maintaining :
The graphic graph can be created by the viewer or given at construction (to share it with another viewer).
Once created, the viewer runs in a loop inside the Swing thread. You cannot call methods on it directly if you are not in this thread. The only operation that you can use in other threads is the constructor, the {@link #addView(View)}, {@link #removeView(String)} and the {@link #close()}methods. Other methods are not protected from concurrent accesses.
Some constructors allow a {@link ProxyPipe} as argument. If given, thegraphic graph is made listener of this pipe and the pipe is "pumped" during the view loop. This allows to run algorithms on a graph in the main thread (or any other thread) while letting the viewer run in the swing thread.
Be very careful: due to the nature of graph events in GraphStream, the viewer is not aware of events that occured on the graph before its creation. There is a special mechanism that replay the graph if you use a proxy pipe or if you pass the graph directly. However, when you create the viewer by yourself and only pass a {@link Source}, the viewer will not display the events that occured on the source before it is connected to it.
|
|
|
|
|
|
|
|
|
|