public class AndroidViewer
extends org.graphstream.ui.view.Viewer
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 UI 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
Viewer.addView(View)
, Viewer.removeView(String)
and the close()
methods. Other methods are not protected from concurrent accesses.
Some constructors allow a ProxyPipe
as argument. If given, the
graphic 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 Source
, the viewer will not display
the events that occured on the source before it is connected to it.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_VIEW_ID
Name of the default view.
|
static int |
DELAY_INTERVAL
Delay of CountDownTimer.
|
protected org.graphstream.ui.android_viewer.AndroidViewer.MyTimer |
timer
Timer in the Graphic thread.
|
Constructor and Description |
---|
AndroidViewer(org.graphstream.ui.graphicGraph.GraphicGraph graph)
We draw a pre-existing graphic graph.
|
AndroidViewer(org.graphstream.graph.Graph graph,
org.graphstream.ui.view.Viewer.ThreadingModel threadingModel)
New viewer on an existing graph.
|
AndroidViewer(org.graphstream.stream.ProxyPipe source)
The graph or source of graph events is in another thread or on another
machine, but the pipe already exists.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close definitively this viewer and all its views.
|
java.lang.String |
getDefaultID() |
void |
init(org.graphstream.ui.graphicGraph.GraphicGraph graphicGraph,
org.graphstream.stream.ProxyPipe proxyPipe,
org.graphstream.stream.Source source)
Initialise the viewer.
|
org.graphstream.ui.view.GraphRenderer<?,?> |
newDefaultGraphRenderer() |
addDefaultView, addView, addView, addView, computeGraphMetrics, disableAutoLayout, enableAutoLayout, enableAutoLayout, enableXYZfeedback, getCloseFramePolicy, getDefaultView, getGraphicGraph, getView, newGGId, newThreadProxyOnGraphicGraph, newViewerPipe, removeView, replayGraph, setCloseFramePolicy
protected org.graphstream.ui.android_viewer.AndroidViewer.MyTimer timer
public static final int DELAY_INTERVAL
public static java.lang.String DEFAULT_VIEW_ID
public AndroidViewer(org.graphstream.stream.ProxyPipe source)
source
- The source of graph events.public AndroidViewer(org.graphstream.ui.graphicGraph.GraphicGraph graph)
graph
- THe graph to draw.public AndroidViewer(org.graphstream.graph.Graph graph, org.graphstream.ui.view.Viewer.ThreadingModel threadingModel)
graph
- The graph to render.threadingModel
- The threading model.public java.lang.String getDefaultID()
getDefaultID
in class org.graphstream.ui.view.Viewer
public void init(org.graphstream.ui.graphicGraph.GraphicGraph graphicGraph, org.graphstream.stream.ProxyPipe proxyPipe, org.graphstream.stream.Source source)
init
in class org.graphstream.ui.view.Viewer
graphicGraph
- The graphic graph.proxyPipe
- The source of events from another thread or machine (null if
source != null).source
- The source of events from this thread (null if ppipe != null).public void close()
close
in class org.graphstream.ui.view.Viewer
public org.graphstream.ui.view.GraphRenderer<?,?> newDefaultGraphRenderer()
newDefaultGraphRenderer
in class org.graphstream.ui.view.Viewer