Rogue Wave JViews Diagrammer Code Example: Uniform Length Edges Layout (Java SDK Version)
Description
![]() |
This sample shows how to use the Uniform Length Edges Layout algorithm in a Java applet. It shows how to perform a Uniform Length Edges Layout and how to control its layout parameters in Java code. This sample uses the graphic framework, but it does not use the IlvDiagrammer
component or CSS.
How to Use the Code Example
- The Uniform Length Edges Layout algorithm can be used to lay out any type of graph. It often provides a drawing without any or with only a few edge crossings and with approximately equal-length edges for small and medium-size graphs having a small number of cycles. For details, see the corresponding section of the User's Manual.
- This applet shows a manager view that displays a grapher read from an
IVL
file. You may change the grapher sample using the Select Graph list at the top of the applet. - The applet also has interactor buttons on the top of the applet window. They are: pan, select, zoom box, zoom in, zoom out, and show all (fit to contents).
- Under the graph panel, there are two buttons:
- Random, which performs a Random Layout.
- Layout, which uses the Uniform Length Layout algorithm.
- You can specify the preferred length of the links, request that the size of the nodes is taken into account and enable the autolayout mode. When moving a node interactively, the layout is restarted automatically while the selected nodes are considered as fixed.
How to Run the Code Example as an Application
This code example can also be run as an application. The installation directory contains an executable JAR file, uniformlengthlayout.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 Rogue Wave JViews.
Then, go to the installation directory of the code example and type:
ant run
Topics Covered
- Grapher
- Graph Layout
- Uniform Length Edges Layout in Java Code
- Uniform Length Edges Layout Parameters
Installation Directory
The Uniform Length Edges Layout (Java SDK Version) code example is installed here.
Classes Involved
- ilog.views.graphlayout.uniformlengthedges.IlvUniformLengthEdgesLayout
- ilog.views.graphlayout.random.IlvRandomLayout
- ilog.views.IlvGrapher
- ilog.views.IlvManagerView