@Override public void onFailure(Throwable caught) { final SafeHtml message = SafeHtmlUtils.fromTrustedString( appearance.diskResourceDoesNotExist(value.getDisplayValue())); announcer.schedule(new ErrorAnnouncementConfig(message, true, 3000)); }
@Override public void onSuccess(final File file) { eventBus.fireEvent(new FileSavedEvent(file)); final Splittable annotatedFile = AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(file)); StringQuoter.create(diskResourceUtil.parseParent(file.getPath())) .assign(annotatedFile, "parentFolderId"); StringQuoter.create(event.getPath()).assign(annotatedFile, "sourceUrl"); // Create notification message final Splittable message = StringQuoter.createSplittable(); StringQuoter.create("data").assign(message, "type"); String subject = file.getName().isEmpty() ? appearance.importFailed(event.getPath()) : appearance.fileUploadSuccess(file.getName()); StringQuoter.create(subject).assign(message, "subject"); StringQuoter.create(userInfo.getUsername()).assign(message, "user"); // Create Notification payload and attach message final Splittable payload = StringQuoter.createSplittable(); StringQuoter.create("file_uploaded").assign(payload, "action"); // Attach annotated file and notification message to payload annotatedFile.assign(payload, "data"); payload.assign(message, "payload"); final String notificationMsgPayload = message.getPayload(); userSessionService.postClientNotification( jsonUtil.getObject(notificationMsgPayload), new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { event.getHideable().hide(); announcer.schedule(new ErrorAnnouncementConfig(caught.getMessage())); } @Override public void onSuccess(String result) { event.getHideable().hide(); announcer.schedule( new SuccessAnnouncementConfig(appearance.importRequestSubmit(file.getName()))); } }); }
@Override public void fetchAnalysisParameters(Analysis analysis) { view.mask(appearance.retrieveParametersLoadingMask()); analysisService.getAnalysisParams( analysis, new AsyncCallback<List<AnalysisParameter>>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); } @Override public void onSuccess(List<AnalysisParameter> result) { listStore.addAll(result); view.unmask(); } }); }