Perforce JViews Diagrammer Sample: Creating Diagrams using the SDK
Description
This sample illustrates how to define and populate a data model, how to apply a style defined with Designer for JViews Diagrammer, and how to perform common management operations on the resulting diagram.
How to Use the Sample
- Start the application.
- Click one of the level of detail buttons to change the size and complexity of the symbols.
- Click one of the graph layout buttons to change the flow direction.
How to Run the Sample as an Application
This sample can
be run as an application.
The installation directory contains
an executable JAR file,
diagram-model.jar
,
that allows you to execute the sample 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 sample 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 sample and type:
ant run
Topics Covered
- Creating a basic diagram with a model populated by API
-
Using the
IlvDiagrammerApplication
class to create a basic service diagram
Detailed Description
The JViews Diagrammer model is defined and created through the API. It uses JavaBean objects as instances of nodes and links. These beans do not have any particular dependency on JViews Diagrammer classes. They are merely used as information holders, with a common and simple access to their content. The style used to represent the various instances has been defined through the Designer using Symbols taken from the standard palette. The IDPR project file contains style rules. It uses a very basic XML file that contains only a few node and link samples to preview the styling specification. This XML file is not used in the application, since the data model is created by code. On the right-hand side, control buttons allow you to change visualization options, such as the level of detail, graph layout settings (by cascading a style sheet), and so on.
Installation Directory
The Creating Diagrams using the SDK sample is installed here.
Classes Involved
-
ilog.views.diagrammer.IlvDiagrammer
The main class of the diagram component.
-
ilog.views.diagrammer.application.IlvDiagrammerApplication
The predefined base class for Perforce JViews Diagrammer applications.
-
ilog.views.sdm.model.IlvJavaBeanSDMModel
A utility class to create an SDM model from JavaBeans.
Source Files
-
service.ServiceMonitoringGUI
The entry point of the sample.
-
service.ServiceMonitoringModel
The class that creates the model.
-
service.ServiceNode
The class that represents a service node.
-
service.ServiceLink
The class that represents a service link.