Perforce JViews Diagrammer Code Example: Stop Layout Button
Description
This sample illustrates the use of the method
IlvGraphLayout.stopImmediately
to stop a running layout before completion.
This sample uses the graphic framework, but it does not use
the IlvDiagrammer
component or CSS.
How to Use the Code Example
- This sample animates a layout performed by the Uniform Length Edges Layout algorithm. It demonstrates how to stop a running layout in a multi-threaded application. Therefore, the algorithm is artificially slowed down to give the user time to interact during the running layout.
-
This application shows a manager view that displays a grapher read from an
IVL
file. You may change the grapher sample using the list at the top of the application. - The application also has interactor buttons on the top side: pan, select, zoom box, zoom in, zoom out, and show all (fit to contents).
-
At the bottom, there are three buttons:
- The Randomize button randomizes the positions of the graph.
- The Start Layout button starts a Uniform Length Edges Layout in a separate thread.
- The Stop Layout button calls
layout.stopImmediately()
to stop the running layout before completion.
How to Run the Code Example as an Application
This code example can
be run as an application.
The installation directory contains
an executable JAR file,
stoplayoutbutton.jar
,
that allows you to execute the code example with a double click from a
file browser. Note that if you are using Internet Explorer, you can
open the installation directory
and execute the JAR file from the browser. This
technique may not work in other Web browsers.
Alternatively, you
can run the code example application from the command line.
First check that the Ant utility is properly configured. If not, see the
instructions on how to configure Ant for Perforce JViews.
Then, go to the installation directory
of the code example and type:
ant run
Topics Covered
- Grapher
- Graph Layout
- Multi Threaded Graph Layout
- Performance
- Animation
- Graph Layout Stop
Installation Directory
The Stop Layout Button code example is installed here.