Perforce JViews Diagrammer Code Example: Bus Layout (CSS Version)
Description
This sample shows how to use the Bus Layout algorithm in the Diagrammer. It shows how to enable the Bus Layout using CSS, and how to change Bus Layout parameters by using a mutable style sheet.
A version of the Bus Layout sample that does not use CSS can be found here
How to Use the Code Example
- The Bus Layout algorithm is designed to display bus network topologies; that is, a set of nodes connected to a bus object. The algorithm takes into account the size of the nodes (no overlapping nodes) and provides several ordering options.
- This application shows a diagrammer component that displays a graph rendererd from an XML file. You may change the graph sample using the list at the top of the application.
- The application also has interactor buttons on the top side: select, zoom, unzoom, zoom box, zoom level 1, zoom to show all (fit to contents) and pan.
- You may use the select interactor to select a nodes.
- On the bottom, the Layout button performs the Bus Layout algorithm. There are also checkboxes and choice menus that allow you to select different layout parameters.
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,
diagrammer-buslayout.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
- Diagrammer.
- Graph Layout
- Bus Layout in CSS
- Mutable Style Sheet
- Bus Layout Parameters
Installation Directory
The Bus Layout (CSS Version) code example is installed here.
Classes Involved
- ilog.views.graphlayout.bus.IlvBusLayout
- ilog.views.graphlayout.random.IlvRandomLayout
- ilog.views.sdm.util.IlvSDMMutableStyleSheet
- ilog.views.diagrammer.IlvDiagrammer