/**
* 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);
}
}
java类com.google.gwt.event.dom.client.ErrorHandler的实例源码
GalleryPage.java 文件源码
项目:appinventor-extensions
阅读 29
收藏 0
点赞 0
评论 0
ProfilePage.java 文件源码
项目:appinventor-extensions
阅读 29
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
GalleryGuiFactory.java 文件源码
项目:appinventor-extensions
阅读 25
收藏 0
点赞 0
评论 0
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);
}
}
ParagraphEditor.java 文件源码
项目:iambookmaster
阅读 21
收藏 0
点赞 0
评论 0
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());
}
BasicPagingImageGrid.java 文件源码
项目:firefly
阅读 19
收藏 0
点赞 0
评论 0
public void addErrorHandler(ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
IPhoneScrollPanel.java 文件源码
项目:iambookmaster
阅读 22
收藏 0
点赞 0
评论 0
public PublicImage(String url, LoadHandler loadHandler, ErrorHandler errorHandler) {
addLoadHandler(loadHandler);
addErrorHandler(errorHandler);
setUrl(url);
}