本文整理汇总了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());
}
示例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;
}
示例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);
}
示例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())));
}
示例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);
}
}
示例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();
}
});
}
示例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);
}
}
示例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();
}
示例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);
}
示例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);
}
示例11: uploadFinished
import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
public void uploadFinished(FinishedEvent event) {
deployUploadedFile();
if (validFile) {
showUploadedDeployment();
}
}
示例12: uploadFinished
import com.vaadin.ui.Upload.FinishedEvent; //导入依赖的package包/类
@Override
public void uploadFinished(FinishedEvent event) {
processingLayout.setVisible(false);
}
示例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;
}