@Override public void undo() { ImageElementLoader loader=new ImageElementLoader(); loader.load(beforeUri, new ImageElementListener() { @Override public void onLoad(ImageElement element) { canvas.getContext2d().save(); canvas.getContext2d().setGlobalCompositeOperation(Composite.COPY); canvas.getContext2d().drawImage(element,0,0); canvas.getContext2d().restore(); updateCurrentSelectionDataUrl(beforeUri); } @Override public void onError(String url, ErrorEvent event) { Window.alert(event.toDebugString()); } }); }
@Override public void redo() { ImageElementLoader loader=new ImageElementLoader(); loader.load(afterUri, new ImageElementListener() { @Override public void onLoad(ImageElement element) { canvas.getContext2d().save(); canvas.getContext2d().setGlobalCompositeOperation(Composite.COPY); canvas.getContext2d().drawImage(element,0,0); canvas.getContext2d().restore(); updateCurrentSelectionDataUrl(afterUri); } @Override public void onError(String url, ErrorEvent event) { Window.alert(event.toDebugString()); } }); }
@Override public void execAsync(final String data) { new ImageElementLoader().load(data, new ImageElementListener() { @Override public void onLoad(ImageElement element) { done(data,true); imageElements.add(element); } @Override public void onError(String url, ErrorEvent event) { done(data,false); } }); }
protected void doCropSrcs() { resetCanvas(); ImageElementUtils.createWithLoader(backgroundDataUrl,new ImageElementListener() { @Override public void onLoad(ImageElement element) { //Window.open(overlayCanvas.toDataUrl(), "hello", null); canvas.getContext2d().save(); canvas.getContext2d().setGlobalCompositeOperation(Composite.DESTINATION_OUT); canvas.getContext2d().drawImage(element, 0, 0);//TODO support scale canvas.getContext2d().restore(); updateCanvas(); } @Override public void onError(String url, ErrorEvent event) { // TODO Auto-generated method stub } }); }
/** * 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); } }
/** * 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); } }
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); } }
/** {@inheritDoc}) */ @Override public void onError(ErrorEvent e) { if (completed) { return; } cleanUp(); spinner.setVisible(false); error.setVisible(true); }
@Override public void onError(ErrorEvent event) { loadFailed = true; ClientUtils.warning(LOG, "image onError: %s", image.getUrl()); Img img = new Img("[SKIN]/Dialog/warn.png", 2 * 16, 2 * 16); img.setLayoutAlign(Alignment.CENTER); img.setAltText(i18n.DigitalObjectPreview_NoContent_Msg()); img.setPrompt(i18n.DigitalObjectPreview_NoContent_Msg()); imgContainer.setMembers(img); }
public void onError(ErrorEvent ev) { Object src = ev.getSource(); if (src instanceof Image) { Image image = (Image) src; image.setUrl("images/blank_image_icon.png"); } }
public void onError(ErrorEvent ev) { Object src = ev.getSource(); if (src instanceof Image) { Image image = (Image)src; image.setUrl("images/blank_image_icon.png"); } }
protected void loadFile(final File file, String asStringText) { ImageElementUtils.createWithLoader(asStringText, new ImageElementListener() { @Override public void onLoad(ImageElement element) { loadFile(file,element); } @Override public void onError(String url, ErrorEvent event) { LogUtils.log(event.getNativeEvent()); } }); }
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()); }
public void onError(ErrorEvent event) { nrAttempts--; if (nrAttempts > 0) { asImage().addLoadHandler(this); asImage().addErrorHandler(this); asImage().setUrl(src); } else if (onDoneLoading != null) { onDoneLoading.onFailure(src); } }
/** {@inheritDoc}) */ public void onError(ErrorEvent e) { if (completed) { return; } cleanUp(); spinner.setVisible(false); error.setVisible(true); }
public void onError(ErrorEvent event) { loadHandler.removeHandler(); errHandler.removeHandler(); Image img = (Image) event.getSource(); if (img != null) { img.removeFromParent(); } if (onError != null) { onError.onError(thisInstance); } }
@Override public void onError(ErrorEvent event) { loadAttempted = true; }
@Override public void onError(ErrorEvent event) { eventBus.fireEventFromSource(new StringValueChangeEvent(null), this); }
protected void loadFile(final File file,final String asStringText) { try{ //TODO create method //ImageElement element=ImageElementUtils.create(asStringText); new ImageElementLoader().load(asStringText, new ImageElementListener() { @Override public void onLoad(ImageElement element) { LogUtils.log(file.getFileName()+","+element.getWidth()+"x"+element.getHeight()); final ImageUrlData data=new ImageUrlData(file.getFileName(),asStringText); easyCellTableObjects.addItem(data); //updateList(); //stack on mobile,maybe because of called async method Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { easyCellTableObjects.setSelected(data, true); makeBt.setEnabled(true); } }); } @Override public void onError(String url, ErrorEvent event) { Window.alert(event.toDebugString()); } }); //doSelecct(data);//only way to update on Android Chrome }catch (Exception e) { e.printStackTrace(); LogUtils.log(e.getMessage()); } }
protected void loadFile(final File file,final String asStringText) { try{ //TODO create method new ImageElementLoader().load(asStringText, new ImageElementListener() { @Override public void onLoad(ImageElement element) { LogUtils.log(file.getFileName()+","+element.getWidth()+"x"+element.getHeight()); final ImageElementData data=new ImageElementData(file.getFileName(),element,asStringText); EasyCellTableObjects.addItem(data); //stack on mobile,maybe because of called async method Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { EasyCellTableObjects.setSelected(data, true); } }); } @Override public void onError(String url, ErrorEvent event) { Window.alert(event.toDebugString()); } }); //doSelecct(data);//only way to update on Android Chrome }catch (Exception e) { e.printStackTrace(); LogUtils.log(e.getMessage()); } }
private DropDockDataUrlRootPanel createRootAndTop(){ DropDockDataUrlRootPanel root=new DropDockDataUrlRootPanel(Unit.PX,false) { @Override public void loadFile(String pareht, Optional<File> optional, String dataUrl) { for(File file:optional.asSet()){ ImageElementUtils.createWithLoader(dataUrl, new ImageElementListener() { @Override public void onLoad(ImageElement element) { if(element.getWidth()+element.getHeight()>150){ Window.alert("hey this is dev mode,made your pc freeze.use on production mode"); } uploadImage(element); } @Override public void onError(String url, ErrorEvent event) { LogUtils.log(event.getNativeEvent()); } }); } } }; root.setFilePredicate(FilePredicates.getImageExtensionOnly()); dock = new DockLayoutPanel(Unit.PX); //dock.setSize("100%", "100%"); root.add(dock); topPanel = new HorizontalPanel(); topPanel.setWidth("100%"); topPanel.setStylePrimaryName("bg1"); topPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); topPanel.setSpacing(1); dock.addNorth(topPanel,30); topPanel.add(createTitleWidget()); topPanel.add(new Anchor("Help", "inpaint_help.html")); return root; }
protected void loadFile(final File file,final String asStringText) { try{ //TODO create method //ImageElement element=ImageElementUtils.create(asStringText); new ImageElementLoader().load(asStringText, new ImageElementListener() { @Override public void onLoad(ImageElement element) { //LogUtils.log(file.getFileName()+","+element.getWidth()+"x"+element.getHeight()); int baseSplit=baseSizeListBox.getValue(); int[] result=calcurateGrid(element.getWidth(),element.getHeight(),baseSplit); final GridImageData data=new GridImageData(file.getFileName(), asStringText,result[0],result[1],result[2],element.getWidth(),element.getHeight()); easyCellTableObjects.addItem(data); //updateList(); //stack on mobile,maybe because of called async method Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { easyCellTableObjects.setSelected(data, true); } }); } @Override public void onError(String url, ErrorEvent event) { Window.alert(event.toDebugString()); } }); //doSelecct(data);//only way to update on Android Chrome }catch (Exception e) { e.printStackTrace(); LogUtils.log(e.getMessage()); } }
protected void loadFile(final File file,final String asStringText) { try{ //TODO create method //ImageElement element=ImageElementUtils.create(asStringText); new ImageElementLoader().load(asStringText, new ImageElementListener() { @Override public void onLoad(ImageElement element) { LogUtils.log(file.getFileName()+","+element.getWidth()+"x"+element.getHeight()); final ImageElementData data=new ImageElementData(file.getFileName(),element,asStringText); easyCellTableObjects.addItem(data); //updateList(); //stack on mobile,maybe because of called async method Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { easyCellTableObjects.setSelected(data, true); } }); } @Override public void onError(String url, ErrorEvent event) { Window.alert(event.toDebugString()); } }); //doSelecct(data);//only way to update on Android Chrome }catch (Exception e) { e.printStackTrace(); LogUtils.log(e.getMessage()); } }
public void onError(ErrorEvent event) { process(event.getSource()); }
public void onError(ErrorEvent event) { scheduleRepeating(100); }
protected void loadFile(final File file,final String asStringText) { try{ //TODO create method //ImageElement element=ImageElementUtils.create(asStringText); new ImageElementLoader().load(asStringText, new ImageElementListener() { @Override public void onLoad(ImageElement element) { final ImageElementCaptionData data=new ImageElementCaptionData(file.getFileName(),element,asStringText); easyCellTableObjects.addItem(data); //updateList(); //stack on mobile,maybe because of called async method Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { easyCellTableObjects.setSelected(data, true); updateMarkedText(); } }); } @Override public void onError(String url, ErrorEvent event) { Window.alert(event.toDebugString()); } }); //doSelecct(data);//only way to update on Android Chrome }catch (Exception e) { e.printStackTrace(); LogUtils.log(e.getMessage()); } }
/** * watch out IE maybe problem * @author aki * */ /* public class DataToImageElement implements Function<ImageUrlData,ImageElement>{ @Override public ImageElement apply(ImageUrlData input) { return ImageElementUtils.create(input.getDataUrl()); } }*/ protected void loadFile(final File file,final String asStringText) { try{ //TODO create method //ImageElement element=ImageElementUtils.create(asStringText); new ImageElementLoader().load(asStringText, new ImageElementListener() { @Override public void onLoad(final ImageElement element) { //LogUtils.log(file.getFileName()+","+element.getWidth()+"x"+element.getHeight()); final LayerData data=new LayerData(file.getFileName(),element,asStringText); EasyCellTableObjects.addItem(data); //updateList(); //stack on mobile,maybe because of called async method Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { EasyCellTableObjects.setSelected(data, true); makeBt.setEnabled(true); } }); } @Override public void onError(String url, ErrorEvent event) { Window.alert(event.toDebugString()); } }); //doSelecct(data);//only way to update on Android Chrome }catch (Exception e) { e.printStackTrace(); LogUtils.log(e.getMessage()); } }