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

项目:osc-core    文件:ApplianceUploader.java   
@Override
public void uploadFailed(FailedEvent event) {
    if (event.getFilename() == null || event.getFilename().isEmpty()) {
        ViewUtil.iscNotification(VmidcMessages.getString(VmidcMessages_.UPLOAD_APPLIANCE_NOFILE),
                Notification.Type.ERROR_MESSAGE);
    } else if (event.getReason() instanceof UploadInterruptedException) {
        log.warn("Appliance Image upload is cancelled by the user");
    } else {
        ViewUtil.iscNotification(VmidcMessages.getString(VmidcMessages_.UPLOAD_APPLIANCE_FAILED),
                Notification.Type.ERROR_MESSAGE);
    }
    if (this.uploadPath != null) {
        File uploadDirectory = new File(this.uploadPath);
        if (uploadDirectory.exists()) {
            try {
                FileUtils.deleteDirectory(uploadDirectory);
            } catch (IOException e) {
                log.error("Deleting upload directory: " + this.uploadPath
                        + " failed when upload was cancelled by user.", e);
            }
        }
    }
}
项目:osc-core    文件:SslCertificateUploader.java   
@Override
public void uploadFailed(FailedEvent event) {
    log.error(new Label(new Date() + ": SSL certificate upload failed.").getValue());

    if (event.getFilename() == null || event.getFilename().isEmpty()) {
        log.warn("No upload certificate file specified");
        ViewUtil.iscNotification(getString(MAINTENANCE_SSLCONFIGURATION_NOFILE),
                Notification.Type.ERROR_MESSAGE);
        repaintUpload();
    } else if (event.getReason() instanceof UploadInterruptedException) {
        log.warn("SSL certificate upload is cancelled by the user");
    } else {
        log.warn("SSL certificate upload failed");
        ViewUtil.iscNotification(getString(MAINTENANCE_SSLCONFIGURATION_FAILED),
                Notification.Type.ERROR_MESSAGE);
        repaintUpload();
    }

    removeUploadedFile();
}
项目: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());
}
项目:hawkbit    文件:UploadHandler.java   
/**
 * Upload failed for {@link Upload} variant.
 *
 * @see com.vaadin.ui.Upload.FailedListener#uploadFailed(com.vaadin.ui.Upload.FailedEvent)
 */
@Override
public void uploadFailed(final FailedEvent event) {
    /**
     * If upload failed due to no selected software UPLOAD_FAILED event need
     * not be published.
     */
    if (selectedSwForUpload != null) {
        if (failureReason == null) {
            failureReason = event.getReason().getMessage();
        }
        eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_FAILED,
                new UploadFileStatus(fileName, failureReason, selectedSwForUpload)));
        if (!aborted) {
            LOG.info("Upload failed for file :{}", event.getFilename());
            LOG.info("Upload failed for file :{}", event.getReason());
        }
    }
}
项目:vaadinInvoiceGenerator    文件:UploadComponent.java   
@Override
public void uploadFailed(FailedEvent event) {
    processingLayout.setVisible(false);
    if (contentLength != null && maxSize < contentLength) {
        Notification.show("File too large", 
                "Your file "+contentLength/1000+"Kb long. Please select an file smaller than " + maxSize / 1000 + "Kb", Notification.Type.ERROR_MESSAGE);
    } else if (cancelled) {

    } else {
        Notification.show("There was a problem uploading your file", Notification.Type.ERROR_MESSAGE);
    }

    try{
        file.delete();
    } catch (Exception e) {

    }

    afterUploadFailed(event);
}
项目:scoutmaster    文件:ImportSelectFile.java   
private void failedListener()
{
    this.upload.addFailedListener(new FailedListener()
    {
        private static final long serialVersionUID = 1L;

        @Override
        public void uploadFailed(final FailedEvent event)
        {
            UI ui = UI.getCurrent();
            ui.access(() -> {
                Notification
                        .show("The upload failed. " + event.getReason() + " Please fix the problem and try again.");
                ImportSelectFile.this.uploadStarted = true;
                ImportSelectFile.this.uploadComplete = false;
            });
        }
    });
}
项目:osc-core    文件:DbRestorer.java   
@Override
public void uploadFailed(FailedEvent event) {
    if (event.getFilename() == null || event.getFilename().isEmpty()) {
        ViewUtil.iscNotification(VmidcMessages.getString("upload.restore.nofile"),
                Notification.Type.ERROR_MESSAGE);
    } else if (event.getReason() instanceof UploadInterruptedException) {
        log.warn("Database backup Upload is cancelled by the user");

    } else {
        ViewUtil.iscNotification(VmidcMessages.getString("upload.restore.invalid.backup"),
                Notification.Type.WARNING_MESSAGE);
    }
}
项目:osc-core    文件:UploadInfoWindow.java   
@Override
public void uploadFailed(final FailedEvent event) {
    close();
}
项目:garantia    文件:UploadInfoWindow.java   
@Override
public void uploadFailed(final FailedEvent event) {
    result.setValue(counter.getLineBreakCount()
            + " (Recuento Interrumpido al "
            + Math.round(100 * progressBar.getValue()) + "%)");
}
项目:hawkbit    文件:BulkUploadHandler.java   
@Override
public void uploadFailed(final FailedEvent event) {
    LOG.info("Upload failed for file :{} due to {}", event.getFilename(), event.getReason());
}
项目:SecureBPMN    文件:UploadComponent.java   
public void uploadFailed(FailedEvent event) {
  for (FailedListener failedListener : failedListeners) {
    failedListener.uploadFailed(event);
  }
}
项目:vaadinInvoiceGenerator    文件:UploadComponent.java   
public void afterUploadFailed(FailedEvent event) {
}
项目:FiWare-Template-Handler    文件:UploadComponent.java   
public void uploadFailed(FailedEvent event) {
  for (FailedListener failedListener : failedListeners) {
    failedListener.uploadFailed(event);
  }
}
项目: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());
}
项目:mideaas    文件:UploadProjectPanel.java   
public void uploadFailed(FailedEvent event) {
    Notification.show("Upload failed: " + event.getReason());
}
项目:RVaadin    文件:RUpload.java   
@Override
public void uploadFailed(FailedEvent event) {
    System.err.println("Upload failed: releasing the R Session.");
    R.releaseRConnection();
    rc = null;
}
项目:own-music-cloud    文件:MusicUploader.java   
@Override
public void uploadFailed(FailedEvent event) {
    /*new Notification("Could not open file", event.getReason()
            .getMessage(), Notification.Type.ERROR_MESSAGE).show(Page
            .getCurrent());*/
}
项目:GlycanBuilderVaadin7Version    文件:NavigatorFileUpload.java   
public abstract void uploadFailed(FailedEvent failedEvent);