示例#1
0
  /** Cancel the current upload process. */
  public void cancel() {
    if (getStatus() == Status.UNINITIALIZED) {
      return;
    }

    if (finished && !uploading) {
      if (successful) {
        try {
          sendAjaxRequestToDeleteUploadedFile();
        } catch (Exception e) {
        }
      } else {
        statusWidget.setStatus(Status.DELETED);
      }
      return;
    }

    if (canceled || getStatus() == Status.CANCELING) {
      return;
    }

    canceled = true;
    automaticUploadTimer.cancel();
    if (uploading) {
      updateStatusTimer.cancel();
      try {
        sendAjaxRequestToCancelCurrentUpload();
      } catch (Exception e) {
        log("Exception cancelling request " + e.getMessage(), e);
      }
      statusWidget.setStatus(IUploadStatus.Status.CANCELING);
    } else {
      uploadFinished();
      reuse();
    }
  }
示例#2
0
 /* (non-Javadoc)
  * @see gwtupload.client.IUploader#reset()
  */
 public void reset() {
   reuse();
   fileDone = new HashSet<String>();
   fileUploading = new HashSet<String>();
 }