Example usage for com.vaadin.client WidgetUtil escapeHTML

List of usage examples for com.vaadin.client WidgetUtil escapeHTML

Introduction

In this page you can find the example usage for com.vaadin.client WidgetUtil escapeHTML.

Prototype

public static String escapeHTML(String html) 

Source Link

Document

Converts html entities to text.

Usage

From source file:com.haulmont.cuba.web.widgets.client.tooltip.CubaTooltip.java

License:Apache License

@Override
protected void setTooltipText(TooltipInfo info) {
    super.setTooltipText(info);

    if (info.getTitle() != null && !info.getTitle().isEmpty()) {
        description.getElement().removeAttribute("aria-hidden");
    } else {//from w w w  .java 2 s .  c o  m
        description.getElement().setAttribute("aria-hidden", "true");
    }

    String contextHelp = info.getContextHelp();
    if (contextHelp != null && !contextHelp.isEmpty()) {
        if (info.isContextHelpHtmlEnabled()) {
            contextHelpElement.setInnerHTML(contextHelp);
        } else {
            if (contextHelp.contains("\n")) {
                contextHelp = WidgetUtil.escapeHTML(contextHelp).replace("\n", "<br/>");
                contextHelpElement.setInnerHTML(contextHelp);
            } else {
                contextHelpElement.setInnerText(contextHelp);
            }
        }
        contextHelpElement.getStyle().clearDisplay();
    } else {
        contextHelpElement.setInnerHTML("");
        contextHelpElement.getStyle().setDisplay(Style.Display.NONE);
    }
}