Example #1
0
  private void render() {
    if (signatureHelp.getSignatures().size() > 1) {
      Elements.addClassName(resources.css().multiple(), rootElement);
      overloads.getStyle().setDisplay("block");
    } else {
      Elements.removeClassName(resources.css().multiple(), rootElement);
      overloads.getStyle().setDisplay("none");
    }

    signatures.setInnerHTML("");
    signatureViews = new ArrayList<>();
    int height = 0;
    for (SignatureInfo signatureInfo : signatureHelp.getSignatures()) {
      Element signatureElement =
          renderSignature(signatures, signatureInfo, signatureHelp.getActiveParameter());
      renderDocumentation(signatureElement, signatureInfo, signatureHelp.getActiveParameter());

      int signatureHeight = signatureElement.getOffsetHeight();
      signatureViews.add(Pair.of(height, signatureHeight));
      height += signatureHeight;
    }
  }
Example #2
0
  private void select(int position) {
    Pair<Integer, Integer> signaturePosition = signatureViews.get(position);
    if (signaturePosition == null) {
      return;
    }

    signatures.getStyle().setHeight(signaturePosition.second + "px");
    signatures.setScrollTop(signaturePosition.first);
    String overloads = "" + (position + 1);
    if (signatureViews.size() < 10) {
      overloads += ("/" + signatureViews.size());
    }

    this.overloads.setInnerText(overloads);
    setPopupPosition(x, y - getElement().getOffsetHeight());
  }