Class DotFactory

java.lang.Object
kieker.tools.trace.analysis.filter.visualization.util.dot.DotFactory

public final class DotFactory
extends java.lang.Object
This class provides a collection of static methods to compile Graphviz Dot elements from string attributes and properties. These elements may be compiled to complete Dot files externally.
Since:
1.1
See Also:
Graphviz - Graph Visualization Software, Graphviz - Wikipedia
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String DOT_ARROWHEAD_OPEN
    Determines to use an open arrow head for an edge.
    static double DOT_DEFAULT_FONTSIZE
    Determines the default font size.
    static java.lang.String DOT_DOT_RANKDIR_LR
    Determines to use the rank direction left to right .
    static java.lang.String DOT_FILLCOLOR_GRAY
    A constant for the color "gray".
    static java.lang.String DOT_FILLCOLOR_WHITE
    A constant for the color "white".
    static java.lang.String DOT_SHAPE_BOX
    Determines to use the "box" shape.
    static java.lang.String DOT_SHAPE_BOX3D
    Determines to use the "3D box" shape.
    static java.lang.String DOT_SHAPE_NONE
    Determines to use no shape at all.
    static java.lang.String DOT_SHAPE_OVAL
    Determines to use the "oval" shape.
    static java.lang.String DOT_STYLE_DASHED
    Determines to use the "dashed" style for a line or a frame.
    static java.lang.String DOT_STYLE_FILLED
    Determines to the use the "filled" style for a component.
    static java.lang.String DOT_STYLE_SOLID
    Determines to use the "solid" style for a line or a frame.
  • Method Summary

    Modifier and Type Method Description
    static java.lang.StringBuilder createCluster​(java.lang.String prefix, java.lang.String name, java.lang.String label, java.lang.String shape, java.lang.String style, java.lang.String framecolor, java.lang.String fillcolor, java.lang.String fontcolor, double fontsize, java.lang.String misc)
    Constructs dot code for a cluster from the specified elements.
    static java.lang.String createConnection​(java.lang.String prefix, java.lang.String from, java.lang.String to, double taillabel, double headlabel)
    This method creates dot code for a connection.
    static java.lang.String createConnection​(java.lang.String prefix, java.lang.String from, java.lang.String to, java.lang.String style, java.lang.String arrowhead, java.lang.String color)
    Creates dot code for a connection.
    static java.lang.String createConnection​(java.lang.String prefix, java.lang.String from, java.lang.String to, java.lang.String label, java.lang.String style, java.lang.String arrowhead, java.lang.String color)
    Creates dot code for a connection.
    static java.lang.StringBuilder createEdgeDefaults​(java.lang.String style, java.lang.String arrowhead, java.lang.String labelfontname)
    Constructs dot code for the edge defaults.
    static java.lang.StringBuilder createHeader​(java.lang.String name, java.lang.String label, java.lang.String fontcolor, java.lang.String fontname, double fontsize)
    This method constructs the neccesary dot code for a directed graph (digraph) file header (Should be called only once per dot file).
    static java.lang.StringBuilder createNode​(java.lang.String prefix, java.lang.String nodeId, java.lang.String label, java.lang.String shape, java.lang.String style, java.lang.String framecolor, java.lang.String fillcolor, java.lang.String fontcolor, double fontsize, java.lang.String imageFilename, java.lang.String misc, java.lang.String tooltip)
    Constructs dot code for a node from the specified elements.
    static java.lang.StringBuilder createNodeDefaults​(java.lang.String style, java.lang.String shape, java.lang.String framecolor, java.lang.String fontcolor, java.lang.String fontname, double fontsize, java.lang.String imagescale)
    This method constructs the necessary dot code for the node defaults.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • createHeader

      public static java.lang.StringBuilder createHeader​(java.lang.String name, java.lang.String label, java.lang.String fontcolor, java.lang.String fontname, double fontsize)
      This method constructs the neccesary dot code for a directed graph (digraph) file header (Should be called only once per dot file).
      Parameters:
      name - The name of the digraph.
      label - text to show at the label location (specified elsewhere) with HTML braces (<>)
      fontcolor - The font color.
      fontname - The name of the font.
      fontsize - The size of the font.
      Returns:
      The digraph header as valid dot code.
    • createNodeDefaults

      public static java.lang.StringBuilder createNodeDefaults​(java.lang.String style, java.lang.String shape, java.lang.String framecolor, java.lang.String fontcolor, java.lang.String fontname, double fontsize, java.lang.String imagescale)
      This method constructs the necessary dot code for the node defaults. Those values will be used if a parameter within a call of the other methods is null (Should be called only once per dot file).
      Parameters:
      style - The default style of the nodes.
      shape - The default shape of the nodes.
      framecolor - The default frame color of the nodes.
      fontcolor - The default font color of the nodes.
      fontname - The default font names of the nodes.
      fontsize - The default font size of the nodes.
      imagescale - The image scale property. This attribute determines how an image fills the "parent" node.
      Returns:
      The graph node defaults as valid dot code.
    • createEdgeDefaults

      public static java.lang.StringBuilder createEdgeDefaults​(java.lang.String style, java.lang.String arrowhead, java.lang.String labelfontname)
      Constructs dot code for the edge defaults. (Should be called only once per dot file.)
      Parameters:
      style - The default style for the edges.
      arrowhead - The defualt arrow head for the edges.
      labelfontname - label font nodeId, works only for headlabel and taillabel, not simple label
      Returns:
      graph edge defaults as dot code
    • createNode

      public static java.lang.StringBuilder createNode​(java.lang.String prefix, java.lang.String nodeId, java.lang.String label, java.lang.String shape, java.lang.String style, java.lang.String framecolor, java.lang.String fillcolor, java.lang.String fontcolor, double fontsize, java.lang.String imageFilename, java.lang.String misc, java.lang.String tooltip)
      Constructs dot code for a node from the specified elements.
      Parameters:
      prefix - usually spaces, dependent on hierarchy - only for nice ascii formatting inside the dot code
      nodeId - The id of the node.
      label - The label to be used within the node. This parameter can be null.
      shape - The shape of the node. This parameter can be null.
      style - The style of the node. This parameter can be null.
      framecolor - The color of the frame of the node. This parameter can be null.
      fillcolor - The color which will be used to fill the node. This parameter can be null.
      fontcolor - The color of the font. This parameter can be null.
      fontsize - The size of the font. This parameter can be null.
      imageFilename - The name of the image to be displayed inside the node.
      misc - This parameter can be used to add miscellaneous data and dot code.
      tooltip - The tooltip of this node. This parameter can be null.
      Returns:
      The graph node as valid dot code
    • createCluster

      public static java.lang.StringBuilder createCluster​(java.lang.String prefix, java.lang.String name, java.lang.String label, java.lang.String shape, java.lang.String style, java.lang.String framecolor, java.lang.String fillcolor, java.lang.String fontcolor, double fontsize, java.lang.String misc)
      Constructs dot code for a cluster from the specified elements. ATTENTION: Without closing bracket! ( "}" has to be appended by calling method.)
      Parameters:
      prefix - usually spaces, dependent on hierarchy - only for nice ascii formatting inside the dot code
      name - The name of the cluster.
      label - The label to be used for the cluster.
      shape - The shape of the cluster. This parameter can be null.
      style - The style of the frame. This parameter can be null.
      framecolor - The color of the frame. This parameter can be null.
      fillcolor - The color which will be used to fill the frame. This parameter can be null.
      fontcolor - The color of the font. This parameter can be null.
      fontsize - The size of the font. This parameter can be null.
      misc - This parameter can be used to add miscellaneous data and dot code (like further content). This parameter can be null.
      Returns:
      A graph cluster as valid dot code - but without the closing bracket.
    • createConnection

      public static java.lang.String createConnection​(java.lang.String prefix, java.lang.String from, java.lang.String to, java.lang.String style, java.lang.String arrowhead, java.lang.String color)
      Creates dot code for a connection. It is assumed that the typical properties (color etc) are already formatted for the usage within dot.
      Parameters:
      prefix - usually spaces, dependent on hierarchy - only for nice ascii formatting inside the dot code
      from - The string representation of the start node.
      to - The string representation of the destination node.
      color - The color of the edge. This parameter can be null.
      style - The style of the edge. This parameter can be null.
      arrowhead - The type of the arrowhead of the edge. This parameter can be null.
      Returns:
      A graph connection as valid dot code.
    • createConnection

      public static java.lang.String createConnection​(java.lang.String prefix, java.lang.String from, java.lang.String to, java.lang.String label, java.lang.String style, java.lang.String arrowhead, java.lang.String color)
      Creates dot code for a connection. It is the same as a call to createConnection(String, String, String, String, String, String) except that a label can be added.
      Parameters:
      prefix - usually spaces, dependent on hierarchy - only for nice ascii formatting inside the dot code
      from - The string representation of the start node.
      to - The string representation of the destination node.
      label - The label of the edge.
      color - The color of the edge. This parameter can be null.
      style - The style of the edge. This parameter can be null.
      arrowhead - The type of the arrowhead of the edge. This parameter can be null.
      Returns:
      A graph connection as valid dot code.
    • createConnection

      public static java.lang.String createConnection​(java.lang.String prefix, java.lang.String from, java.lang.String to, double taillabel, double headlabel)
      This method creates dot code for a connection. It is the same as a call to createConnection(String, String, String, String, String, String) except that color, style and arrowhead cannot be modified and that a headlabel and a taillabel can be added.
      Parameters:
      prefix - usually spaces, dependent on hierarchy - only for nice ascii formatting inside the dot code
      from - The string representation of the start node.
      to - The string representation of the destination node.
      taillabel - The label of the edge at the tail of the connection.
      headlabel - The label of the edge at the head of the connection.
      Returns:
      A graph connection as valid dot code.