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

项目:scoutmaster    文件:ImportSelectFile.java   
private void progressListener()
{
    this.upload.addProgressListener(new ProgressListener()
    {
        private static final long serialVersionUID = 1L;

        @Override
        public void updateProgress(final long readBytes, final long contentLength)
        {
            UI ui = UI.getCurrent();
            ui.access(() -> {
                ImportSelectFile.this.progressBar
                        .setCaption("Uploaded: " + (float) readBytes / (float) contentLength * 100 + "%");
                ImportSelectFile.this.progressBar.setValue((float) readBytes / (float) contentLength);
                ImportSelectFile.this.progressBar.setVisible(true);
            });
        }
    });
}
项目:SecureBPMN    文件:UploadComponent.java   
protected void addUpload() {
  this.upload = new Upload(null, receiver);
  upload.setButtonCaption(i18nManager.getMessage(Messages.UPLOAD_SELECT));
  upload.setImmediate(true);
  addComponent(upload);
  setComponentAlignment(upload, Alignment.MIDDLE_CENTER);

  // register ourselves as listener for upload events
  upload.addListener((StartedListener) this);
  upload.addListener((FailedListener) this);
  upload.addListener((FinishedListener) this);
  upload.addListener((ProgressListener) this);
}
项目:SecureBPMN    文件:UploadComponent.java   
public void updateProgress(long readBytes, long contentLength) {
  progressIndicator.setValue(new Float(readBytes / (float) contentLength));

  for (ProgressListener progressListener : progressListeners) {
    progressListener.updateProgress(readBytes, contentLength);
  }
}
项目:SecureBPMN    文件:InMemoryUploadReceiver.java   
/**
 * @param upload The component that will serve this receiver
 * @param maxFileSize The maximum size of files that will be accepted (in bytes). -1 in case of no limit.
 */
public InMemoryUploadReceiver(Upload upload, long maxFileSize) {
  this.upload = upload;
  this.maxFileSize = maxFileSize;
  this.notificationManager = ExplorerApp.get().getNotificationManager();

  upload.setReceiver(this);
  upload.addListener((StartedListener) this);
  upload.addListener((ProgressListener) this);
}
项目:vaadinInvoiceGenerator    文件:UploadComponent.java   
public UploadComponent(String buttonCaption, String sessionId, int maxSize, String folderPath) {
     upload = new Upload();
     this.addComponent(upload);
     this.maxSize = maxSize;
     upload.setReceiver( this); 
     this.directory = folderPath;
     upload.setButtonCaption(buttonCaption);
     upload.addSucceededListener((Upload.SucceededListener) this);
     upload.addFailedListener((Upload.FailedListener) this);
     upload.addProgressListener((Upload.ProgressListener) this);
     upload.addFinishedListener((Upload.FinishedListener) this);

     processingLayout = new HorizontalLayout();
     processingLayout.setSpacing(true);
     processingLayout.setVisible(false);
     this.addComponent(processingLayout);

     progressBar = new ProgressBar();
     processingLayout.addComponent(progressBar);

     cancelProcessing = new Button("cancel", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
    cancelled = true;
             upload.interruptUpload();

}
     });
     processingLayout.addComponent(cancelProcessing);
 }
项目:FiWare-Template-Handler    文件:UploadComponent.java   
protected void addUpload() {
  this.upload = new Upload(null, receiver);
  upload.setButtonCaption(i18nManager.getMessage(Messages.UPLOAD_SELECT));
  upload.setImmediate(true);
  addComponent(upload);
  setComponentAlignment(upload, Alignment.MIDDLE_CENTER);

  // register ourselves as listener for upload events
  upload.addListener((StartedListener) this);
  upload.addListener((FailedListener) this);
  upload.addListener((FinishedListener) this);
  upload.addListener((ProgressListener) this);
}
项目:FiWare-Template-Handler    文件:UploadComponent.java   
public void updateProgress(long readBytes, long contentLength) {
  progressIndicator.setValue(new Float(readBytes / (float) contentLength));

  for (ProgressListener progressListener : progressListeners) {
    progressListener.updateProgress(readBytes, contentLength);
  }
}
项目:FiWare-Template-Handler    文件:InMemoryUploadReceiver.java   
/**
 * @param upload The component that will serve this receiver
 * @param maxFileSize The maximum size of files that will be accepted (in bytes). -1 in case of no limit.
 */
public InMemoryUploadReceiver(Upload upload, long maxFileSize) {
  this.upload = upload;
  this.maxFileSize = maxFileSize;
  this.notificationManager = ExplorerApp.get().getNotificationManager();

  upload.setReceiver(this);
  upload.addListener((StartedListener) this);
  upload.addListener((ProgressListener) this);
}
项目:SecureBPMN    文件:UploadComponent.java   
public void addProgressListener(ProgressListener progressListener) {
  progressListeners.add(progressListener);
}
项目:SecureBPMN    文件:UploadPopupWindow.java   
public void addProgressListener(ProgressListener progressListener) {
  uploadComponent.addProgressListener(progressListener);
}
项目:FiWare-Template-Handler    文件:UploadComponent.java   
public void addProgressListener(ProgressListener progressListener) {
  progressListeners.add(progressListener);
}
项目:FiWare-Template-Handler    文件:UploadPopupWindow.java   
public void addProgressListener(ProgressListener progressListener) {
  uploadComponent.addProgressListener(progressListener);
}
项目:vaadin-fluent-api    文件:FluentUpload.java   
/**
 * Adds the upload progress event listener.
 *
 * @param listener
 *            the progress listener to be added
 * @return this for method chaining
 * @see Upload#addProgressListener(ProgressListener)
 */
@SuppressWarnings("unchecked")
public default THIS withProgressListener(ProgressListener listener) {
    ((Upload) this).addProgressListener(listener);
    return (THIS) this;
}