diff --git a/doc/ver.xml b/doc/ver.xml index 8ea7930..e5bc2a6 100644 --- a/doc/ver.xml +++ b/doc/ver.xml @@ -4,6 +4,9 @@
Version 5.1 Under development
+
Version 5.0 2007-11-29
@@ -13,7 +16,7 @@ This change requires corresponding modifications to the UMLGraph callers.
  • Add support for six new shapes: node, component, package, collaboration, usecase, and activeclass. -These shapes require GraphViz 1.16 or newer. +These shapes require GraphViz 2.16 or newer.
  • A new @note tag allows the annotation of elements with comments. (Suggested by Sébastien Pierre.) diff --git a/src/org/umlgraph/doclet/ClassGraph.java b/src/org/umlgraph/doclet/ClassGraph.java index 242526c..feacc89 100644 --- a/src/org/umlgraph/doclet/ClassGraph.java +++ b/src/org/umlgraph/doclet/ClassGraph.java @@ -471,8 +471,29 @@ class ClassGraph { w.println("\t// " + r); // Create label w.print("\t" + ci.name + " [label="); + + boolean showMembers = + (opt.showAttributes && c.fields().length > 0) || + (c.isEnum() && opt.showEnumConstants && c.enumConstants().length > 0) || + (opt.showOperations && c.methods().length > 0) || + (opt.showConstructors && c.constructors().length > 0); + externalTableStart(opt, c.qualifiedName(), classToUrl(c, rootClass)); - innerTableStart(); + + // Calculate the number of innerTable rows we will emmit + int nRows = 1; + if (showMembers) { + if (opt.showAttributes) + nRows++; + else if(!c.isEnum() && (opt.showConstructors || opt.showOperations)) + nRows++; + if (c.isEnum() && opt.showEnumConstants) + nRows++; + if (!c.isEnum() && (opt.showConstructors || opt.showOperations)) + nRows++; + } + + firstInnerTableStart(opt, nRows); if (c.isInterface()) tableLine(Align.CENTER, guilWrap(opt, "interface")); if (c.isEnum()) @@ -497,14 +518,13 @@ class ClassGraph { tableLine(Align.CENTER, escape(qualifiedName), opt, font); } tagvalue(opt, c); - innerTableEnd(); - - boolean showMembers = - (opt.showAttributes && c.fields().length > 0) || - (c.isEnum() && opt.showEnumConstants && c.enumConstants().length > 0) || - (opt.showOperations && c.methods().length > 0) || - (opt.showConstructors && c.constructors().length > 0); + firstInnerTableEnd(opt, nRows); + /* + * Warning: The boolean expressions guarding innerTableStart() + * in this block, should match those in the code block above + * marked: "Calculate the number of innerTable rows we will emmit" + */ if (showMembers) { if (opt.showAttributes) { innerTableStart(); @@ -1109,8 +1129,8 @@ class ClassGraph { if (url != null) href = " href=\"" + url + "\""; - w.print("<" + linePostfix); } @@ -1123,10 +1143,29 @@ class ClassGraph { + "cellpadding=\"1\">" + linePostfix); } + /** + * Start the first inner table of a class. + * @param nRows the total number of rows in this table. + */ + private void firstInnerTableStart(Options opt, int nRows) { + w.print(linePrefix + linePrefix + "" + opt.shape.extraColumn(nRows) + + "" + linePostfix); } - + + /** + * End the first inner table of a class. + * @param nRows the total number of rows in this table. + */ + private void firstInnerTableEnd(Options opt, int nRows) { + w.print(linePrefix + linePrefix + "
    " + linePostfix); + } + private void innerTableEnd() { w.print(linePrefix + linePrefix + "
    " + + opt.shape.extraColumn(nRows) + "" + linePostfix); + } + private void tableLine(Align align, String text) { tableLine(align, text, null, Font.NORMAL); } diff --git a/src/org/umlgraph/doclet/Shape.java b/src/org/umlgraph/doclet/Shape.java index a11adad..9faad6a 100644 --- a/src/org/umlgraph/doclet/Shape.java +++ b/src/org/umlgraph/doclet/Shape.java @@ -87,8 +87,8 @@ public class Shape { } /** Return the table border required for the shape */ - String border() { - return name.equals("activeclass") ? "2" : "0"; + String extraColumn(int nRows) { + return name.equals("activeclass") ? ("") : ""; } /** Return the cell border required for the shape */