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

项目:osc-core    文件:SslCertificateUploader.java   
@Override
public void uploadSucceeded(SucceededEvent event) {
    boolean succeeded = true;
    try {
        processCertificateFile();
        log.info("=============== Upload certificate succeeded");
        repaintUpload();
    } catch (Exception ex) {
        succeeded = false;
        log.error("=============== Failed to upload certificate", ex);
        ViewUtil.iscNotification("SSL certificate upload failed. " + ex.getMessage() + " Please use a valid certificate file", Notification.Type.ERROR_MESSAGE);
        repaintUpload();
    }

    if(this.uploadNotifier != null){
        this.uploadNotifier.finishedUpload(succeeded);
    }
}
项目:osc-core    文件:ImportApplianceSoftwareVersionWindow.java   
@SuppressWarnings("serial")
private SucceededListener getUploadSucceededListener() {
    return new SucceededListener() {

        @Override
        public void uploadSucceeded(SucceededEvent event) {
            log.info("Upload Successful! Analyzing Uploaded Image.....");
            final ProgressIndicatorWindow progressIndicatorWindow = new ProgressIndicatorWindow();

            progressIndicatorWindow.setWidth("200px");
            progressIndicatorWindow.setHeight("100px");
            progressIndicatorWindow.setCaption("Processing image ...");

            UI.getCurrent().addWindow(progressIndicatorWindow);
            progressIndicatorWindow.bringToFront();

            Runnable serviceCall = uploadValidationService(progressIndicatorWindow, event);

            ScheduledExecutorService exec = Executors.newScheduledThreadPool(1);
            exec.schedule(serviceCall, 1, TimeUnit.MILLISECONDS);
        }
    };
}
项目:vaadin-fluent-api    文件:FUploadTest.java   
@Test
public void test() {
    FUpload upload = new FUpload().withButtonCaption("file")
                                  .withImmediateMode(false)
                                  .withFailedListener(event -> System.out.println("failed"))
                                  .withFinishedListener(event -> System.out.println("finished"))
                                  .withChangeListener(event -> System.out.println("changed"))
                                  .withSucceededListener(event -> System.out.println("succeeded"))
                                  .withProgressListener((readBytes, contentLength) -> System.out.println("progress"));

    assertEquals("file", upload.getButtonCaption());
    assertFalse(upload.isImmediateMode());
    assertEquals(1, upload.getListeners(FailedEvent.class).size());
    assertTrue(upload.getListeners(FinishedEvent.class).size() > 0);
    assertEquals(1, upload.getListeners(ChangeEvent.class).size());
    assertEquals(1, upload.getListeners(SucceededEvent.class).size());
    assertEquals(1, upload.getListeners(StreamingProgressEvent.class).size());
}
项目:RVaadin    文件:RUpload.java   
@Override
public void uploadSucceeded(SucceededEvent event) {

    try {
        /* Close the stream and save the file information */
        rfos.close();
        uploadedFiles.addItem(filename);
        fileNames.add(filename);
        mimeTypes.add(mimeType);
        remove.setEnabled(true);

    } catch (IOException e) {
        e.printStackTrace();

    } finally {
        R.releaseRConnection();
        rc = null;
    }
}
项目:incubator-openaz    文件:PolicyUploadWindow.java   
@Override
public void uploadSucceeded(SucceededEvent event) {
    if (logger.isDebugEnabled()) {
        logger.debug("upload succeeded");
    }
    this.succeeded = true;
    this.close();
}
项目:hybridbpm    文件:UserLayout.java   
@Override
public void uploadSucceeded(SucceededEvent event) {
    image = baos.toByteArray();
    StreamResource.StreamSource imagesource = new UserImageSource(image);
    StreamResource resource = new StreamResource(imagesource, filename);
    userImage.setSource(resource);
}
项目:hawkbit    文件:UploadHandler.java   
/**
 *
 * Upload sucessfull for {@link Upload} variant.
 *
 * @see com.vaadin.ui.Upload.SucceededListener#uploadSucceeded(com.vaadin.ui.Upload.SucceededEvent)
 */
@Override
public void uploadSucceeded(final SucceededEvent event) {
    LOG.debug("Streaming finished for file :{}", event.getFilename());
    eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_SUCCESSFUL,
            new UploadFileStatus(event.getFilename(), 0, event.getLength(), selectedSwForUpload)));
}
项目:vaadinInvoiceGenerator    文件:UploadPanel.java   
private void initComponents() {
    uploadLabel = new Label("<b>Upload Logo", ContentMode.HTML);
    System.out.println(controller.getFolderPath());
    uploadComponent = new UploadComponent("Upload logo", sessionId, 1000000, controller.getFolderPath()) {

        @Override
        public void uploadSucceeded(SucceededEvent event) {
            invoiceBean.getBean().setLogoImageFilePath(getFile().getAbsolutePath());
        }
    };
}
项目:XACML    文件:PolicyUploadWindow.java   
@Override
public void uploadSucceeded(SucceededEvent event) {
    if (logger.isDebugEnabled()) {
        logger.debug("upload succeeded");
    }
    this.succeeded = true;
    this.close();
}
项目:konekti    文件:AttachmentViewForm.java   
public void uploadSucceeded(SucceededEvent event) {
    // transform file to byte array
    fileArray = getFile(file);

    try {
        // save the new file in database
    attachmentService.save(new Attachment(entityName, entityId, fileName, textAreaFile.getValue().toString(), fileArray));

    // refresh
    getEntities();
} catch (Exception e) {
    throw new RuntimeException("¡No se pudo adjuntar el fichero seleccionado!", e);
}
  }
项目:mideaas    文件:UploadProjectPanel.java   
public void uploadSucceeded(SucceededEvent event) {
    // Is this the right way to test if it's a zip file??
    if (ZIP_MIMETYPES.contains(event.getMIMEType())) {
        ui.uploadProject(file);
    } else {
        Notification.show("Not a zip file. The mimetype is " +event.getMIMEType());
    }
}
项目:esup-ecandidat    文件:Uploader.java   
public void uploadSucceeded(SucceededEvent event) {
    this.customFile = fileController.createFileFromUpload(file,event.getMIMEType(),event.getFilename(),event.getLength(),this.typeFichier, this.prefixe, this.candidature, this.commune);
}
项目:osc-core    文件:ImportApplianceSoftwareVersionWindow.java   
private Runnable uploadValidationService(final ProgressIndicatorWindow progressIndicatorWindow,
        final SucceededEvent event) {

    return new Runnable() {
        @Override
        public void run() {

            // Make service calls in the UI thread, since the calls will update the UI components
            UI.getCurrent().access(new Runnable() {

                @Override
                public void run() {

                    String zipfile = ImportApplianceSoftwareVersionWindow.this.uploader.getUploadPath()
                            + event.getFilename();
                    try {
                        // Do the unzip only if there is enough disc space
                        if (!ImportApplianceSoftwareVersionWindow.this.server.isEnoughSpace()) {
                            throw new VmidcException(VmidcMessages.getString("upload.appliance.nospace"));
                        }

                        if (!FilenameUtils.getExtension(event.getFilename()).equals("zip")) {
                            throw new VmidcException(VmidcMessages
                                    .getString(VmidcMessages_.UPLOAD_APPLIANCE_FAILED));
                        }

                        ImportApplianceSoftwareVersionWindow.this.archiver.unzip(zipfile,
                                ImportApplianceSoftwareVersionWindow.this.uploader.getUploadPath());
                        // After extraction, we don't need the zip file. Delete the zip file
                        log.info("Delete temporary uploaded zip file after extraction " + zipfile);
                        new File(zipfile).delete();

                        addApplianceImage();

                        ViewUtil.iscNotification(
                                VmidcMessages.getString(VmidcMessages_.UPLOAD_APPLIANCE_SUCCESSFUL), null,
                                Notification.Type.TRAY_NOTIFICATION);

                        close();

                    } catch (Exception e) {

                        log.error("Failed to process uploaded zip file", e);
                        try {
                            FileUtils.deleteDirectory(new File(ImportApplianceSoftwareVersionWindow.this.uploader
                                    .getUploadPath()));
                        } catch (IOException ex) {
                            log.error("Failed to cleanup the tmp directory", ex);
                        }

                        ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);

                    } finally {
                        log.info("Deleting file " + zipfile);
                        new File(zipfile).delete();
                        progressIndicatorWindow.close();
                    }
                }
            });
        }

    };
}
项目:osc-core    文件:UploadInfoWindow.java   
@Override
public void uploadSucceeded(final SucceededEvent event) {
    close();
}
项目:garantia    文件:UploadInfoWindow.java   
@Override
public void uploadSucceeded(final SucceededEvent event) {
    result.setValue(counter.getLineBreakCount() + " (total)");
}
项目:incubator-openaz    文件:PIPImportWindow.java   
@Override
public void uploadSucceeded(SucceededEvent event) {
    this.filename = event.getFilename();
    this.close();
}
项目:hawkbit    文件:BulkUploadHandler.java   
@Override
public void uploadSucceeded(final SucceededEvent event) {
    uiExecutor.execute(new UploadAsync());
}
项目:jain-I18n    文件:JImageUpload.java   
public void uploadSucceeded(SucceededEvent event) {
    jImage.updateImage(stream.toByteArray(), event.getFilename());
    super.uploadSucceeded(event);
}
项目:jain-I18n    文件:JUploader.java   
public void uploadSucceeded(SucceededEvent event) {
    pi.setVisible(false);
    upload.setVisible(true);
}
项目:metl    文件:ImportXmlTemplateWindow.java   
@Override
public void uploadSucceeded(SucceededEvent event) {
    importXml(new String(uploadedData.toByteArray()));
}
项目:XACML    文件:PIPImportWindow.java   
@Override
public void uploadSucceeded(SucceededEvent event) {
    this.filename = event.getFilename();
    this.close();
}
项目:konekti    文件:UploadWindow.java   
public void uploadSucceeded(SucceededEvent event) {
    // transform file to byte array
    groupDateFile = getFile(file);

}
项目:konekti    文件:ImageField.java   
public void uploadSucceeded(SucceededEvent event) {
    embeddedImage.setSource(new FileResource(file, application));
    image = getImage(file);
}
项目:konekti    文件:UploadViewForm.java   
public void uploadSucceeded(SucceededEvent event) {
    // transform file to byte array
    groupDateFile = getFileArray(file);

    getParent().removeWindow(UploadViewForm.this);
}
项目:webcam    文件:GifBoothUI.java   
@Override
public void uploadSucceeded(SucceededEvent event) {
    // From upload.
    addImage(targetFile);
}
项目:GlycanBuilderVaadin7Version    文件:VaadinGlycanCanvas.java   
public CanvasImport(){

    VerticalLayout canvasImportLayout = new VerticalLayout();
    canvasImportLayout.setMargin(true);
    setContent(canvasImportLayout);
    uploader=new NavigatorFileUpload("Upload"){
        @Override
        public void uploadFailed(FailedEvent failedEvent){
            reportMessage("Upload failed");
        }

        @Override
        public void uploadSucceeded(SucceededEvent succeededEvent){
            File file=getUploadedFile();

            String format=theCanvas.getImportFormatShortFormat((String)importTypes.getValue());
            try{
                theCanvas.theDoc.importFrom(file.getPath(), format);
            }catch(Exception ex){
                reportMessage("Wrong format or invalid content");
            }

            if(LogUtils.hasLastError()){
                reportMessage("Wrong format or invalid content");
            }

            LogUtils.clearLastError();

            if(file.delete()==false){
                reportException(new Exception("Unable to delete file: "+file.getPath()));
            }

            removeLocalResource(file);
        }

        @Override
        public void uploadFailed(Message msg){
            reportMessage(msg.getMessage());
        }
    };

    uploader.setLocalResourceWatchers(localResourceWatchers);

    List<String> importTypeList=theCanvas.getImportFormats();

    importTypes=new ListSelect("Format", importTypeList);
    importTypes.setNullSelectionAllowed(false);
    importTypes.setValue(importTypeList.get(0));

    canvasImportLayout.addComponent(importTypes);
    canvasImportLayout.addComponent(uploader.getUploadComponent());
}
项目:own-music-cloud    文件:MusicUploader.java   
public void uploadSucceeded(SucceededEvent event) {
    UI.getCurrent().removeWindow(this);
}
项目:garantia    文件:ManejadorArchivo.java   
@Override
public void uploadSucceeded(SucceededEvent event) {
    long initTime = System.currentTimeMillis();

    log.debug("Comienza a guardar el archivo: " + this.fileName);

    CoreParametroAplicacion coreParam = new CoreParametroAplicacion();

    String PATH_NOMINA = coreParam.findParametroAplicacion("PATH_NOMINA");

    try {

        File archivo = new File(PATH_NOMINA + this.fileName);

        FileOutputStream fileOut = new FileOutputStream(archivo);

        for (Iterator iterator = archivoLeido.iterator(); iterator
                .hasNext();) {
            Character character = (Character) iterator.next();

            fileOut.write(character);

        }       

        fileOut.flush();
        fileOut.close();
    } catch (IOException e) {
        log.error(e.getMessage() + " - " + e.getLocalizedMessage(), e);
    }

    log.info("finaliza metodo uploadSucceeded en "  + 
            (System.currentTimeMillis() - initTime)+ " ms");
}
项目:GlycanBuilderVaadin7Version    文件:NavigatorFileUpload.java   
public abstract void uploadSucceeded(SucceededEvent succeededEvent);