Example usage for com.google.gwt.search.client LocalResult getTitleNoFormatting

List of usage examples for com.google.gwt.search.client LocalResult getTitleNoFormatting

Introduction

In this page you can find the example usage for com.google.gwt.search.client LocalResult getTitleNoFormatting.

Prototype

public native String getTitleNoFormatting() ;

Source Link

Document

Returns the title, but unlike .title, this property is stripped of html markup (e.g., <b>, <i>, etc.).

Usage

From source file:com.google.mobile.trippy.web.client.db.DefaultSearchService.java

License:Apache License

/**
 * Add a results of one page to total results
 *///from  w w  w. j  a  v  a2  s. co m
private void addGoogleResultsToList(final String queryString, final HasLatLngBounds bounds,
        List<SearchItem> searchItemList, final JsArray<LocalResult> results) {

    final long sizeOffset = searchItemList.size();
    if (results != null && results.length() > 0) {
        int maxResultToDisplay = Math.min(results.length(), MAX_GOOGLE_SEARCH_RESULTS);
        for (int i = 0; i < maxResultToDisplay; ++i) {
            final LocalResult result = results.get(i);
            final SearchItem item = new SearchItem();
            item.setId(getItemCacheKey(SearchType.GOOGLE.toString(), queryString, bounds, sizeOffset + i));
            item.setName(result.getTitleNoFormatting());
            item.setAddress(result.getStreetAddress() + " " + result.getCity());

            final JsArray<LocalResult.PhoneNumber> phn = result.getPhoneNumbers();
            final ArrayList<String> phoneNumbers = new ArrayList<String>();
            if (phn != null) {
                for (int j = 0; j < phn.length(); j++) {
                    phoneNumbers.add(phn.get(j).getNumber().toString());
                }
                item.setPhoneNumbers(phoneNumbers);
            }

            item.setLatitude(result.getLat());
            item.setLongitude(result.getLng());
            item.setUrl(getMobileUrl(result.getUrl()));
            item.setType(SearchType.GOOGLE);

            searchItemList.add(item);
        }
    }
}