mirror of https://github.com/dspinellis/UMLGraph
Add support for adding notes to elements as comments.
This commit is contained in:
parent
66b795f23b
commit
6901d69a6c
11
TODO
11
TODO
|
|
@ -1,16 +1,10 @@
|
|||
$Id$
|
||||
|
||||
Support for comments (once dds's patch gets into Graphviz).
|
||||
Suggested by S\'ebastien_Pierre <sebastien@akoha.org>
|
||||
|
||||
Add link to MoinMoin sequence to deriv.xml
|
||||
|
||||
Yves Bossel: If I may do some suggestions:
|
||||
+ I would appreciate to be able to add UML comments to both diagram types.
|
||||
+ Adding patterns (collaborations ellipse with roles bound to classes) would be welcome into class diagrams.
|
||||
+ Self-adjusting box size and placement on sequence diagrams would help (I use lots of inner classes whose names are long and descriptive).
|
||||
|
||||
|
||||
Try the http://prefuse.sourceforge.net/ back end for large graphs.
|
||||
|
||||
Provide a parameter to say how (untagged) data members relate to other
|
||||
|
|
@ -25,17 +19,12 @@ public class A {
|
|||
}
|
||||
Requires special care for containers and arrays.
|
||||
|
||||
Add package, note, interface and node icons to graphviz
|
||||
(folder) dog-ear =[] 3D box
|
||||
|
||||
Support for all UML diagrams: state, use-case, etc.
|
||||
|
||||
command-line (and global) options for setting all graph attributes
|
||||
|
||||
Class options for setting edge attributes fillcolor fontcolor etc per edge
|
||||
|
||||
@active tag to render a class as active
|
||||
|
||||
Use doclet error reporting functions
|
||||
|
||||
A class can specify its rank, or its cluster.
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ callers.</li>
|
|||
usecase, and activeclass.
|
||||
These shapes require GraphViz 1.16 or newer.
|
||||
</li>
|
||||
<li> A new @note tag allows the annotation of elements with comments.
|
||||
(Suggested by Sébastien Pierre.)
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
|
|
|
|||
|
|
@ -554,6 +554,22 @@ class ClassGraph {
|
|||
}
|
||||
externalTableEnd();
|
||||
nodeProperties(opt);
|
||||
|
||||
// If needed, add a note for this node
|
||||
int ni = 0;
|
||||
for (Tag t : c.tags("note")) {
|
||||
String noteName = "n" + ni + "c" + ci.name;
|
||||
w.print("\t// Note annotation\n");
|
||||
w.print("\t" + noteName + " [label=");
|
||||
externalTableStart(UmlGraph.getCommentOptions(), c.qualifiedName(), classToUrl(c, rootClass));
|
||||
innerTableStart();
|
||||
tableLine(Align.LEFT, htmlNewline(escape(t.text())), UmlGraph.getCommentOptions(), Font.CLASS);
|
||||
innerTableEnd();
|
||||
externalTableEnd();
|
||||
nodeProperties(UmlGraph.getCommentOptions());
|
||||
w.print("\t" + noteName + " -> " + relationNode(c) + "[arrowhead=none];\n");
|
||||
ni++;
|
||||
}
|
||||
ci.nodePrinted = true;
|
||||
}
|
||||
return ci.name;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ public class UmlGraph {
|
|||
private static final String programName = "UmlGraph";
|
||||
private static final String docletName = "org.umlgraph.doclet.UmlGraph";
|
||||
|
||||
/** Options used for commenting nodes */
|
||||
private static Options commentOptions;
|
||||
|
||||
/** Entry point through javadoc */
|
||||
public static boolean start(RootDoc root) throws IOException {
|
||||
Options opt = buildOptions(root);
|
||||
|
|
@ -68,21 +71,33 @@ public class UmlGraph {
|
|||
err, err, err, docletName, args);
|
||||
}
|
||||
|
||||
public static Options getCommentOptions() {
|
||||
return commentOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the base Options object, that contains both the options specified on the command
|
||||
* Creates the base Options object.
|
||||
* This contains both the options specified on the command
|
||||
* line and the ones specified in the UMLOptions class, if available.
|
||||
* Also create the globally accessible commentOptions object.
|
||||
*/
|
||||
public static Options buildOptions(RootDoc root) {
|
||||
commentOptions = new Options();
|
||||
commentOptions.setOptions(root.options());
|
||||
commentOptions.setOptions(findClass(root, "UMLCommentOptions"));
|
||||
commentOptions.shape = "note";
|
||||
|
||||
Options opt = new Options();
|
||||
opt.setOptions(root.options());
|
||||
opt.setOptions(findUMLOptions(root));
|
||||
opt.setOptions(findClass(root, "UMLOptions"));
|
||||
return opt;
|
||||
}
|
||||
|
||||
private static ClassDoc findUMLOptions(RootDoc root) {
|
||||
/** Return the ClassDoc for the specified class; null if not found. */
|
||||
private static ClassDoc findClass(RootDoc root, String name) {
|
||||
ClassDoc[] classes = root.classes();
|
||||
for (ClassDoc cd : classes)
|
||||
if(cd.name().equals("UMLOptions"))
|
||||
if(cd.name().equals(name))
|
||||
return cd;
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue