本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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());
}
示例5: addErrorHandler
import com.google.gwt.event.dom.client.ErrorHandler; //导入依赖的package包/类
public void addErrorHandler(ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
示例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);
}