@Override public void onEditMetadataSelected(EditMetadataSelectedEvent event) { MetadataTemplateInfo template = event.getTemplateInfo(); drSvcFac.getMetadataTemplate( template.getId(), new AsyncCallback<MetadataTemplate>() { @Override public void onSuccess(MetadataTemplate result) { final IPlantDialog id = createEditDialog(); editView.edit(result); id.addOkButtonSelectHandler( new SelectHandler() { @Override public void onSelect(SelectEvent event) { if (editView.validate()) { MetadataTemplate template = editView.getTemplate(); Splittable sp = AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(template)); LOG.log(Level.INFO, sp.getPayload()); doAddOrUpdate(id, template.getId(), sp.getPayload()); } else { IplantAnnouncer.getInstance() .schedule(new ErrorAnnouncementConfig(appearance.enumError())); } } }); id.addCancelButtonSelectHandler( new SelectHandler() { @Override public void onSelect(SelectEvent event) { id.hide(); } }); id.show(); setDialogDebugIds(id); } @Override public void onFailure(Throwable caught) { ErrorHandler.post(appearance.templateRetrieveError(), caught); } }); }
private void doUpload() { FastMap<IPCFileUploadField> destResourceMap = new FastMap<IPCFileUploadField>(); for (IPCFileUploadField field : fufList) { String fileName = field.getValue().replaceAll(".*[\\\\/]", ""); field.setEnabled(!Strings.isNullOrEmpty(fileName) && !fileName.equalsIgnoreCase("null")); if (field.isEnabled()) { destResourceMap.put(uploadDest.getPath() + "/" + fileName, field); } else { field.setEnabled(false); } } if (!destResourceMap.isEmpty()) { final ArrayList<String> ids = Lists.newArrayList(destResourceMap.keySet()); final HasPaths dto = FS_FACTORY.pathsList().as(); dto.setPaths(ids); final CheckDuplicatesCallback cb = new CheckDuplicatesCallback( ids, destResourceMap, statList, fufList, submittedForms, formList); drService.diskResourcesExist(dto, cb); } }