当前位置: 首页>>代码示例>>Java>>正文


Java FailedEvent类代码示例

本文整理汇总了Java中com.vaadin.ui.Upload.FailedEvent的典型用法代码示例。如果您正苦于以下问题:Java FailedEvent类的具体用法?Java FailedEvent怎么用?Java FailedEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FailedEvent类属于com.vaadin.ui.Upload包,在下文中一共展示了FailedEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: uploadFailed

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
@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);
            }
        }
    }
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:24,代码来源:ApplianceUploader.java

示例2: uploadFailed

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
@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();
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:21,代码来源:SslCertificateUploader.java

示例3: test

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
@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());
}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:19,代码来源:FUploadTest.java

示例4: uploadFailed

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
/**
 * 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());
        }
    }
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:24,代码来源:UploadHandler.java

示例5: uploadFailed

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:nyholmniklas,项目名称:vaadinInvoiceGenerator,代码行数:21,代码来源:UploadComponent.java

示例6: failedListener

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
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;
			});
		}
	});
}
 
开发者ID:bsutton,项目名称:scoutmaster,代码行数:20,代码来源:ImportSelectFile.java

示例7: uploadFailed

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:14,代码来源:DbRestorer.java

示例8: uploadFailed

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
@Override
public void uploadFailed(final FailedEvent event) {
    close();
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:5,代码来源:UploadInfoWindow.java

示例9: uploadFailed

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
@Override
public void uploadFailed(final FailedEvent event) {
	result.setValue(counter.getLineBreakCount()
			+ " (Recuento Interrumpido al "
			+ Math.round(100 * progressBar.getValue()) + "%)");
}
 
开发者ID:damiancom,项目名称:garantia,代码行数:7,代码来源:UploadInfoWindow.java

示例10: uploadFailed

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
@Override
public void uploadFailed(final FailedEvent event) {
    LOG.info("Upload failed for file :{} due to {}", event.getFilename(), event.getReason());
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:5,代码来源:BulkUploadHandler.java

示例11: uploadFailed

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
public void uploadFailed(FailedEvent event) {
  for (FailedListener failedListener : failedListeners) {
    failedListener.uploadFailed(event);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:6,代码来源:UploadComponent.java

示例12: afterUploadFailed

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
public void afterUploadFailed(FailedEvent event) {
}
 
开发者ID:nyholmniklas,项目名称:vaadinInvoiceGenerator,代码行数:3,代码来源:UploadComponent.java

示例13: CanvasImport

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
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());
}
 
开发者ID:alternativeTime,项目名称:GlycanBuilderVaadin7Version,代码行数:53,代码来源:VaadinGlycanCanvas.java

示例14: uploadFailed

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
public void uploadFailed(FailedEvent event) {
	Notification.show("Upload failed: " + event.getReason());
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:4,代码来源:UploadProjectPanel.java

示例15: uploadFailed

import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
@Override
public void uploadFailed(FailedEvent event) {
	System.err.println("Upload failed: releasing the R Session.");
	R.releaseRConnection();
	rc = null;
}
 
开发者ID:avirkki,项目名称:RVaadin,代码行数:7,代码来源:RUpload.java


注:本文中的com.vaadin.ui.Upload.FailedEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。