public void onUpdatePhoto() { if (!initialised) return; photoDetails.setTitle(photoDetailsView.getPhotoTitle().getValue()); photoDetails.setTags(photoDetailsView.getPhotoTags().getValue()); appEventBus.fireEvent(new AppBusyEvent()); rpcService.updatePhotoDetails( photoDetails, new AsyncCallback<PhotoDetails>() { public void onSuccess(PhotoDetails result) { madeEdits = true; Scheduler.get() .scheduleFixedDelay( new RepeatingCommand() { public boolean execute() { appEventBus.fireEvent(new AppFreeEvent()); return false; } }, 1500); } public void onFailure(Throwable caught) { Scheduler.get() .scheduleFixedDelay( new RepeatingCommand() { public boolean execute() { appEventBus.fireEvent(new AppFreeEvent()); return false; } }, 500); } }); }
public void start( final AcceptsOneWidget panel, final com.google.gwt.event.shared.EventBus eventBus) { this.photoDetailsView = clientFactory.getPhotoView(); bind(); appEventBus.fireEvent(new AppBusyEvent()); currHttpRequest = rpcService.getPhotoDetails( id, new AsyncCallback<PhotoDetails>() { public void onSuccess(PhotoDetails result) { photoDetails = result; photoDetailsView.getPhotoTitle().setValue(photoDetails.getTitle()); photoDetailsView.getPhotoTags().setValue(photoDetails.getTags()); photoDetailsView.setPhoto(photoDetails.getLargeUrl()); appEventBus.fireEvent(new AppFreeEvent()); panel.setWidget(photoDetailsView.asWidget()); madeEdits = false; initialised = true; } public void onFailure(Throwable caught) { appEventBus.fireEvent(new AppFreeEvent()); } }); }