Java Code Examples for com.google.gwt.safehtml.shared.SafeHtmlUtils#htmlEscape()

The following examples show how to use com.google.gwt.safehtml.shared.SafeHtmlUtils#htmlEscape() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HtmlMarkdownUtils.java    From actor-platform with GNU Affero General Public License v3.0 6 votes vote down vote up
private static String urlElement(MDUrl url) {
    // Sanitizing URL
    String href = UriUtils.sanitizeUri(url.getUrl());

    // "DeSanitize" custom url scheme
    if (url.getUrl().startsWith("send:")) {
        href = UriUtils.encodeAllowEscapes(url.getUrl());
    } else {
        // HotFixing url without prefix
        if (!href.equals("#") && !href.contains("://")) {
            href = "http://" + href;
        }
    }

    return "<a " +
            "target=\"_blank\" " +
            "onClick=\"window.messenger.handleLinkClick(event)\" " +
            "href=\"" + href + "\">" +
            SafeHtmlUtils.htmlEscape(url.getUrlTitle()) +
            "</a>";
}
 
Example 2
Source File: FilterBox.java    From unitime with Apache License 2.0 6 votes vote down vote up
private SuggestionMenuItem(final Suggestion suggestion) {
	super(suggestion.getDisplayString() == null
			? suggestion.getChip().getLabel() + " <span class='item-command'>" + suggestion.getChip().getTranslatedCommand() + "</span>"
			: SafeHtmlUtils.htmlEscape(suggestion.getDisplayString()) + (suggestion.getHint() == null ? "" : " " + suggestion.getHint()),
		true,
		new Command() {
			@Override
			public void execute() {
				hideSuggestions();
				setStatus(ARIA.suggestionSelected(suggestion.toAriaString(FilterBox.this)));
				applySuggestion(suggestion);
				iLastValue = getValue();
				setAriaLabel(toAriaString());
				fireSelectionEvent(suggestion);
				ValueChangeEvent.fire(FilterBox.this, getValue());
			}
		});
	setStyleName("item");
	getElement().setAttribute("whiteSpace", "nowrap");
	iSuggestion = suggestion;
}
 
Example 3
Source File: CubaGridWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected String getDefaultToggleHTML(String caption) {
    return "<span class=\"v-off\">" +
            "<div>" +
            SafeHtmlUtils.htmlEscape(caption) +
            "</div>" +
            "</span>";
}
 
Example 4
Source File: CubaTreeGridWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected String getDefaultToggleHTML(String caption) {
    return "<span class=\"v-off\">" +
            "<div>" +
            SafeHtmlUtils.htmlEscape(caption) +
            "</div>" +
            "</span>";
}
 
Example 5
Source File: VSliderPanel.java    From vaadin-sliderpanel with MIT License 5 votes vote down vote up
public void setCaption(final String caption, final boolean captionAsHtml) {
    String captionContent = caption != null ? caption : "";
    if (!captionAsHtml) {
        captionContent = SafeHtmlUtils.htmlEscape(captionContent);
    }
    this.captionNode.setInnerHTML(captionContent);
}
 
Example 6
Source File: FilterBox.java    From unitime with Apache License 2.0 5 votes vote down vote up
public String toAriaString(FilterBox box) {
	if (getChipToAdd() != null) {
		if (getChipToRemove() != null)
			return ARIA.chipReplace(getChipToAdd().getTranslatedCommand(), getChipToAdd().getLabel());
		else {
			if (box.hasChip(getChipToAdd()))
				return ARIA.chipDelete(getChipToAdd().getTranslatedCommand(), getChipToAdd().getLabel());
			else
				return ARIA.chipAdd(getChipToAdd().getTranslatedCommand(), getChipToAdd().getLabel());
		}
	} else if (getChipToRemove() != null) {
		return ARIA.chipDelete(getChipToRemove().getTranslatedCommand(), getChipToRemove().getLabel());
	}
	return SafeHtmlUtils.htmlEscape(getDisplayString()) + (getHint() == null ? "" : " " + getHint());
}
 
Example 7
Source File: AriaLink.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public AriaLink(String title) {
    super("<a href='javascript:void(0)' aria-label='"+ SafeHtmlUtils.htmlEscape(title)+"' style='vertical-align:bottom;'>"+title+"</a>");
    getElement().setTabIndex(0);

    this.sinkEvents(Event.ONKEYDOWN);

    addStyleName("inline-link");
}
 
Example 8
Source File: HtmlMarkdownUtils.java    From actor-platform with GNU Affero General Public License v3.0 4 votes vote down vote up
public static String renderCode(MDCode code) {
    return "<pre><code>" + SafeHtmlUtils.htmlEscape(code.getCode()) + "</pre></code>";
}