本文整理汇总了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);
}
}
}
}
示例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();
}
示例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());
}
示例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());
}
}
}
示例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);
}
示例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;
});
}
});
}
示例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);
}
}
示例8: uploadFailed
import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
@Override
public void uploadFailed(final FailedEvent event) {
close();
}
示例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()) + "%)");
}
示例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());
}
示例11: uploadFailed
import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
public void uploadFailed(FailedEvent event) {
for (FailedListener failedListener : failedListeners) {
failedListener.uploadFailed(event);
}
}
示例12: afterUploadFailed
import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
public void afterUploadFailed(FailedEvent event) {
}
示例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());
}
示例14: uploadFailed
import com.vaadin.ui.Upload.FailedEvent; //导入依赖的package包/类
public void uploadFailed(FailedEvent event) {
Notification.show("Upload failed: " + event.getReason());
}
示例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;
}