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

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

Introduction

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

Prototype

public native int getThumbnailWidth() ;

Source Link

Document

Returns the width in pixels of the image thumbnail.

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);
    //         }//w ww  . j  a v  a2 s  .c om
    //         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);
    // }//w w w  . j  a v  a 2s . com
    // 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));
        }
    });
    // }
}