@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); } } } }
@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(); }
@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()); }
/** * 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()); } } }
@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); }
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; }); } }); }
@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); } }
@Override public void uploadFailed(final FailedEvent event) { close(); }
@Override public void uploadFailed(final FailedEvent event) { result.setValue(counter.getLineBreakCount() + " (Recuento Interrumpido al " + Math.round(100 * progressBar.getValue()) + "%)"); }
@Override public void uploadFailed(final FailedEvent event) { LOG.info("Upload failed for file :{} due to {}", event.getFilename(), event.getReason()); }
public void uploadFailed(FailedEvent event) { for (FailedListener failedListener : failedListeners) { failedListener.uploadFailed(event); } }
public void afterUploadFailed(FailedEvent event) { }
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()); }
public void uploadFailed(FailedEvent event) { Notification.show("Upload failed: " + event.getReason()); }
@Override public void uploadFailed(FailedEvent event) { System.err.println("Upload failed: releasing the R Session."); R.releaseRConnection(); rc = null; }
@Override public void uploadFailed(FailedEvent event) { /*new Notification("Could not open file", event.getReason() .getMessage(), Notification.Type.ERROR_MESSAGE).show(Page .getCurrent());*/ }
public abstract void uploadFailed(FailedEvent failedEvent);