UMLGraph/doc/cd-oper.xml

70 lines
3.2 KiB
XML

<?xml version="1.0" ?>
<!-- $Id$ -->
<notes>
To use UMLGraph class drawing facility you need to have
<a href="http://java.sun.com/j2se/javadoc/"><em>javadoc</em></a>
and
<a href="http://www.research.att.com/sw/tools/graphviz/">Graphviz</a>
installed on your computer.
Both programs are freely available, from Sun and AT&amp;T respectively,
for many platforms including Unix and Windows.
UMLGraph's input follows the Java syntax and semantics.
However,
since the main purpose of UMLGraph is the declarative specification of
UML diagrams there is no need to flesh-out each class's methods,
to completely specify each class, or to specify package information.
You only specify the details you want to appear on the graph.
If you wish your (Java) implementation to evolve together with the
design feel free to include code or additional details.
You can hide these details from the UML diagram using the <em>javadoc</em>
<code>@hidden</code> tag applied to classes, methods, and fields.
In theory you can also use UMLGraph to reverse engineer existing
Java code.
Note however that UMLGraph is not designed for this purpose;
the resulting graphs may be large and unwieldy.
<p />
UMLGraph is implemented as a <em>javadoc</em> doclet (a program satisfying the
doclet API that specifies the content and format of the output
generated by the <em>javadoc</em> tool).
<em>Javadoc</em> is part of the Sun JDK, so a typical JDK installation will also
include <em>javadoc</em>.
Before running <em>javadoc</em> you need to place the <code>UmlGraph.jar</code>
file in a location accessible by <em>javadoc</em>
(e.g. the Java class path or the current directory).
You then run <em>javadoc</em> with arguments <code>-doclet gr.spinellis.umlgraph.doclet.UmlGraph</code>
<code>-docletpath /path/to/UmlGraph.jar</code>
and append at the end the file(s) that contain your diagram
specification.
You can of course use any of the <em>javadoc</em> general options;
<code>-private</code> is usually needed to avoid having to explicitly
specify public elements.
<p />
Specifying some packages before the list of source files will designate
those packages as <em>local</em>.
When you specify a package list,
the SVG output UmlGraph generates will contain
local hyperlinks for the local classes
and hyperlinks to the Sun Java API documentation for all other classes.
<p />
Example:
<fmtcode ext="sh">
javadoc -docletpath UmlGraph.jar -doclet gr.spinellis.umlgraph.doclet.UmlGraph -private Simple.java
</fmtcode>
<em>javadoc</em> will create by default a file named <code>graph.dot</code>
in the current directory; option to
this is a text file that can be processed by the <em>Graphviz</em>
<em>dot</em> program to layout and draw the graph.
A command line like the following will convert the <code>graph.dot</code>
file into Postscript:
<fmtcode ext="sh">
dot -Tps -ograph.ps graph.dot
</fmtcode>
Refer to the <em>dot</em> documentation for information on creating other file formats
or adjusting the UMLGraph output.
<p />
Note that when you use <em>dot</em> for generating SVG diagrams your
should specify the <code>-outputencoding UTF-8</code> option to UMLGraph.
This option will correctly render the stereotype guillemot characters
in the <em>dot</em> output and the corresponding SVG file.
</notes>