Showing posts with label graphviz. Show all posts
Showing posts with label graphviz. Show all posts

Thursday, January 27, 2011

Syntax for flowcharts in Confluence

The Confluence wiki has this amazing Flowchart Macro that lets users draw diagrams really quickly.

Although the site for the macro combined with its comments section provides a great number of examples on what syntax to use to accomplish what you want in your diagream, its a bit scatterred so here are my facorites lsited in a neat order:
  1. How do I write a line? I know how to write single words but I write multiple words with space in them then they each become separate nodes!
    • Instead of writing: thisIsNodeA -> thisIsNodeB
    • You can use quotations to write: "This is node A" -> "This is node B"
  2. How do I add text next to the arrows leading from one node to the other?
    • "Node A" -> "Node B" [label="text associated w/ arrow", fontsize=10]
    • If you try this without the fontsize, it will still work but you will quickly realize that the default fontsize is way too big.
  3. How do I break up the text for my line across multiple lines? How do I add a newline?
    • "Text for Node A \n will show up on two lines" > "Text for Node B will show up in one line"
    • The use of \n allows you to break up the text across multiple lines

Sunday, October 31, 2010

Generating UML Diagramns with Maven

  1. Install Graphviz. After installation confirm that it is part of your PATH.
  2. Configure your maven pom files to make sure that you can get to the following repository: http://mirrors.ibiblio.org/pub/mirrors/maven2 because it has the second piece of the puzzle, the binaries for UMLGraph. You can see all the options for use in <additionalparam/> here.
  3. To generate UML diagrams as part of the "mvn javadoc:javadoc" command, add the following (+/-) to your pom.xml file's <build/> section.
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
              <docletArtifact>
                <groupId>org.umlgraph</groupId>
                <artifactId>doclet</artifactId>
                <version>5.1</version>
              </docletArtifact>
              <additionalparam>-views</additionalparam>
              <destDir>target/uml</destDir>
              <show>private</show>
            </configuration>
          </plugin>
  4. To generate UML diagrams as part of the "mvn site" command, add the following (+/-) to your pom.xml file's <reporting/> section.
      <reporting>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <reportSets>
              <reportSet>
                <id>uml</id>
                <configuration>
                  <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
                  <docletArtifact>
                    <groupId>org.umlgraph</groupId>
                    <artifactId>doclet</artifactId>
                    <version>5.1</version>
                  </docletArtifact>
                  <additionalparam>-views</additionalparam>
                  <destDir>target/uml</destDir>
                  <show>private</show>
                </configuration>
                <reports>
                  <report>javadoc</report>
                </reports>
              </reportSet>
            </reportSets>
          </plugin>
        </plugins>
      </reporting>
  5. That's it, you should now be reaping the benefits as your javadocs will have UML diagrams inside each class's landing page. I used the following post to put all this info together: http://wiki.wsmoak.net/cgi-bin/wiki.pl?UMLGraph