static String buildTitle(final ViewData viewData, final EGraph type) {
    if (viewData instanceof FlowGraphViewData) {
      final FlowGraphViewData data = (FlowGraphViewData) viewData;
      IAddress address;
      final Joiner joiner = Joiner.on(" ").skipNulls();
      switch (type) {
        case PRIMARY_GRAPH:
          address = data.getAddress(ESide.PRIMARY);
          return address == null ? "" : address + " " + data.getFunctionName(ESide.PRIMARY);
        case SECONDARY_GRAPH:
          address = data.getAddress(ESide.SECONDARY);
          return address == null ? "" : data.getFunctionName(ESide.SECONDARY) + " " + address;
        case COMBINED_GRAPH:
          final IAddress primaryAddress = data.getAddress(ESide.PRIMARY);
          final String primaryName = data.getFunctionName(ESide.PRIMARY);
          final IAddress secondaryAddress = data.getAddress(ESide.SECONDARY);
          final String secondaryName = data.getFunctionName(ESide.SECONDARY);
          return joiner.join(
              primaryAddress,
              primaryName,
              primaryAddress == null || secondaryAddress == null ? "" : "   vs   ",
              secondaryAddress,
              secondaryName);
        default:
      }
    } else if (viewData instanceof CallGraphViewData) {
      final CallGraphViewData data = (CallGraphViewData) viewData;
      switch (type) {
        case PRIMARY_GRAPH:
          return data.getImageName(ESide.PRIMARY);
        case SECONDARY_GRAPH:
          return data.getImageName(ESide.SECONDARY);
        case COMBINED_GRAPH:
          return String.format(
              "%s vs %s", data.getImageName(ESide.PRIMARY), data.getImageName(ESide.SECONDARY));
        default:
      }
    }
    return "";
  }
Manages background drawing for graph views.
java/ui/src/main/java/com/google/security/zynamics/bindiff/graph/backgroundrendering/BackgroundRendererManager.java