@UiHandler({"form0", "form1", "form2", "form3", "form4"}) void onSubmitComplete(SubmitCompleteEvent event) { if (submittedForms.contains(event.getSource())) { submittedForms.remove(event.getSource()); statList.get(formList.indexOf(event.getSource())).clearStatus(""); } String results2 = event.getResults(); String results = Format.stripTags(results2); Splittable split = StringQuoter.split(results); IPCFileUploadField field = fufList.get(formList.indexOf(event.getSource())); if (split.isUndefined("file") || (split.get("file") == null)) { field.markInvalid(I18N.ERROR.fileUploadFailed(field.getValue())); IplantAnnouncer.getInstance() .schedule(new ErrorAnnouncementConfig(I18N.ERROR.fileUploadFailed(field.getValue()))); } else { eventBus.fireEvent(new FileUploadedEvent(uploadDest, field.getValue(), results)); } if (submittedForms.size() == 0) { hide(); } }
@Override public void markDuplicates(Collection<String> duplicates) { if ((duplicates != null) && !duplicates.isEmpty()) { for (String id : duplicates) { destResourceMap.get(id).markInvalid(I18N.ERROR.fileExist()); } } else { for (IPCFileUploadField field : destResourceMap.values()) { int index = fufList.indexOf(field); statList.get(index).setBusy(""); FormPanel form = formList.get(index); form.addSubmitHandler( new SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { getOkButton().disable(); } }); form.submit(); submittedForms.add(form); } } }