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);
    }
  }
    @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);
        }
      }
    }
Пример #3
0
 @Override
 public void setItem(String key, String data) {
   map.put(getStorageKey(key), data);
 }
Пример #4
0
 @Override
 public void removeItem(String key) {
   map.remove(getStorageKey(key));
 }
Пример #5
0
 @Override
 public String getItem(String key) {
   return map.get(getStorageKey(key));
 }
Пример #6
0
 @Override
 public void clear() {
   map.clear();
 }
 @Override
 public void onSuccess(FastMap<DiskResource> result) {
   eventBus.fireEvent(
       new ShowFilePreviewEvent((File) result.get(value.getDisplayValue()), null));
 }