Ejemplo n.º 1
0
  @EventBusListenerMethod(scope = EventScope.UI)
  void onEvent(final UploadStatusEvent event) {

    final UploadFileStatus uploadStatus = event.getUploadStatus();
    switch (event.getUploadProgressEventType()) {
      case UPLOAD_IN_PROGRESS:
        ui.access(
            () ->
                updateProgress(
                    uploadStatus.getFileName(),
                    uploadStatus.getBytesRead(),
                    uploadStatus.getContentLength(),
                    uploadStatus.getSoftwareModule()));
        break;
      case UPLOAD_STARTED:
        ui.access(() -> onStartOfUpload(event));
        break;
      case UPLOAD_STREAMING_FAILED:
        ui.access(
            () ->
                uploadFailed(
                    uploadStatus.getFileName(),
                    uploadStatus.getFailureReason(),
                    uploadStatus.getSoftwareModule()));
        break;
      case UPLOAD_SUCCESSFUL:
        // fall through here
      case UPLOAD_STREAMING_FINISHED:
        ui.access(
            () -> uploadSucceeded(uploadStatus.getFileName(), uploadStatus.getSoftwareModule()));
        break;
      case RECEIVE_UPLOAD:
        uploadRecevied(uploadStatus.getFileName(), uploadStatus.getSoftwareModule());
        break;
      case UPLOAD_FINISHED:
      case ABORT_UPLOAD:
      case UPLOAD_FAILED:
      default:
    }
  }
Ejemplo n.º 2
0
 private void onStartOfUpload(final UploadStatusEvent event) {
   uploadSessionStarted();
   uploadStarted(
       event.getUploadStatus().getFileName(), event.getUploadStatus().getSoftwareModule());
 }