public static <NodeType extends ZyGraphNode<?>> String createTooltip(
      final AbstractZyGraph<NodeType, ?> graph, final Edge edge) {
    Preconditions.checkNotNull(graph, "Error: Graph argument can not be null");
    Preconditions.checkNotNull(edge, "Error: Edge argument can not be null");

    // The generated tooltip has the following form:
    //
    // 1. Content of the source node
    // 2. Content of the edge label
    // 3. Content of the target node

    String text = createTooltip(graph, edge.source()).replace("</html>", "");

    final ZyEdgeRealizer<?> realizer = (ZyEdgeRealizer<?>) graph.getGraph().getRealizer(edge);

    if (realizer.labelCount() > 0) {
      final ZyEdgeLabel edgeLabel = (ZyEdgeLabel) realizer.getLabel();
      final ZyLabelContent content = edgeLabel.getLabelContent();

      text +=
          "<hr>"
              + HtmlGenerator.getHtml(content, GuiHelper.getMonospacedFont().getFontName(), false)
                  .replace("<html>", "")
                  .replace("</html>", "");
    }

    text += "<hr>" + createTooltip(graph, edge.target()).replace("<html>", "");

    return text;
  }
Creates the tooltip for an edge in the graph.

@param <NodeType> Type of the nodes in the graph.
@param graph The graph the edge belongs to.
@param edge The edge the tooltip is created for.
@return The generated tooltip text for the edge.
java/zylib/src/main/java/com/google/security/zynamics/zylib/yfileswrap/gui/zygraph/helpers/TooltipGenerator.java