Java 类com.vaadin.ui.Upload.StartedEvent 实例源码

项目:osc-core    文件:ApplianceUploader.java   
public ApplianceUploader() {
    this.upload = new Upload();
    this.upload.setButtonCaption(null);
    this.upload.setReceiver(this);
    this.upload.addFailedListener(this);
    this.upload.setImmediate(false);

    final UploadInfoWindow uploadInfoWindow = new UploadInfoWindow(this.upload);

    this.upload.addStartedListener(new StartedListener() {
        @Override
        public void uploadStarted(final StartedEvent event) {
            if (uploadInfoWindow.getParent() == null) {
                ViewUtil.addWindow(uploadInfoWindow);
            }
        }
    });

    this.verLayout.setSpacing(true);
    this.verLayout.addStyleName(StyleConstants.COMPONENT_SPACING);
    this.verLayout.addComponent(this.upload);

    this.panel.setWidth("100%");
    this.panel.setContent(this.verLayout);
    setCompositionRoot(this.panel);
}
项目:hawkbit    文件:UploadHandler.java   
/**
 * Upload started for {@link Upload} variant.
 *
 * @see com.vaadin.ui.Upload.StartedListener#uploadStarted(com.vaadin.ui.Upload.StartedEvent)
 */
@Override
public void uploadStarted(final StartedEvent event) {
    uploadInterrupted = false;
    selectedSwForUpload = null;

    final Optional<Long> selectedBaseSwModuleId = artifactUploadState.getSelectedBaseSwModuleId();
    if (selectedBaseSwModuleId.isPresent()) {
        selectedSwForUpload = softwareModuleManagement.get(selectedBaseSwModuleId.get()).orElse(null);
    }

    if (selectedSwForUpload != null && view.checkIfSoftwareModuleIsSelected()
            && !view.checkIfFileIsDuplicate(event.getFilename(), selectedSwForUpload)) {
        LOG.debug("Upload started for file :{}", event.getFilename());
        eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_STARTED,
                new UploadFileStatus(event.getFilename(), 0, 0, selectedSwForUpload)));
    } else {
        failureReason = i18n.getMessage("message.upload.failed");
        upload.interruptUpload();
        // actual interrupt will happen a bit late so setting the below
        // flag
        uploadInterrupted = true;
    }
}
项目:osc-core    文件:PluginUploader.java   
public PluginUploader(ServerApi server) {
    this.server = server;

    this.upload = new Upload();
    this.upload.setButtonCaption("Upload");
    this.upload.setReceiver(this);
    this.upload.addFailedListener(this);
    this.upload.addSucceededListener(this);
    this.upload.setImmediate(false);

    final UploadInfoWindow uploadInfoWindow = new UploadInfoWindow(this.upload);

    this.upload.addStartedListener(new StartedListener() {
        @Override
        public void uploadStarted(final StartedEvent event) {
            if (uploadInfoWindow.getParent() == null) {
                ViewUtil.addWindow(uploadInfoWindow);
            }
        }
    });

    this.verLayout.setSpacing(true);
    this.verLayout.addStyleName(StyleConstants.COMPONENT_SPACING);
    this.verLayout.addComponent(this.upload);

    this.panel.setWidth("100%");
    this.panel.setContent(this.verLayout);
    setCompositionRoot(this.panel);
}
项目:osc-core    文件:DbRestorer.java   
public DbRestorer(RestoreServiceApi restoreService, ServerApi server, ValidationApi validator) {
    this.restoreService = restoreService;
    this.server = server;
    this.validator = validator;
    this.upload = new Upload();
    this.upload.setButtonCaption(VmidcMessages.getString(VmidcMessages_.UPLOAD_RESTORE));
    this.upload.setReceiver(this);
    this.upload.addFailedListener(this);
    this.upload.addSucceededListener(this);
    this.upload.setImmediate(false);

    final UploadInfoWindow uploadInfoWindow = new UploadInfoWindow(this.upload);

    this.upload.addStartedListener(new StartedListener() {
        @Override
        public void uploadStarted(final StartedEvent event) {
            if (uploadInfoWindow.getParent() == null) {
                ViewUtil.addWindow(uploadInfoWindow);
            }
        }
    });

    this.verLayout.setSpacing(true);
    this.panel.setWidth("100%");
    this.panel.setContent(this.verLayout);
    this.verLayout.addComponent(this.upload);
    this.verLayout.addStyleName(StyleConstants.COMPONENT_SPACING);
    setCompositionRoot(this.panel);
}
项目:osc-core    文件:UploadInfoWindow.java   
@Override
public void uploadStarted(final StartedEvent event) {
    this.progressBar.setValue(0f);
    this.progressBar.setVisible(true);
    this.bytesProcessed.setVisible(true);
    this.file.setValue(event.getFilename());
    this.cancelButton.setVisible(true);
}
项目:garantia    文件:UploadInfoWindow.java   
@Override
public void uploadStarted(final StartedEvent event) {
    // this method gets called immediately after upload is started
    progressBar.setValue(0f);
    progressBar.setVisible(true);
    UI.getCurrent().setPollInterval(500);
    textualProgress.setVisible(true);
    // updates to client
    state.setValue("Cargando");
    fileName.setValue(event.getFilename());

    cancelButton.setVisible(true);
}
项目:hawkbit    文件:BulkUploadHandler.java   
@Override
public void uploadStarted(final StartedEvent event) {
    if (!event.getFilename().endsWith(".csv")) {

        new HawkbitErrorNotificationMessage(SPUILabelDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE, null,
                i18n.getMessage("bulk.targets.upload"), true).show(Page.getCurrent());
        LOG.error("Wrong file format for file {}", event.getFilename());
        upload.interruptUpload();
    } else {
        eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_TARGET_UPLOAD_STARTED));
    }
}
项目:SecureBPMN    文件:UploadComponent.java   
public void uploadStarted(StartedEvent event) {
  removeAllComponents(); // Visible components are replaced by a progress bar

  this.progressIndicator = new ProgressIndicator();
  progressIndicator.setPollingInterval(500);
  addComponent(progressIndicator);
  setComponentAlignment(progressIndicator, Alignment.MIDDLE_CENTER);

  for (StartedListener startedListener : startedListeners) {
    startedListener.uploadStarted(event);
  }
}
项目:jain-I18n    文件:JImageUpload.java   
public void uploadStarted(StartedEvent event) {
    super.uploadStarted(event);
    long l = event.getContentLength();
    if(l < getMaxContentLength()) {
        stream.reset();
        jImage.createImage();
    }
}
项目:jain-I18n    文件:JUploader.java   
public void uploadStarted(StartedEvent event) {
    pi.setVisible(true);
    upload.setVisible(false);

    long l = event.getContentLength();
    if(l > maxContentLength) {
        interruptUpload();
    }
}
项目:FiWare-Template-Handler    文件:UploadComponent.java   
public void uploadStarted(StartedEvent event) {
  removeAllComponents(); // Visible components are replaced by a progress bar

  this.progressIndicator = new ProgressIndicator();
  progressIndicator.setPollingInterval(500);
  addComponent(progressIndicator);
  setComponentAlignment(progressIndicator, Alignment.MIDDLE_CENTER);

  for (StartedListener startedListener : startedListeners) {
    startedListener.uploadStarted(event);
  }
}
项目:scoutmaster    文件:ImportSelectFile.java   
private void startListener()
{
    this.upload.addStartedListener(new StartedListener()
    {
        private static final long serialVersionUID = 1L;

        @Override
        public void uploadStarted(final StartedEvent event)
        {
            ImportSelectFile.this.uploadStarted = true;
            ImportSelectFile.this.uploadComplete = false;
        }
    });
}
项目:SecureBPMN    文件:InMemoryUploadReceiver.java   
public void uploadStarted(StartedEvent event) {
  checkFileSize(event.getContentLength());
  if (!interrupted) { // upload can be interrupted by invalid file size
    checkMimeType(event.getMIMEType());
  }
}
项目:FiWare-Template-Handler    文件:InMemoryUploadReceiver.java   
public void uploadStarted(StartedEvent event) {
  checkFileSize(event.getContentLength());
  if (!interrupted) { // upload can be interrupted by invalid file size
    checkMimeType(event.getMIMEType());
  }
}
项目:own-music-cloud    文件:MusicUploader.java   
@Override
public void uploadStarted(StartedEvent event) {
    progressBar.setValue(0.0f);
    setComponentsToVisible(true);
    //progressBar.setPollingInterval(100);
}