Example #1
5
    private void addParticipant(String userId, String displayEmail, String name, String color) {
      DivElement rowElement = Elements.createDivElement(css.row());

      DivElement swatchElement = Elements.createDivElement(css.swatch());
      swatchElement.setAttribute("style", "background-color: " + color);
      rowElement.appendChild(swatchElement);

      SpanElement nameElement = Elements.createSpanElement(css.name());
      nameElement.setTextContent(name);
      nameElement.setTitle(displayEmail);
      rowElement.appendChild(nameElement);

      getElement().appendChild(rowElement);
      rows.put(userId, rowElement);
    }
Example #2
0
  private void renderDocumentation(
      Element element, SignatureInfo signatureInfo, Optional<Integer> activeParameter) {
    if (signatureInfo.getDocumentation().isPresent()) {
      elemental.html.DivElement documentation =
          Elements.createDivElement(resources.css().documentation());
      documentation.setTextContent(signatureInfo.getDocumentation().get());
      element.appendChild(documentation);
    }

    if (signatureInfo.getParameters().isPresent()
        && activeParameter.isPresent()
        && signatureInfo.getParameters().get().size() > activeParameter.get()) {
      ParameterInfo parameterInfo = signatureInfo.getParameters().get().get(activeParameter.get());
      if (parameterInfo.getDocumentation().isPresent()) {
        elemental.html.DivElement parameter =
            Elements.createDivElement(resources.css().documentationParameter());
        SpanElement label = Elements.createSpanElement(resources.css().documentationParameter());
        label.setTextContent(parameterInfo.getLabel());

        SpanElement documentation = Elements.createSpanElement(resources.css().documentation());
        documentation.setTextContent(parameterInfo.getDocumentation().get());

        parameter.appendChild(label);
        parameter.appendChild(documentation);
        element.appendChild(parameter);
      }
    }
  }
Example #3
0
 private void removeParticipant(String userId) {
   DivElement row = rows.get(userId);
   if (row != null) {
     row.removeFromParent();
   }
 }