Perforce JViews Diagrammer Sample: Creating Diagrams without CSS
Description
This sample shows a simple diagram with simple interactions and does not use CSS at all.
How to Use the Sample
- Select one or several objects.
- Set a new color in the text field.
How to Run the Sample as an Application
This sample can
be run as an application.
The installation directory contains
an executable JAR file,
diagrammer-nocss.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 without CSS
Detailed Description
The JViews Diagrammer model is defined and created through the API. Instead of loading a CSS file, a custom renderer is set. This renderer simulates the styling engine. It creates nodes and links, and updates the graphic objects when selected or when property change events occur. Given the simplicity of this application, CSS is quite unneccessary. Here the custom renderer represents a comfortable alternative that remains in the pure Java world, and simplifies user extension of the application. Note that all SDM services (maps, subgraph, graph layout, info balloon, and so on...) are no longer available without CSS support.
Installation Directory
The Creating Diagrams without CSS sample is installed here.
Classes Involved
-
ilog.views.diagrammer.IlvDiagrammer
The main class of the diagram component.
-
ilog.views.sdm.renderer.IlvSDMRenderer
The base class for SDM renderer, subclassed to simulate the CSS engine.
Source Files
-
pebbles.DiagrammerGUI
The entry point of the sample.
-
pebbles.SimpleDiagrammerRenderer
The SDM renderer that replaces the CSS customization engine.