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

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

Introduction

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

Prototype

public native String getUrl() ;

Source Link

Document

Returns a url to a Google Maps Details page associated with the search result.

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
 *//*  www . ja  va 2s .c  o 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);
        }
    }
}