Perforce JViews Diagrammer Code Example: Rotated Layout (Java SDK Version)
Description
This sample shows how to use the
IlvRotatedGraphModel
in a Java application.
It shows how to perform various layout styles in a rotated manner.
This sample uses the graphic framework but it does not use
the IlvDiagrammer
component nor CSS.
A version of the Rotated Layout sample that uses CSS can be found here
How to Use the Code Example
-
This sample shows graph layout on a
IlvRotatedGraphModel
. This allows to rotate the coordinate space during layout without rotating the node shapes. Notice that the nodes are upright rectangles even though the layout appears at an angle. -
This application shows a manager view that displays a grapher that is
read from an
IVL
file. You can change the grapher sample by using the list at the top of the application. Each sample file uses a different layout style. - The application also has interactor buttons at the top of the graph window: pan, select, zoom box, zoom in, zoom out, and show all (fit to contents).
-
The panel below the manager view allows to specify the rotation
angle, between -45 and +45 degree.
Instead of a rotation, it is furthermore possible to use a
shear transform, which can be specified by the shear mode.
The
IlvRotatedGraphModel
works with any transform, however the rotation and shear transform are those that are most frequently needed, hence this demo shows only those. - A layout is performed whenever you load a sample or when you change the rotation angle or the shear mode.
-
The
IlvRotatedGraphModel
works well with flat graphs as shown in this sample. It does not work well with recursive layout modes on nested graphs, since the bounds of a submanager never get visually rotated, and since intergraph links cannot be routed in rotated mode. It does not work well with with Bus Layout, since the bus node does not get rotated, nor with Long Link Layout since the spacing of the rotated routing grid is often inappropriate.
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,
rotatedlayout.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
- Rotated Layout in Java Code
Installation Directory
The Rotated Layout (Java SDK Version) code example is installed here.
Classes Involved
- ilog.views.graphlayout.IlvRotatedGraphModel
- ilog.views.graphlayout.IlvGrapherAdapter
- ilog.views.graphlayout.grid.IlvGridLayout
- ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout
- ilog.views.graphlayout.topologicalmesh.IlvTopologicalMeshLayout
- ilog.views.graphlayout.tree.IlvTreeLayout
- ilog.views.IlvGrapher
- ilog.views.IlvManagerView