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


Java FinishedEvent类代码示例

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


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

示例1: test

import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的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

示例2: initChangePictureButton

import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
protected Upload initChangePictureButton() {
  final Upload changePictureUpload = new Upload();
  changePictureUpload.setImmediate(true);
  changePictureUpload.setButtonCaption(i18nManager.getMessage(Messages.PROFILE_CHANGE_PICTURE));
  
  final InMemoryUploadReceiver receiver = initPictureReceiver(changePictureUpload);
  changePictureUpload.addListener(new FinishedListener() {
    private static final long serialVersionUID = 1L;
    public void uploadFinished(FinishedEvent event) {
      if (!receiver.isInterruped()) {
        picture = new Picture(receiver.getBytes(), receiver.getMimeType());
        identityService.setUserPicture(userId, picture);
        
        // reset picture
        imageLayout.removeAllComponents();
        initPicture();
      } else {
        receiver.reset();
      }
    }
  });
  
  return changePictureUpload;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:25,代码来源:ProfilePanel.java

示例3: uploadFinished

import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
@Override
public void uploadFinished(final FinishedEvent event) {
	state.setValue("Finalizado");
	progressBar.setVisible(false);
	textualProgress.setVisible(false);
	cancelButton.setVisible(false);
}
 
开发者ID:damiancom,项目名称:garantia,代码行数:8,代码来源:UploadInfoWindow.java

示例4: uploadFinished

import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
/**
 * Upload finished for {@link Upload} variant. Both for good and error
 * variant.
 *
 * @see com.vaadin.ui.Upload.FinishedListener#uploadFinished(com.vaadin.ui.Upload.FinishedEvent)
 */
@Override
public void uploadFinished(final FinishedEvent event) {
    LOG.debug("Upload finished for file :{}", event.getFilename());
    eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_FINISHED,
            new UploadFileStatus(event.getFilename())));
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:13,代码来源:UploadHandler.java

示例5: uploadFinished

import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
public void uploadFinished(FinishedEvent event) {
  // Hide progress indicator
  progressIndicator.setVisible(false);
  for (FinishedListener finishedListener : finishedListeners) {
    finishedListener.uploadFinished(event);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:8,代码来源:UploadComponent.java

示例6: UploadPopupWindow

import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
public UploadPopupWindow(String caption, String description, Receiver receiver) {
  this.i18nManager = ExplorerApp.get().getI18nManager();
  
  init(caption, description, receiver);
  
  uploadComponent.addFinishedListener(new FinishedListener() {
    
    private static final long serialVersionUID = 1L;

    public void uploadFinished(FinishedEvent event) {
      close();
    }
  });
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:15,代码来源:UploadPopupWindow.java

示例7: uploadFinishedEvent

import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
public void uploadFinishedEvent(FinishedEvent event) {
	try {
		setValue(uploadField.getValue());
		fileName = event.getFilename();
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:alejandro-du,项目名称:enterprise-app,代码行数:9,代码来源:DownloadField.java

示例8: uploadFinished

import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
@Override
public void uploadFinished(FinishedEvent event) {
	setComponentsToVisible(false);
	Window.removeFromParent(this);
	indexerService.startIndexer();
	new Notification("Finished upload" + event.getFilename(), null, //$NON-NLS-1$
			Notification.Type.TRAY_NOTIFICATION).show(Page.getCurrent());
	callback.onUploadFinished();
	
}
 
开发者ID:mwolski89,项目名称:own-music-cloud,代码行数:11,代码来源:MusicUploader.java

示例9: uploadFinished

import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
@Override
public void uploadFinished(final FinishedEvent event) {
    this.progressBar.setVisible(false);
    this.bytesProcessed.setVisible(false);
    this.cancelButton.setVisible(false);
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:7,代码来源:UploadInfoWindow.java

示例10: initFileUpload

import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
protected void initFileUpload() {
  uploadComponent = new UploadComponent(null, new Receiver() {
    private static final long serialVersionUID = 1L;
    
    public OutputStream receiveUpload(String filename, String mType) {
      fileName = filename;
      
      // Try extracting the extention as well, and append it to the mime-type
      String extention = extractExtention(filename);
      if(extention != null) {
        mimeType = mType + MIME_TYPE_EXTENTION_SPLIT_CHAR + extention;
      } else {
        mimeType = mType;
      }
      
      // TODO: Refactor, don't use BAOS!!
      byteArrayOutputStream = new ByteArrayOutputStream();
      return byteArrayOutputStream;
    }
  });
  
  uploadComponent.addFinishedListener(new FinishedListener() {
    
    private static final long serialVersionUID = 1L;

    public void uploadFinished(FinishedEvent event) {
      // Update UI
      if(getAttachmentName() == null || "".equals(getAttachmentName())) {
        setAttachmentName(getFriendlyName(fileName));
      }
      
      fileUploaded = true;
      successIndicator.setVisible(true);
      successIndicator.setCaption(i18nManager.getMessage(Messages.RELATED_CONTENT_TYPE_FILE_UPLOADED, fileName));
      form.setComponentError(null);
    }
  });
  
  addComponent(uploadComponent);
  setExpandRatio(uploadComponent, 1.0f);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:42,代码来源:FileAttachmentEditorComponent.java

示例11: uploadFinished

import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
public void uploadFinished(FinishedEvent event) {
  deployUploadedFile();
  if (validFile) {
    showUploadedDeployment();
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:7,代码来源:DeploymentUploadReceiver.java

示例12: uploadFinished

import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
@Override
public void uploadFinished(FinishedEvent event) {
    processingLayout.setVisible(false);
}
 
开发者ID:nyholmniklas,项目名称:vaadinInvoiceGenerator,代码行数:5,代码来源:UploadComponent.java

示例13: createDownloadableField

import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
/**
 * Creates a field to download/upload a file.
 * @param bean bean to which the field belongs.
 * @param pid property name.
 * @param uiContext the component where the field is presented.
 * @param downloadableAnnotation
 * @return a new download/upload field for the specified property.
 * @throws SecurityException
 * @throws NoSuchMethodException
 */
public Field createDownloadableField(final Object bean, final String pid, Component uiContext, final Downloadable downloadableAnnotation) throws SecurityException, NoSuchMethodException {
	DownloadField field = null;
	
	if(downloadableAnnotation != null) {
		String capitalizedFileNameField = downloadableAnnotation.propertyFileName().substring(0, 1).toUpperCase() + downloadableAnnotation.propertyFileName().substring(1, downloadableAnnotation.propertyFileName().length());
		
		final Method setFileNameMethod = bean.getClass().getMethod("set" + capitalizedFileNameField, String.class);
		final Method getFileNameMethod = bean.getClass().getMethod("get" + capitalizedFileNameField, (Class<?>[]) null);
		
		field = new DownloadField(EnterpriseApplication.getInstance()) {
			private static final long serialVersionUID = 1L;
			
			@Override
			public void uploadFinishedEvent(FinishedEvent event) {
				super.uploadFinishedEvent(event);
				try {
					setFileNameMethod.invoke(bean, event.getFilename());
					
				} catch (IllegalArgumentException e) {
					throw new RuntimeException(e);
				} catch (IllegalAccessException e) {
					throw new RuntimeException(e);
				} catch (InvocationTargetException e) {
					throw new RuntimeException(e);
				}
			}
			
			@Override
			public String getFileName() {
				String name = "file";
				try {
					name = getFileNameMethod.invoke(bean, (Object[]) null) + downloadableAnnotation.fileNameSufix();
					
				} catch (IllegalArgumentException e) {
					throw new RuntimeException(e);
				} catch (IllegalAccessException e) {
					throw new RuntimeException(e);
				} catch (InvocationTargetException e) {
					throw new RuntimeException(e);
				}
				
				return name;
			}
		};
	}
	
	return field;
}
 
开发者ID:alejandro-du,项目名称:enterprise-app,代码行数:59,代码来源:DefaultCrudFieldFactory.java


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