// TODO: Long term we need a markdown engine :) public static void markup(Element e, String text, String linkCssClass) { e.setInnerHTML(""); List<String> paragraphs = StringUtils.split(text, "\n\n"); for (String paragraph : paragraphs) { markupParagraph(e, paragraph, linkCssClass); } }
public HomepageSection( final String token, final String header, final String intro, final String... steps) { // @formatter:off Elements.Builder builder = new Elements.Builder() .div() .div() .css("eap-toggle-controls") .a() .css("clickable") .rememberAs("toggle") .start("i") .css("icon-angle-down") .rememberAs("icon") .end() .span() .textContent(" " + header) .end() .end() .a() .attr("href", "#" + token) .span() .textContent("Start ") .end() .start("i") .css("icon-circle-arrow-right") .end() .end() .end() .div() .css("eap-toggle-container") .rememberAs("body") .p() .textContent(intro) .end() .ol() .rememberAs("steps") .end() .end() .end(); // @formatter:on wireToggle(builder.referenceFor("toggle")); Document document = Browser.getDocument(); Element ol = builder.referenceFor("steps"); for (String step : steps) { Element li = document.createLIElement(); li.setInnerHTML(step); ol.appendChild(li); } this.icon = builder.referenceFor("icon"); this.body = builder.referenceFor("body"); this.root = builder.build(); this.collapsed = false; }
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; } }
/** Replaces the contents of a container with the given contents. */ public static void replaceContents(Element container, Element contents) { container.setInnerHTML(""); container.appendChild(contents); }