Merge pull request #45 from robross0606/master

Added "-autosize" parameter and fixed parameter matching bug with "!"
This commit is contained in:
Diomidis Spinellis 2017-03-21 19:47:26 +02:00 committed by GitHub
commit d744535438
7 changed files with 43 additions and 22 deletions

View File

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="JDK_LIB/tools.jar"/>
<classpathentry kind="output" path="build"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="JDK_LIB/tools.jar"/>
<classpathentry kind="output" path="build"/>
</classpath>

View File

@ -156,6 +156,7 @@ class Version { public static String VERSION = "${VERSION}";}
<doclet name="org.umlgraph.doclet.UmlGraphDoc" path="${lib}/UmlGraph.jar">
<param name="-inferrel"/>
<param name="-inferdep"/>
<param name="-autosize"/>
<param name="-collapsible"/>
<param name="-hide" value="java.*"/>
<param name="-collpackages" value="java.util.*"/>

View File

@ -39,6 +39,7 @@ be specified through javadoc tags within the diagram, affecting all or some elem
<h2>Visual Appearance</h2> <!-- {{{1 -->
<dl>
<dt>-bgcolor</dt><dd>Specify the graph's background color. </dd>
<dt>-autosize</dt><dd>Fits generated graph to the width of the page/window. Defaults to true. </dd>
<dt>-collapsible</dt><dd>Enhance the javadoc HTML files containing UML diagrams with Javascript that provides a link for showing the (initially collapsed) diagrams. </dd>
<dt>-edgecolor</dt><dd>Specify the color for drawing edges. </dd>
<dt>-edgefontcolor</dt><dd>Specify the font color to use for edge labels. </dd>
@ -77,9 +78,9 @@ be specified through javadoc tags within the diagram, affecting all or some elem
<p />
All colors can be either a symbolic name (e.g. blue),
a tripple specifying hue-saturation-brightness as values 0-1
a triple specifying hue-saturation-brightness as values 0-1
(e.g. ".13 0.9 1"),
or a tripple specifying red-green-blue values as hexadecimal
or a triple specifying red-green-blue values as hexadecimal
digits prefixed by a # (e.g. "#ff8020").
The symbolic color names are derived from the X Windows System;
you can find a complete list in the

View File

@ -128,6 +128,7 @@
<docletPath>${project.build.directory}${file.separator}${project.build.finalName}.jar</docletPath>
<additionalparam>-inferrel</additionalparam>
<additionalparam>-inferdep</additionalparam>
<additionalparam>-autosize</additionalparam>
<additionalparam>-collapsible</additionalparam>
<additionalparam>-hide java.*</additionalparam>
<additionalparam>-collpackages</additionalparam>

View File

@ -77,6 +77,7 @@ public class Options implements Cloneable, OptionProvider {
boolean horizontal;
boolean showType;
boolean showComment;
boolean autoSize;
String edgeFontName;
String edgeFontColor;
String edgeColor;
@ -144,6 +145,7 @@ public class Options implements Cloneable, OptionProvider {
showEnumerations = false;
showConstructors = false;
showType = false;
autoSize = true;
showComment = false;
edgeFontName = defaultFont;
edgeFontColor = "black";
@ -221,19 +223,20 @@ public class Options implements Cloneable, OptionProvider {
* Will return 0 if the option is not supported.
*/
public static int optionLength(String option) {
if(option.equals("-qualify") ||
option.equals("-horizontal") ||
option.equals("-attributes") ||
option.equals("-operations") ||
option.equals("-constructors") ||
option.equals("-visibility") ||
option.equals("-types") ||
option.equals("-commentname") ||
if(option.equals("-qualify") || option.equals("-!qualify") ||
option.equals("-horizontal") || option.equals("-!horizontal") ||
option.equals("-attributes") || option.equals("-!attributes") ||
option.equals("-enumconstants") || option.equals("-!enumconstants") ||
option.equals("-operations") || option.equals("-!operations") ||
option.equals("-enumerations") || option.equals("-!enumerations") ||
option.equals("-constructors") || option.equals("-!constructors") ||
option.equals("-visibility") || option.equals("-!visibility") ||
option.equals("-types") || option.equals("-!types") ||
option.equals("-autosize") || option.equals("-!autosize") ||
option.equals("-commentname") || option.equals("-!commentname") ||
option.equals("-all") ||
option.equals("-postfixpackage") ||
option.equals("-noguillemot") ||
option.equals("-enumconstants") ||
option.equals("-enumerations") ||
option.equals("-views") ||
option.equals("-inferrel") ||
option.equals("-useimports") ||
@ -326,6 +329,10 @@ public class Options implements Cloneable, OptionProvider {
showType = true;
} else if (opt[0].equals("-!types")) {
showType = false;
} else if(opt[0].equals("-autoSize")) {
autoSize = true;
} else if (opt[0].equals("-!autoSize")) {
autoSize = false;
} else if(opt[0].equals("-commentname")) {
showComment = true;
} else if (opt[0].equals("-!commentname")) {

View File

@ -162,9 +162,14 @@ public class UmlGraphDoc {
//Format string for the uml image div tag.
private static final String UML_DIV_TAG =
"<div align=\"center\">" +
"<object width=\"100%%\" height=\"100%%\" type=\"image/svg+xml\" data=\"%1$s.svg\" alt=\"Package class diagram package %1$s\" border=0></object>" +
"<object width=\"100%%\" height=\"100%%\" type=\"image/svg+xml\" data=\"%1$s.svg\" alt=\"Package class diagram package %1$s\" border=0></object>" +
"</div>";
private static final String UML_AUTO_SIZED_DIV_TAG =
"<div align=\"center\">" +
"<object type=\"image/svg+xml\" data=\"%1$s.svg\" alt=\"Package class diagram package %1$s\" border=0></object>" +
"</div>";
private static final String EXPANDABLE_UML_STYLE = "font-family: Arial,Helvetica,sans-serif;font-size: 1.5em; display: block; width: 250px; height: 20px; background: #009933; padding: 5px; text-align: center; border-radius: 8px; color: white; font-weight: bold;";
//Format string for the java script tag.
@ -217,7 +222,11 @@ public class UmlGraphDoc {
if (!matched && insertPointPattern.matcher(line).matches()) {
matched = true;
String tag = String.format(UML_DIV_TAG, className);
String tag;
if (opt.autoSize)
tag = String.format(UML_AUTO_SIZED_DIV_TAG, className);
else
tag = String.format(UML_DIV_TAG, className);
if (opt.collapsibleDiagrams)
tag = String.format(EXPANDABLE_UML, tag, "Show UML class diagram", "Hide UML class diagram");
writer.write("<!-- UML diagram added by UMLGraph version " +

View File

@ -1,4 +1,4 @@
/* Automatically generated file */
package org.umlgraph.doclet;
class Version { public static String VERSION = "R5_7_2-22-g58087c";}
class Version { public static String VERSION = "R5_7_2-27-g5e854d";}