gunzip < grappa.tgz | tar xvf -Then, look in the archives folder for the package file of your choice (usually grappa1_2.jar) and place that file somewhere in your Java CLASSPATH (any basic Java book will explain what that means) and you are ready to make use of the Grappa package in your Java programs by simply adding a
import att.grappa.*;statement in your source files.
javac *.java
javac -classpath ../.. *.java
java Demo12 ../sample.dotNote that the graph in the sample.dot file already has layout information contained in it (by means of the pos element attribute). Pressing the right mouse button provides a popup-menu. Pressing the left mouse button selects elements (either individually or by sweeping). Pressing the control-key and the left mouse button on an element lets you select additional elements without clearing the previously selected elements. Pressing the shift-key and the left mouse button on a piece of blank graph creates a new node while doing the same in an existing node and dragging to another existing node creates an edge. Pressing the labelled "Layout" button to the left of the demo panel first tries to call a local layout script (formatDemo) and then, if that fails, which it almost certainly will, it will try to contact our web server to perform the layout. This latter should work as long as you have a live connection to the internet.
If all you want is to generate a GIF or JPEG, you need only use dot, neato or the other graphviz layout tools directly, they take options to generate such output.
You can also go the hybrid route, namely, use Grappa for interactive
display and then when a user wants a GIF/JPEG snapshot, use the
GrappaSupport.filterGraph() method to send the graph over to a server
running, for example, dot (or send it to a local dot executable)
and have it generate the image which can then be saved by the user.
(top)