Example usage for com.google.gwt.search.client ImageResult getOriginalContextUrl

List of usage examples for com.google.gwt.search.client ImageResult getOriginalContextUrl

Introduction

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

Prototype

public native String getOriginalContextUrl() ;

Source Link

Document

Returns the URL of the page containing the image.

Usage

From source file:next.celebs.dao.PhotoDao.java

License:Apache License

public void getPhotos(final Key searchKey, int numberPages, final Response<PhotoMap> response) {

    //      if (storage.hasKey(searchKey)) {
    //         String json = storage.getItem(searchKey);
    //         Log.info("PhotoDao::getPhotos from Storage '"+ json + "'");
    //         JsArray<Photo.JSO_> jsoArr = JsonUtils.safeEval(json);
    //         int len = jsoArr.length();
    //         PhotoMap pm = getPhotoMap(searchKey);
    //         for (int i = 0; i < len; i++) {
    //            Photo p = jsoArr.get(i);
    //            pm.put(p.getUrl(), p);
    //         }/*from  www .jav  a  2 s. com*/
    //         response.read(pm);
    //
    //      } else {
    Log.info("PhotoDao::getPhotos from API");
    api.getPhotos(searchKey, numberPages, new Response<JsArray<ImageResult>>() {
        @Override
        public void read(JsArray<ImageResult> data) {
            int len = data.length();

            PhotoMap pm = getPhotoMap(searchKey);
            PhotoMap currentMap = new PhotoMap(searchKey, storage);
            for (int i = 0; i < len; i++) {
                ImageResult ir = data.get(i);
                Photo p = new Photo.Bean(ir.getUrl(), ir.getThumbnailUrl(), ir.getWidth(), ir.getHeight(),
                        ir.getThumbnailWidth(), ir.getThumbnailHeight(), ir.getOriginalContextUrl());
                pm.put(p.getUrl(), p);
                currentMap.put(p.getUrl(), p);
            }
            pm.save();
            response.read(currentMap);
        }

        @Override
        public void afterRead(String jsonData) {
            // storage.setItem(Key.Countries, jsonData);
            // Log.error("AFTER storing countries " + storage.getItem(Key.Country));
        }
    });
    //      }
}

From source file:next.celebs.model.PhotoDao.java

License:Apache License

public void getPhotos(final Key searchKey, int numberPages, final API.Response<PhotoMap> response) {

    // if (storage.hasKey(searchKey)) {
    // String json = storage.getItem(searchKey);
    // Log.info("PhotoDao::getPhotos from Storage '"+ json + "'");
    // JsArray<Photo.JSO_> jsoArr = JsonUtils.safeEval(json);
    // int len = jsoArr.length();
    // PhotoMap pm = getPhotoMap(searchKey);
    // for (int i = 0; i < len; i++) {
    // Photo p = jsoArr.get(i);
    // pm.put(p.getUrl(), p);
    // }//from  www . j av  a2  s. c om
    // response.read(pm);
    //
    // } else {
    //      XLog.info("PhotoDao::getPhotos from API" + searchKey);
    api.getPhotos(searchKey, numberPages, new API.Response<JsArray<ImageResult>>() {
        @Override
        public void read(JsArray<ImageResult> data) {
            int len = data.length();

            PhotoMap pm = getPhotoMap(searchKey);
            PhotoMap currentMap = new PhotoMap(searchKey);
            for (int i = 0; i < len; i++) {
                ImageResult ir = data.get(i);

                //               XLog.info(ir.getWidth() + "-" + ir.getThumbnailWidth() + "-" + ir.getTitleNoFormatting());

                Photo p = new Photo.Bean(ir.getUrl(), ir.getThumbnailUrl(), ir.getWidth(), ir.getHeight(),
                        ir.getThumbnailWidth(), ir.getThumbnailHeight(), ir.getOriginalContextUrl());
                pm.put(p.getUrl(), p);
                currentMap.put(p.getUrl(), p);
            }
            // pm.save();
            response.read(currentMap);
        }

        @Override
        public void afterRead(String jsonData) {
            // storage.setItem(Key.Countries, jsonData);
            // Log.error("AFTER storing countries " + storage.getItem(Key.Country));
        }
    });
    // }
}