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

项目:hawkbit    文件:UploadHandler.java   
UploadHandler(final String fileName, final long fileSize, final UploadLayout view, final long maxSize,
        final Upload upload, final String mimeType, final SoftwareModule selectedSw,
        final SoftwareModuleManagement softwareManagement) {
    super();
    this.aborted = false;
    this.fileName = fileName;
    this.fileSize = fileSize;
    this.view = view;
    this.maxSize = maxSize;
    this.upload = upload;
    this.mimeType = mimeType;
    this.selectedSw = selectedSw;
    this.i18n = SpringContextHelper.getBean(VaadinMessageSource.class);
    this.eventBus = SpringContextHelper.getBean(EventBus.UIEventBus.class);
    this.artifactUploadState = SpringContextHelper.getBean(ArtifactUploadState.class);
    this.softwareModuleManagement = softwareManagement;
    eventBus.subscribe(this);
}
项目: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);
}
项目:osc-core    文件:SslCertificateUploader.java   
protected void createUpload() {
    this.upload = new Upload();
    this.upload.setButtonCaption(getString(MAINTENANCE_SSLCONFIGURATION_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((StartedListener) event -> {
        if (uploadInfoWindow.getParent() == null) {
            ViewUtil.addWindow(uploadInfoWindow);
        }
    });
}
项目:incubator-openaz    文件:PIPImportWindow.java   
@AutoGenerated
private VerticalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("-1px");
    mainLayout.setHeight("-1px");
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    // top-level component properties
    setWidth("-1px");
    setHeight("-1px");

    // upload_1
    upload = new Upload();
    upload.setImmediate(false);
    upload.setWidth("-1px");
    upload.setHeight("-1px");
    mainLayout.addComponent(upload);

    return mainLayout;
}
项目:hybridbpm    文件:FileManager.java   
@Override
public void uploadSucceeded(Upload.SucceededEvent event) {
    try {
        image = baos.toByteArray();
        File file = new File();
        file.setBody(image);
        file.setScope(File.SCOPE.CASE);
        file.setFileName(filename);
        file.setMime(file.getId() != null ? file.getMime() : mimeType);
        file.setSize(image.length);
        FileField fileField = new FileField(file);
        addComponent(fileField, getComponentIndex(fileUpload));
        checkVisibility();
    } catch (Exception ex) {
        Logger.getLogger(FileManager.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
    }
}
项目:hybridbpm    文件:DocumentFormLayout.java   
@Override
public void uploadSucceeded(Upload.SucceededEvent event) {
    try {
        image = baos.toByteArray();
        binder.commit();
        document = binder.getItemDataSource().getBean();
        document.setUpdateDate(new Date());
        document.setName(document.getId() != null ? document.getName() : filename);
        document.setBody(image);
        document.setMime(document.getId() != null ? document.getMime() : mimeType);
        document.setSize(image.length);
        binder.setItemDataSource(document);
        checkVisibility();
    } catch (FieldGroup.CommitException ex) {
        Logger.getLogger(DocumentFormLayout.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
    }
}
项目:SecureBPMN    文件:ProfilePanel.java   
protected Upload initChangePictureButton() {
  final Upload changePictureUpload = new Upload();
  changePictureUpload.setImmediate(true);
  changePictureUpload.setButtonCaption(i18nManager.getMessage(Messages.PROFILE_CHANGE_PICTURE));

  final InMemoryUploadReceiver receiver = initPictureReceiver(changePictureUpload);
  changePictureUpload.addListener(new FinishedListener() {
    private static final long serialVersionUID = 1L;
    public void uploadFinished(FinishedEvent event) {
      if (!receiver.isInterruped()) {
        picture = new Picture(receiver.getBytes(), receiver.getMimeType());
        identityService.setUserPicture(userId, picture);

        // reset picture
        imageLayout.removeAllComponents();
        initPicture();
      } else {
        receiver.reset();
      }
    }
  });

  return changePictureUpload;
}
项目:jain-I18n    文件:JUploader.java   
public JUploader() {
    setWidth("100%");
    setMargin(new MarginInfo(true, false, true, false));
    setStyleName("j-upload");

    upload = new Upload();
    upload.setWidth("100%");
    upload.setImmediate(true);
    addComponent(upload);

    pi = new JProgressIndicator();
    upload.addProgressListener(pi);
    addComponent(pi);
    pi.setVisible(false);

    receiver = new JFileReceiver();
    upload.setReceiver(receiver);

    upload.addSucceededListener(this);
    upload.addStartedListener(this);
}
项目:XACML    文件:PIPImportWindow.java   
@AutoGenerated
private VerticalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("-1px");
    mainLayout.setHeight("-1px");
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    // top-level component properties
    setWidth("-1px");
    setHeight("-1px");

    // upload_1
    upload = new Upload();
    upload.setImmediate(false);
    upload.setWidth("-1px");
    upload.setHeight("-1px");
    mainLayout.addComponent(upload);

    return mainLayout;
}
项目:FiWare-Template-Handler    文件:ProfilePanel.java   
protected Upload initChangePictureButton() {
  final Upload changePictureUpload = new Upload();
  changePictureUpload.setImmediate(true);
  changePictureUpload.setButtonCaption(i18nManager.getMessage(Messages.PROFILE_CHANGE_PICTURE));

  final InMemoryUploadReceiver receiver = initPictureReceiver(changePictureUpload);
  changePictureUpload.addListener(new FinishedListener() {
    private static final long serialVersionUID = 1L;
    public void uploadFinished(FinishedEvent event) {
      if (!receiver.isInterruped()) {
        picture = new Picture(receiver.getBytes(), receiver.getMimeType());
        identityService.setUserPicture(userId, picture);

        // reset picture
        imageLayout.removeAllComponents();
        initPicture();
      } else {
        receiver.reset();
      }
    }
  });

  return changePictureUpload;
}
项目:vaadin-cmis-browser    文件:DocumentUploader.java   
/**
 * Invoked when the upload reached the Web Server (not the CMIS server).
 *
 * @param event the Upload successful event.
 */
@Override
public void uploadSucceeded(Upload.SucceededEvent event) {
    if (fileName == null) {
        fileName = event.getFilename();
    }

    String mimeType = event.getMIMEType();

    long length = event.getLength();

    InputStream stream = new ByteArrayInputStream(outputStream.toByteArray());

    documentView = client.upload(parent, fileName, mimeType, stream,
            BigInteger.valueOf(length), versioningState, checkInComment, properties);

    onCmisUploadReceived(documentView);
}
项目: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);
}
项目:businesshorizon2    文件:InitialScreenViewImpl.java   
public void createImportButton(){
    importButton = new VerticalLayout();
    importButton.setWidth(150, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    importButton.setHeight(80, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    importButton.setStyleName("topBarButtonContainer");
    UploadReceiver receiver = new UploadReceiver(eventBus);
    Upload upload = new Upload(null, receiver);
    upload.setButtonCaption("");
    upload.setImmediate(true);
    upload.addListener(receiver);
    upload.setStyleName("importButton");
    upload.setWidth(30, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    upload.setHeight(30, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    Label gap = new Label();
    gap.setHeight("5px");
    Label label = new Label("Projekte");
    label.setStyleName("topBarButtonLabel");
    label.setSizeUndefined();
    Label label2 = new Label("importieren");
    label2.setStyleName("topBarButtonLabel");
    label2.setSizeUndefined();
    VerticalLayout labelLayout = new VerticalLayout();
    labelLayout.setHeight(45, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    labelLayout.setWidth(100, UNITS_PERCENTAGE);
    importButton.addComponent(upload);
    labelLayout.addComponent(label);
    labelLayout.addComponent(label2);
    importButton.addComponent(gap);
    importButton.addComponent(labelLayout);
    importButton.setComponentAlignment(upload, Alignment.TOP_CENTER);
    labelLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
    labelLayout.setComponentAlignment(label2, Alignment.MIDDLE_CENTER);
}
项目:hybridbpm    文件:DocumentField.java   
@Override
public void uploadSucceeded(Upload.SucceededEvent event) {
    image = baos.toByteArray();
    document.setCreateDate(new Date());
    document.setBody(image);
    document.setSize(image.length);
    checkVisibility();
}
项目:hawkbit    文件:UploadLayout.java   
private void buildLayout() {

        final Upload upload = new Upload();
        final UploadHandler uploadHandler = new UploadHandler(null, 0, this, multipartConfigElement.getMaxFileSize(),
                upload, null, null, softwareModuleManagement);
        upload.setButtonCaption(i18n.getMessage("upload.file"));
        upload.setImmediate(true);
        upload.setReceiver(uploadHandler);
        upload.addSucceededListener(uploadHandler);
        upload.addFailedListener(uploadHandler);
        upload.addFinishedListener(uploadHandler);
        upload.addProgressListener(uploadHandler);
        upload.addStartedListener(uploadHandler);
        upload.addStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
        upload.addStyleName("no-border");

        fileUploadLayout = new HorizontalLayout();
        fileUploadLayout.setSpacing(true);
        fileUploadLayout.addStyleName(SPUIStyleDefinitions.FOOTER_LAYOUT);
        fileUploadLayout.addComponent(upload);
        fileUploadLayout.setComponentAlignment(upload, Alignment.MIDDLE_LEFT);
        fileUploadLayout.addComponent(processBtn);
        fileUploadLayout.setComponentAlignment(processBtn, Alignment.MIDDLE_RIGHT);
        fileUploadLayout.addComponent(discardBtn);
        fileUploadLayout.setComponentAlignment(discardBtn, Alignment.MIDDLE_RIGHT);
        fileUploadLayout.addComponent(uploadStatusButton);
        fileUploadLayout.setComponentAlignment(uploadStatusButton, Alignment.MIDDLE_RIGHT);
        setMargin(false);

        /* create drag-drop wrapper for drop area */
        dropAreaWrapper = new DragAndDropWrapper(createDropAreaLayout());
        dropAreaWrapper.setDropHandler(new DropAreahandler());
        setSizeFull();
        setSpacing(true);
    }
项目:hawkbit    文件:BulkUploadHandler.java   
void buildLayout() {
    final HorizontalLayout horizontalLayout = new HorizontalLayout();
    upload = new Upload();
    upload.setEnabled(false);
    upload.setButtonCaption("Bulk Upload");
    upload.setReceiver(this);
    upload.setImmediate(true);
    upload.setWidthUndefined();
    upload.addSucceededListener(this);
    upload.addFailedListener(this);
    upload.addStartedListener(this);
    horizontalLayout.addComponent(upload);
    horizontalLayout.setComponentAlignment(upload, Alignment.BOTTOM_RIGHT);
    setCompositionRoot(horizontalLayout);
}
项目: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    文件: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);
}
项目:pivottable    文件:DemoUI.java   
@Override
protected void init(VaadinRequest request) {

    final VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    setContent(layout);

    Upload upload = new Upload("Upload CSV",
            new Upload.Receiver() {
                @Override
                public OutputStream receiveUpload(String name, String mime) {
                    tempCSV = new ByteArrayOutputStream();
                    return tempCSV;
                }
            }
    );
    upload.setImmediate(true);

    upload.addFinishedListener(new Upload.FinishedListener() {
        @Override
        public void uploadFinished(Upload.FinishedEvent finishedEvent) {
            pivotTable.setData(tempCSV.toString());
        }
    });

    pivotTable = new PivotTable();

    layout.addComponents(upload, pivotTable);

}
项目:minimal-j    文件:VaadinImportDialog.java   
public VaadinImportDialog(String title) {
    super(title);
    inputStream = new CloseablePipedInputStream();

    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSpacing(false);
    upload = new Upload(null, this);

    horizontalLayout.addComponent(upload);
    horizontalLayout.setExpandRatio(upload, 1.0F);

    setContent(horizontalLayout);
    setModal(true);
    UI.getCurrent().addWindow(this);

    addCloseListener(new CloseListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void windowClose(CloseEvent e) {
            try {
                inputStream.close();
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    });
}
项目:Plugins    文件:UploadInfoWindow.java   
/**
 * this method gets called immediately after upload is finished
 */
@Override
public void uploadFinished(final Upload.FinishedEvent event) {
    state.setValue("Idle");
    pi.setVisible(false);
    textualProgress.setVisible(false);
    cancelButton.setVisible(false);

}
项目:Plugins    文件:UploadInfoWindow.java   
/**
 * this method gets called immediately after upload is started
 */
@Override
public void uploadStarted(final Upload.StartedEvent event) {

    pi.setValue(0f);
    pi.setVisible(true);
    pi.setPollingInterval(500); // hit server frequently to get
    textualProgress.setVisible(true);
    // updates to client
    state.setValue("Uploading");
    fileName.setValue(event.getFilename());

    cancelButton.setVisible(true);
}
项目: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    文件: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);
}
项目:bootstrap-for-vaadin    文件:BootstrapDemoUI.java   
private void forms(CssLayout container) {
    VerticalLayout form = new VerticalLayout();
    form.addStyleName(Bootstrap.Forms.FORM.styleName());
    form.setSpacing(true);
    form.setCaption("Legend");

    TextField email = new TextField("Email address");
    email.setInputPrompt("Enter email");
    form.addComponent(email);

    PasswordField password = new PasswordField("Password");
    password.setInputPrompt("Password");
    form.addComponent(password);

    Upload upload = new Upload("File input", null);
    form.addComponent(upload);

    Label help = new Label("Example block-level help text here.");
    help.addStyleName("help-block");
    form.addComponent(help);

    CheckBox check = new CheckBox("Check me out");
    form.addComponent(check);

    Button submit = new Button("Submit");
    submit.addStyleName(Bootstrap.Buttons.DEFAULT.styleName());
    form.addComponent(submit);

    container.addComponent(form);
}
项目:konekti    文件:UploadWindow.java   
private HorizontalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new HorizontalLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("100%");
    mainLayout.setHeight("-1px");
    mainLayout.setMargin(false);

    // top-level component properties
    setWidth("100%");
    setHeight("-1px");

    // upload_1
    uploadFile = new Upload();
    uploadFile.setImmediate(false);
    uploadFile.setWidth("-1px");
    uploadFile.setHeight("-1px");
    mainLayout.addComponent(uploadFile);

    // btnRemove
    removeFile = new Button();
    removeFile.setCaption("Borrar");
    removeFile.setImmediate(false);
    removeFile.setWidth("-1px");
    removeFile.setHeight("-1px");       
    mainLayout.addComponent(removeFile);
    mainLayout.setComponentAlignment(removeFile, Alignment.BOTTOM_LEFT);

    // btnDownload
    downloadFile = new Button();
    downloadFile.setCaption("Bajar");
    downloadFile.setImmediate(false);
    downloadFile.setWidth("-1px");
    downloadFile.setHeight("-1px");     
    mainLayout.addComponent(downloadFile);
    mainLayout.setComponentAlignment(downloadFile, Alignment.BOTTOM_LEFT);
    mainLayout.setExpandRatio(downloadFile, 1.0f);

    return mainLayout;
}
项目:konekti    文件:ImageField.java   
private VerticalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout(){

        @Override
        public void attach() {
            super.attach();
            ImageField.this.application = getApplication();
        }
    };
    mainLayout.setImmediate(false);
    mainLayout.setWidth("-1px");
    mainLayout.setHeight("-1px");
    mainLayout.setMargin(false);

    // top-level component properties
    setWidth("-1px");
    setHeight("-1px");

    // hlImage
    hlImage = buildHlImage();
    mainLayout.addComponent(hlImage);

    // uploadImage
    uploadImage = new Upload();
    uploadImage.setImmediate(false);
    uploadImage.setWidth("-1px");
    uploadImage.setHeight("-1px");
    mainLayout.addComponent(uploadImage);
    mainLayout.setExpandRatio(uploadImage, 1.0f);

    return mainLayout;
}
项目:konekti    文件:AttachmentViewForm.java   
private HorizontalLayout buildHorizontalLayoutFileToolbox() {
    // common part: create layout
    horizontalLayoutFileToolbox = new HorizontalLayout();
    horizontalLayoutFileToolbox.setImmediate(false);
    horizontalLayoutFileToolbox.setWidth("100.0%");
    horizontalLayoutFileToolbox.setHeight("-1px");
    horizontalLayoutFileToolbox.setMargin(false);

    // uploadFile
    uploadFile = new Upload();
    uploadFile.setImmediate(false);
    uploadFile.setWidth("-1px");
    uploadFile.setHeight("-1px");
    horizontalLayoutFileToolbox.addComponent(uploadFile);

    // buttonDownloadFile
    btnDownloadFile = new Button();
    btnDownloadFile.setCaption("Bajar");
    btnDownloadFile.setImmediate(false);
    btnDownloadFile.setWidth("-1px");
    btnDownloadFile.setHeight("-1px");
    horizontalLayoutFileToolbox.addComponent(btnDownloadFile);
    horizontalLayoutFileToolbox.setComponentAlignment(btnDownloadFile,
            new Alignment(9));

    // btnRemoveFile
    btnRemoveFile = new Button();
    btnRemoveFile.setCaption("Eliminar");
    btnRemoveFile.setImmediate(true);
    btnRemoveFile.setWidth("-1px");
    btnRemoveFile.setHeight("-1px");
    horizontalLayoutFileToolbox.addComponent(btnRemoveFile);
    horizontalLayoutFileToolbox.setExpandRatio(btnRemoveFile, 1.0f);
    horizontalLayoutFileToolbox.setComponentAlignment(btnRemoveFile,
            new Alignment(9));

    return horizontalLayoutFileToolbox;
}
项目:GlycanBuilderVaadin7Version    文件:NavigatorFileUpload.java   
protected void initialise(String buttonCaption){
    initialise(buttonCaption,new Upload.Receiver(){
        private static final long serialVersionUID=-4952934177751492620L;

        @Override
        public OutputStream receiveUpload(String filename, String mimeType){
            FileOutputStream fos = null;
            try {
                file = File.createTempFile("import",".seq");

                for(LocalResourceWatcher watcher:theWatchers){
                    watcher.addLocalResource(file);
                }

                fos = new FileOutputStream(file);
            } catch (IOException e) {
                msg=new Message("IO error reading uploaded file", e);

                if(file.exists()){
                    file.delete();
                }

                return null;
            } 

            return fos;
        }
    });
}
项目:scoutmaster    文件:ImportSelectFile.java   
private void initUpload()
{
    this.upload = new Upload("", new Upload.Receiver()
    {
        private static final long serialVersionUID = 1L;

        @Override
        public OutputStream receiveUpload(final String filename, final String mimeType)
        {
            try
            {
                /*
                 * Here, we'll stored the uploaded file as a temporary file.
                 * No doubt there's a way to use a ByteArrayOutputStream, a
                 * reader around it, use ProgressListener (and a progress
                 * bar) and a separate reader thread to populate a container
                 * *during* the update.
                 *
                 * This is quick and easy example, though.
                 */
                ImportSelectFile.this.tempFile = File.createTempFile("temp", ".csv");
                return new FileOutputStream(ImportSelectFile.this.tempFile);
            }
            catch (final IOException e)
            {
                e.printStackTrace();
                return null;
            }
        }
    });
}
项目:scoutmaster    文件:ImportSelectFile.java   
private void finishListener()
{
    this.upload.addFinishedListener(new Upload.FinishedListener()
    {
        private static final long serialVersionUID = 1L;

        @Override
        public void uploadFinished(final Upload.FinishedEvent finishedEvent)
        {
            UI ui = UI.getCurrent();
            ui.access(() -> {
                ImportSelectFile.this.selectedFilename = new File(finishedEvent.getFilename());
                ImportSelectFile.this.uploadComplete = true;
                ImportSelectFile.this.progress.setVisible(false);
                ImportSelectFile.this.progressBar.setValue(1.0f);
                ImportSelectFile.this.progressBar.setVisible(true);

                ImportSelectFile.this.progressBar
                        .setCaption("Completed uploading file: " + ImportSelectFile.this.selectedFilename.getName()
                                + " Total size: " + finishedEvent.getLength() + " bytes");
                ImportSelectFile.this.completionMessage.setValue(
                        "The upload of File " + ImportSelectFile.this.selectedFilename + " has been completed.");

                SMNotification.show("The upload has completed. Click 'Next'", Type.TRAY_NOTIFICATION);
            });

        }
    });
}
项目:mideaas    文件:UploadProjectPanel.java   
public UploadProjectPanel(MideaasUI ui) {
    super("Upload Project");

    upload.addSucceededListener((Upload.SucceededListener) this);
    upload.addFailedListener((Upload.FailedListener) this);

    setIcon(Icons.BOX_LABEL);

    this.setContent(upload);
    this.setWidth("100%");
    this.ui =ui;
}
项目:own-music-cloud    文件:MusicUploader.java   
public MusicUploader(IMusicUploader caller) {     
    callback = caller;
    callback.onUploadFinished();

    setCaption(Messages.getString("uploadMusic")); //$NON-NLS-1$
    this.upload = new Upload();
       upload.setButtonCaption(Messages.getString("upload")); //$NON-NLS-1$

    upload.setReceiver(this);
       upload.addStartedListener(this);
       upload.addSucceededListener(this);
       upload.addProgressListener(this);
       upload.addFailedListener(this);
       upload.addFinishedListener(this);

    setResizable(false);
    setDraggable(false);

    final VerticalLayout stateLayout = new VerticalLayout();
    stateLayout.setSpacing(true);

    stateLayout.addComponent(upload);
    final VerticalLayout l = new VerticalLayout();

    progressBar.setCaption(Messages.getString("uploading"));  //$NON-NLS-1$
    l.addComponent(stateLayout);
    progressBar.setVisible(false);
    textualProgress.setVisible(false);
    l.addComponent(progressBar);
    l.addComponent(textualProgress);
    setContent(l);
    setModal(true);
    l.setMargin(true);
}
项目:osc-core    文件:ApplianceUploader.java   
public Upload getUpload() {
    return this.upload;
}
项目:garantia    文件:UploadInfoWindow.java   
public UploadInfoWindow(final Upload upload,
        final ManejadorArchivo lineBreakCounter) {
    super("Progreso");
    this.counter = lineBreakCounter;

    setWidth(350, Unit.PIXELS);

    addStyleName("upload-info");

    setResizable(true);
    setDraggable(true);
    center();

    final FormLayout l = new FormLayout();
    setContent(l);
    l.setMargin(true);

    final HorizontalLayout stateLayout = new HorizontalLayout();
    stateLayout.setSpacing(true);
    stateLayout.addComponent(state);

    cancelButton = new Button("Cancelar");
    cancelButton.addClickListener(new Button.ClickListener() {
        /**
         * 
         */
        private static final long serialVersionUID = 6204601183664759576L;

        @Override
        public void buttonClick(final ClickEvent event) {
            upload.interruptUpload();
        }
    });
    cancelButton.setVisible(false);
    cancelButton.setStyleName("small");
    stateLayout.addComponent(cancelButton);

    stateLayout.setCaption("Estado Actual: ");
    state.setValue("Desocupado");
    l.addComponent(stateLayout);

    fileName.setCaption("Nombre de Archivo: ");
    l.addComponent(fileName);

    result.setCaption("Saltos de Líneas Contados: ");
    l.addComponent(result);

    progressBar.setCaption("En Curso: ");
    progressBar.setVisible(false);
    l.addComponent(progressBar);

    textualProgress.setVisible(false);
    l.addComponent(textualProgress);

    upload.addStartedListener(this);
    upload.addProgressListener(this);
    upload.addFailedListener(this);
    upload.addSucceededListener(this);
    upload.addFinishedListener(this);

}
项目:incubator-openaz    文件:PolicyUploadWindow.java   
@AutoGenerated
private VerticalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("-1px");
    mainLayout.setHeight("-1px");
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    // top-level component properties
    setWidth("-1px");
    setHeight("-1px");

    // upload
    upload = new Upload();
    upload.setCaption("Upload Xacml Policy File");
    upload.setImmediate(false);
    upload.setWidth("-1px");
    upload.setHeight("-1px");
    mainLayout.addComponent(upload);

    // checkBoxImportAttributes
    checkBoxImportAttributes = new CheckBox();
    checkBoxImportAttributes
            .setCaption("Import attributes into attribute dictionary.");
    checkBoxImportAttributes.setImmediate(false);
    checkBoxImportAttributes.setWidth("-1px");
    checkBoxImportAttributes.setHeight("-1px");
    mainLayout.addComponent(checkBoxImportAttributes);

    // checkBoxIgnoreStandard
    checkBoxIgnoreStandard = new CheckBox();
    checkBoxIgnoreStandard.setCaption("Ignore Standard Attributes");
    checkBoxIgnoreStandard.setImmediate(false);
    checkBoxIgnoreStandard.setWidth("-1px");
    checkBoxIgnoreStandard.setHeight("-1px");
    mainLayout.addComponent(checkBoxIgnoreStandard);
    mainLayout.setComponentAlignment(checkBoxIgnoreStandard, new Alignment(
            20));

    // checkBoxImportObligations
    checkBoxImportObligations = new CheckBox();
    checkBoxImportObligations
            .setCaption("Import obligations into obligation dictionary.");
    checkBoxImportObligations.setImmediate(false);
    checkBoxImportObligations.setWidth("-1px");
    checkBoxImportObligations.setHeight("-1px");
    mainLayout.addComponent(checkBoxImportObligations);

    // checkBoxImportAdvice
    checkBoxImportAdvice = new CheckBox();
    checkBoxImportAdvice
            .setCaption("Import advice into advice dictionary.");
    checkBoxImportAdvice.setImmediate(false);
    checkBoxImportAdvice.setWidth("-1px");
    checkBoxImportAdvice.setHeight("-1px");
    mainLayout.addComponent(checkBoxImportAdvice);

    return mainLayout;
}
项目:hawkbit    文件:BulkUploadHandler.java   
/**
 * @return the upload
 */
public Upload getUpload() {
    return upload;
}
项目:trollator    文件:TrollatorUI.java   
@Override
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    ;
    setContent(layout);

    Webcam upload = new Webcam();
    upload.setReceiver(new Upload.Receiver() {

        @Override
        public OutputStream receiveUpload(String filename, String mimeType) {
            try {
                receivedImageFile = File.createTempFile(
                        "img" + System.currentTimeMillis(), ".png");
                return new FileOutputStream(receivedImageFile);
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
    });
    upload.addCaptureSucceededListener(new Webcam.CaptureSucceededListener() {

        @Override
        public void captureSucceeded(Webcam.CaptureSucceededEvent event) {

            // Face detect
            Mat original = Imgcodecs.imread(receivedImageFile
                    .getAbsolutePath());
            Rect[] faces = faceDetect(original);
            BufferedImage detectedImage = toBufferedImage(original);

            BufferedImage overlay = loadImage(new File(TROLL_IMAGE));

            Graphics2D g = detectedImage.createGraphics();
            for (int i = 0; i < faces.length; i++) {
                Rect rect = faces[i];
                g.drawImage(overlay, rect.x, rect.y, rect.x + rect.width,
                        rect.y + rect.height, 0, 0, overlay.getWidth(),
                        overlay.getHeight(), null);
            }
            g.dispose();

            // remove previous results
            if (image != null) {
                layout.removeComponent(image);
            }

            // add image
            image = new DynamicImage(detectedImage);
            layout.addComponent(image);

        }
    });
    layout.addComponent(upload);

}