private void renderParameters( Element parent, SignatureInfo signatureInfo, Optional<Integer> activeParameter) { int end = signatureInfo.getLabel().length(); int idx; Element element; for (int i = signatureInfo.getParameters().get().size() - 1; i >= 0; i--) { ParameterInfo parameterInfo = signatureInfo.getParameters().get().get(i); idx = signatureInfo.getLabel().lastIndexOf(parameterInfo.getLabel(), end); int signatureLabelOffset = 0; int signatureLabelEnd = 0; if (idx >= 0) { signatureLabelOffset = idx; signatureLabelEnd = idx + parameterInfo.getLabel().length(); } element = Elements.createSpanElement(); element.setTextContent(signatureInfo.getLabel().substring(signatureLabelEnd, end)); parent.insertBefore(element, parent.getFirstElementChild()); element = Elements.createSpanElement(resources.css().parameter()); if (activeParameter.isPresent() && i == activeParameter.get()) { Elements.addClassName(resources.css().active(), element); } element.setTextContent( signatureInfo.getLabel().substring(signatureLabelOffset, signatureLabelEnd)); parent.insertBefore(element, parent.getFirstElementChild()); end = signatureLabelOffset; } element = Elements.createSpanElement(); element.setTextContent(signatureInfo.getLabel().substring(0, end)); parent.insertBefore(element, parent.getFirstElementChild()); }
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); } } }