Package com.puppetlabs.graph.elements

Examples of com.puppetlabs.graph.elements.Vertex


    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append("References from ");
    stringBuilder.append(makeTooltip(me.from, me.to));
    String tooltipString = stringBuilder.toString();
    Vertex edgeVertex = null;
    if(me.imported != null) {
      edgeVertex = new Vertex("", STYLE_CLASS_IMPORTS);
      edgeVertex.setStyles(labelStyleForImported(me.imported, me.ambiguities).add(
        StyleSet.withStyle(styles.tooltip(tooltipString))));
      me.setVertex(edgeVertex);
    }
    else {
      edgeVertex = new Vertex("", STYLE_CLASS_UNRESOLVED_IMPORTS);
      edgeVertex.setStyles(labelStyleForUnresolved(me).add(StyleSet.withStyle(styles.tooltip(tooltipString))));
      me.setVertex(edgeVertex);
    }
    // Set style classes for FROM and TO
    edgeVertex.addAllStyleClasses(classesOfEdge(me));
    return edgeVertex;
  }
View Full Code Here


    String style = mnd.exists()
        ? (mnd.isAmbiguous())
            ? STYLE_CLASS_AMBIGUOUSLY_RESOLVED_MODULE
            : STYLE_CLASS_RESOLVED_MODULE
        : STYLE_CLASS_UNRESOLVED_MODULE;
    Vertex v = new Vertex(label, style);
    v.setStyles(styles.href(mnd.href));
    v.putUserData(IFunctionFactory.ID_KEY, idOfVertex(mnd));
    mnd.setVertex(v);
    return v;
  }
View Full Code Here

    String label = mnd.name == null
        ? ""
        : mnd.name.toString();
    // no version (user is not aware of one).
    String style = STYLE_CLASS_PPNODE_MODULE;
    Vertex v = new Vertex(label, style);
    v.setStyles(styles.href(mnd.href));
    v.putUserData(IFunctionFactory.ID_KEY, idOfVertex(mnd));
    mnd.setVertex(v);
    return v;
  }
View Full Code Here

  private Vertex createVertexForRootNode(ModuleNodeData mnd) {
    String label = mnd.name.toString();
    if(mnd.version != null)
      label += "\n" + mnd.version;
    Vertex v = new Vertex(label, STYLE_CLASS_ROOT);
    mnd.setVertex(v);
    return v;
  }
View Full Code Here

    }

    // only draw the root node if it has been marked (incoming dependency), or has outgoing
    // when not rendering all, the non modular must have incoming dependencies to show.
    if(renderAll && nonModularNode.outgoing.size() > 0 || nonModularNode.marked) {
      Vertex v = createVertexForRootNode(nonModularNode);
      g.addVertex(v);
    }

    // Create Vertexes for all Edges that have data
    // (very large labels on edges does not work that well as they often overlap)
    // Skip edges that are from non marked module nodes unless everything is rendered
    for(ModuleEdge me : moduleEdges) {
      // filter out self references
      if(me.from == me.to)
        continue;
      if(renderAll || me.from.marked) {
        cancel.assertContinue();
        Vertex v = createVertexForEdge(me);
        if(v != null) {
          g.addVertex(v);
        }
      }
    }
View Full Code Here

      return true;
    }
  };

  protected Vertex createVertexForMissingResource(String ref) {
    Vertex v = new Vertex("", STYLE_MissingResource);
    v.setStyles(styles.labelFormat(styles.labelStringTemplate("Error: Unknown \\n" + ref)));
    return v;
  }
View Full Code Here

*
*/
public class CatalogGraphProducer extends AbstractCatalogGraphProducer implements CatalogGraphStyles {

  private Vertex createVertexFor(CatalogResource resource, IPath root) {
    Vertex v = new Vertex("", STYLE_Resource);
    v.setStyles(labelStyleForResource(resource, root));
    return v;
  }
View Full Code Here

      builder.append(r.getType().toLowerCase());
      builder.append("[");
      builder.append(r.getTitle().toLowerCase());
      builder.append("]");

      Vertex v = createVertexFor(r, root);
      g.addVertex(v);
      vertexMap.put(builder.toString(), v);
      resourceVertexMap.put(r, v);
    }

    for(CatalogResource r : catalog.getResources()) {
      final Vertex source = resourceVertexMap.get(r);
      for(CatalogResourceParameter p : Iterables.filter(
        getParameterIterable(r), Predicates.not(regularParameterPredicate))) {
        String aName = p.getName();
        String style = null;
        if("subscribe".equals(aName))
          style = CatalogGraphStyles.STYLE_SubscribeEdge;
        else if("before".equals(aName))
          style = CatalogGraphStyles.STYLE_BeforeEdge;
        else if("notify".equals(aName))
          style = CatalogGraphStyles.STYLE_NotifyEdge;
        else
          style = CatalogGraphStyles.STYLE_RequireEdge;
        for(String ref : p.getValue()) {
          Vertex target = vertexMap.get(ref.toLowerCase());
          if(target == null) {
            target = createVertexForMissingResource(ref);
            vertexMap.put(ref.toLowerCase(), target); // keep it if there are more references
            g.addVertex(target);
          }
          Edge edge = new Edge(aName, style, source, target);
          g.addEdge(edge);
        }
      }
    }
    for(CatalogEdge e : catalog.getEdges()) {
      Vertex source = vertexMap.get(e.getSource().toLowerCase());
      Vertex target = vertexMap.get(e.getTarget().toLowerCase());
      Edge edge = new Edge("", STYLE_ResourceEdge, source, target);
      g.addEdge(edge);
    }

    return g;
View Full Code Here

  private void createVertexesFor(Iterable<CatalogResource> resources, //
      Map<String, Vertex> vertexMap, //
      Map<CatalogResource, Vertex> resourceVertexMap, //
      Map<Vertex, CatalogResource> catalogMap) {
    for(CatalogResource r : resources) {
      Vertex v = createVertexFor(r);
      vertexMap.put(keyOf(r), v);
      resourceVertexMap.put(r, v);
      catalogMap.put(v, r);
    }
View Full Code Here

    }

  }

  private Vertex createVertexFor(CatalogResource resource) {
    Vertex v = new Vertex("", STYLE_Resource);
    return v;
  }
View Full Code Here

TOP

Related Classes of com.puppetlabs.graph.elements.Vertex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.