Example usage for com.google.gwt.safehtml.shared SafeHtmlUtils htmlEscape

List of usage examples for com.google.gwt.safehtml.shared SafeHtmlUtils htmlEscape

Introduction

In this page you can find the example usage for com.google.gwt.safehtml.shared SafeHtmlUtils htmlEscape.

Prototype

public static String htmlEscape(String s) 

Source Link

Document

HTML-escapes a string.

Usage

From source file:gov.wa.wsdot.mobile.client.widget.CellWithIcon.java

License:Open Source License

@Override
public void render(SafeHtmlBuilder safeHtmlBuilder, final T model) {
    SafeHtml content = TEMPLATE.content(AppBundle.INSTANCE.css().cellImage(), getDisplayImage(model),
            SafeHtmlUtils.htmlEscape(getDisplayString(model)));

    safeHtmlBuilder.append(content);/*from   www.ja  v a 2  s  . c  o m*/
}

From source file:gov.wa.wsdot.mobile.client.widget.SimpleListItem.java

License:Open Source License

@Override
public void render(SafeHtmlBuilder safeHtmlBuilder, final T model) {
    SafeHtml content = TEMPLATE.content(AppBundle.INSTANCE.css().cellDetails3(),
            SafeHtmlUtils.fromTrustedString(getDisplayDescription(model)),
            SafeHtmlUtils.htmlEscape(getDisplayLastUpdated(model)));

    safeHtmlBuilder.append(content);/* ww w .ja v a2 s .  co m*/
}

From source file:gov.wa.wsdot.mobile.client.widget.TitleDescLastUpdatedCell.java

License:Open Source License

@Override
public void render(SafeHtmlBuilder safeHtmlBuilder, final T model) {
    SafeHtml content = TEMPLATE.content(AppBundle.INSTANCE.css().cellDetails3(),
            SafeHtmlUtils.fromTrustedString(getDisplayTitle(model)),
            SafeHtmlUtils.fromTrustedString(getDisplayDescription(model)),
            SafeHtmlUtils.htmlEscape(getDisplayLastUpdated(model)));

    safeHtmlBuilder.append(content);// ww  w  .  j av a2s  .com
}

From source file:gov.wa.wsdot.search.client.SearchWidget.java

License:Open Source License

private void getSuggestions() {
    String url = JSON_URL_SUGGESTION;
    String searchString = SafeHtmlUtils.htmlEscape(searchSuggestBox.getText().trim().replace("'", ""));

    // Append the name of the callback function to the JSON URL.
    url += searchString;/*from   w  w w. j  av a 2  s . c  om*/
    url = URL.encode(url);
    getSuggestionData(url);
}

From source file:gov.wa.wsdot.search.client.SearchWidget.java

License:Open Source License

/**
 * This method is called whenever the application's history changes.
 * //w ww.j a v a 2s .c om
 * Calling the History.newItem(historyToken) method causes a new history entry to be
 * added which results in ValueChangeEvent being called as well.
 */
@Override
public void onValueChange(ValueChangeEvent<String> event) {
    String url = JSON_URL;
    String url_flickr = JSON_URL_FLICKR;
    String url_highway_alerts = JSON_URL_HIGHWAY_ALERTS;
    String historyToken = event.getValue();

    // This handles the initial GET call to the page. Rewrites the ?q= to #q=
    String queryParameter = Window.Location.getParameter("q");
    if (queryParameter != null) {
        UrlBuilder urlBuilder = Window.Location.createUrlBuilder().removeParameter("q");
        urlBuilder.setHash(historyToken);
        String location = urlBuilder.buildString();
        Window.Location.replace(location);
    }

    String[] tokens = historyToken.split("&"); // e.g. #q=Ferries&p=2
    Map<String, String> map = new HashMap<String, String>();
    for (String string : tokens) {
        try {
            map.put(string.split("=")[0], string.split("=")[1]);
        } catch (ArrayIndexOutOfBoundsException e) {
            // TODO: Need a better way to handle this.
        }
    }

    String query = map.get("q");
    String page = map.get("p");

    if (page == null) {
        page = "1";
    }

    searchSuggestBox.setText(query);
    String searchString = SafeHtmlUtils
            .htmlEscape(searchSuggestBox.getText().trim().replace("'", "").replace("\"", ""));
    loadingImage.setVisible(true);

    searchSuggestBox.setFocus(true);
    leftNavBoxHTMLPanel.setVisible(false);
    photosDisclosurePanel.setVisible(false);
    boostedResultsHTMLPanel.setVisible(false);
    alertsDisclosurePanel.setVisible(false);

    if (searchString.isEmpty()) {
        clearPage();
        loadingImage.setVisible(false);
        bingLogoHTMLPanel.setVisible(false);
    } else {
        if (ANALYTICS_ENABLED) {
            Analytics.trackEvent(EVENT_TRACKING_CATEGORY, "Keywords", searchString.toLowerCase());
        }
        clearPage();

        // Append the name of the callback function to the JSON URL.
        url += searchString;
        url += "&page=" + page;
        url = URL.encode(url);

        // Append search query to Flickr url.
        url_flickr += searchString;
        url_flickr = URL.encode(url_flickr);

        // Send requests to remote servers with calls to JSNI methods.
        getSearchData(url, searchString, page);
        getPhotoData(url_flickr, searchString);
        getHighwayAlertsData(url_highway_alerts, searchString);
    }
}

From source file:mx.org.pescadormvp.core.client.internallinks.InternalCheckableItemLink.java

License:Open Source License

@Override
protected void setPresentationText(String presentaitonText) {
    textArea.setInnerHTML(SafeHtmlUtils.htmlEscape(presentaitonText));
    setMinSizes();
}

From source file:mx.org.pescadormvp.core.client.internallinks.InternalLinkBase.java

License:Open Source License

@Override
public void setAlternatePresentationText(String alternatePresentationText) {
    this.alternatePresentationText = alternatePresentationText;
    setPresentationText(SafeHtmlUtils.htmlEscape(alternatePresentationText));
}

From source file:mx.org.pescadormvp.examples.jsonp.client.query.QueryViewImpl.java

License:Open Source License

@Override
public void setTextboxContents(String textBoxContents) {
    suggestBox.setText(SafeHtmlUtils.htmlEscape(textBoxContents));
}

From source file:n3phele.client.widgets.StyledButtonCell.java

License:Open Source License

public void setText(String text) {
    this.text = SafeHtmlUtils.htmlEscape(text);
}

From source file:net.eve.finger.client.WinViewAlliance.java

License:Open Source License

/**
 * Creates a viewer for the given alliance.
 * @param allianceInfo The alliance to view.
 *//*from  www.j  a v  a 2s.  c  o  m*/
public WinViewAlliance(AllianceInfo allianceInfo) {
    // Build the UI and save fields
    this();
    this.allianceInfo = allianceInfo;
    this.allianceID = allianceInfo.getAllianceID();

    // Build the alliance logo URL
    StringBuilder pURL = new StringBuilder();
    pURL.append("<img src=\"");
    pURL.append("http://image.eveonline.com/Alliance/");
    pURL.append(allianceInfo.getAllianceID());
    pURL.append("_128.png\" />");
    imgLogo.setHtml(pURL.toString());

    // Set the header
    this.setHeading(allianceInfo.getAllianceName());

    // Load the notes
    String notes = allianceInfo.getNotes();

    // Are there notes?
    if (notes != null) {
        // Yes
        String noteLines[] = notes.split("\n");
        StringBuilder noteHTML = new StringBuilder();
        noteHTML.append("<span style='white-space:normal'>");
        for (String line : noteLines) {
            noteHTML.append(SafeHtmlUtils.htmlEscape(line));
            noteHTML.append("<br/>");
        }
        noteHTML.append("</span>");
        htmlNotes.setHtml(noteHTML.toString());
    } else {
        // No notes
        htmlNotes.hide();
    }

    // Create the grids
    createCharGridFromRPC(pnlFC, btnFC, CharType.FC);
    createCharGridFromRPC(pnlScout, btnScout, CharType.SCOUT);
    createCharGridFromRPC(pnlCyno, btnCyno, CharType.CYNO);
    createCharGridFromRPC(pnlSuper, btnSuper, CharType.SUPER);
    createCharGridFromRPC(pnlTitan, btnTitan, CharType.TITAN);
}