当前位置: 首页>>代码示例>>Java>>正文


Java ErrorHandler类代码示例

本文整理汇总了Java中com.google.gwt.event.dom.client.ErrorHandler的典型用法代码示例。如果您正苦于以下问题:Java ErrorHandler类的具体用法?Java ErrorHandler怎么用?Java ErrorHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ErrorHandler类属于com.google.gwt.event.dom.client包,在下文中一共展示了ErrorHandler类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateAppImage

import com.google.gwt.event.dom.client.ErrorHandler; //导入依赖的package包/类
/**
 * Helper method to update the app image
 * @param url  The URL of the image to show
 * @param container  The container that image widget resides
 */
private void updateAppImage(String url, final Panel container) {
    image = new Image();
    image.addStyleName("app-image");
    image.setUrl(url);
    // if the user has provided a gallery app image, we'll load it. But if not
    // the error will occur and we'll load default image
    image.addErrorHandler(new ErrorHandler() {
      public void onError(ErrorEvent event) {
        image.setUrl(GalleryApp.DEFAULTGALLERYIMAGE);
      }
    });
    container.add(image);

    if(gallery.getSystemEnvironment() != null &&
        gallery.getSystemEnvironment().toString().equals("Development")){
      final OdeAsyncCallback<String> callback = new OdeAsyncCallback<String>(
        // failure message
        MESSAGES.galleryError()) {
          @Override
          public void onSuccess(String newUrl) {
            image.setUrl(newUrl + "?" + System.currentTimeMillis());
          }
        };
      Ode.getInstance().getGalleryService().getBlobServingUrl(url, callback);
    }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:32,代码来源:GalleryPage.java

示例2: updateUserImage

import com.google.gwt.event.dom.client.ErrorHandler; //导入依赖的package包/类
/**
 * Helper method to update the user's image
 * @param url  The URL of the image to show
 * @param container  The container that image widget resides
 */
private void updateUserImage(final String url, Panel container) {
  userAvatar = new Image();
  //setUrl if the new URL is the same one as it was before; an easy workaround is
  //to make the URL unique so it forces the browser to reload
  userAvatar.setUrl(url + "?" + System.currentTimeMillis());
  userAvatar.addStyleName("app-image");
  if (profileStatus == PRIVATE) {
    //userAvatar.addStyleName("status-updating");
  }
  // if the user has provided a gallery app image, we'll load it. But if not
  // the error will occur and we'll load default image
  userAvatar.addErrorHandler(new ErrorHandler() {
    public void onError(ErrorEvent event) {
      userAvatar.setUrl(GalleryApp.DEFAULTUSERIMAGE);
    }
  });
  container.add(userAvatar);

  if(gallery.getSystemEnvironment() != null &&
      gallery.getSystemEnvironment().toString().equals("Development")){
    final OdeAsyncCallback<String> callback = new OdeAsyncCallback<String>(
      // failure message
      MESSAGES.galleryError()) {
        @Override
        public void onSuccess(String newUrl) {
          userAvatar.setUrl(newUrl + "?" + System.currentTimeMillis());
        }
      };
    Ode.getInstance().getGalleryService().getBlobServingUrl(url, callback);
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:37,代码来源:ProfilePage.java

示例3: GalleryAppWidget

import com.google.gwt.event.dom.client.ErrorHandler; //导入依赖的package包/类
private GalleryAppWidget(final GalleryApp app) {
  nameLabel = new Label(app.getTitle());
  authorLabel = new Label(app.getDeveloperName());
  numDownloadsLabel = new Label(Integer.toString(app.getDownloads()));
  numLikesLabel = new Label(Integer.toString(app.getLikes()));
  numViewsLabel = new Label(Integer.toString(app.getViews()));
  numCommentsLabel = new Label(Integer.toString(app.getComments()));
  image = new Image();
  image.addErrorHandler(new ErrorHandler() {
    public void onError(ErrorEvent event) {
      image.setUrl(GalleryApp.DEFAULTGALLERYIMAGE);
    }
  });
  String url = gallery.getCloudImageURL(app.getGalleryAppId());
  image.setUrl(url);

  if(gallery.getSystemEnvironment() != null &&
      gallery.getSystemEnvironment().toString().equals("Development")){
    final OdeAsyncCallback<String> callback = new OdeAsyncCallback<String>(
      // failure message
      MESSAGES.galleryError()) {
        @Override
        public void onSuccess(String newUrl) {
          image.setUrl(newUrl + "?" + System.currentTimeMillis());
        }
      };
    Ode.getInstance().getGalleryService().getBlobServingUrl(url, callback);
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:30,代码来源:GalleryGuiFactory.java

示例4: ImageSprite

import com.google.gwt.event.dom.client.ErrorHandler; //导入依赖的package包/类
public ImageSprite(Sprite sprite) {
	this.sprite = sprite;
	addErrorHandler(new ErrorHandler(){
		public void onError(ErrorEvent event) {
			Window.alert(appMessages.paragraphCannotLoadImage(backImage.getUrl()));
		}
	});
	setUrl(sprite.getPicture().getUrl());
}
 
开发者ID:Antokolos,项目名称:iambookmaster,代码行数:10,代码来源:ParagraphEditor.java

示例5: addErrorHandler

import com.google.gwt.event.dom.client.ErrorHandler; //导入依赖的package包/类
public void addErrorHandler(ErrorHandler errorHandler) {
    this.errorHandler = errorHandler;
}
 
开发者ID:lsst,项目名称:firefly,代码行数:4,代码来源:BasicPagingImageGrid.java

示例6: PublicImage

import com.google.gwt.event.dom.client.ErrorHandler; //导入依赖的package包/类
public PublicImage(String url, LoadHandler loadHandler, ErrorHandler errorHandler) {
	addLoadHandler(loadHandler);
	addErrorHandler(errorHandler);
	setUrl(url);
}
 
开发者ID:Antokolos,项目名称:iambookmaster,代码行数:6,代码来源:IPhoneScrollPanel.java


注:本文中的com.google.gwt.event.dom.client.ErrorHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。