本文整理了Java中com.vaadin.ui.Upload.setButtonCaption()
方法的一些代码示例,展示了Upload.setButtonCaption()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Upload.setButtonCaption()
方法的具体详情如下:
包路径:com.vaadin.ui.Upload
类名称:Upload
方法名:setButtonCaption
[英]In addition to the actual file chooser, upload components have button that starts actual upload progress. This method is used to set text in that button.
In case the button text is set to null, the button is hidden. In this case developer must explicitly initiate the upload process with #submitUpload().
In case the Upload is used in immediate mode using #setImmediateMode(boolean), the file choose (html input with type "file") is hidden and only the button with this text is shown.
Note the string given is set as is to the button. HTML formatting is not stripped. Be sure to properly validate your value according to your needs.
[中]除了实际的文件选择器,上传组件还有一个按钮,用于启动实际的上传进度。此方法用于设置该按钮中的文本。
如果按钮文本设置为null,则按钮将隐藏。在这种情况下,开发人员必须使用#submitUpload()显式启动上传过程。
如果使用#setImmediateMode(布尔值)在即时模式下使用上载,则文件选择(类型为“file”的html输入)将隐藏,并且仅显示带有此文本的按钮。
注:给定的字符串按按钮的原样设置。HTML格式没有被剥离。一定要根据你的需要正确地验证你的价值。
代码示例来源:origin: org.activiti/activiti-explorer
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;
}
代码示例来源:origin: org.activiti/activiti-explorer
protected void addUpload() {
this.upload = new Upload(null, receiver);
upload.setButtonCaption(i18nManager.getMessage(Messages.UPLOAD_SELECT));
upload.setImmediate(true);
addComponent(upload);
setComponentAlignment(upload, Alignment.MIDDLE_CENTER);
// register ourselves as listener for upload events
upload.addListener((StartedListener) this);
upload.addListener((FailedListener) this);
upload.addListener((FinishedListener) this);
upload.addListener((ProgressListener) this);
}
代码示例来源:origin: org.activiti/activiti-explorer
protected void addUpload() {
this.upload = new Upload(null, receiver);
upload.setButtonCaption(i18nManager.getMessage(Messages.UPLOAD_SELECT));
upload.setImmediate(true);
addComponent(upload);
setComponentAlignment(upload, Alignment.MIDDLE_CENTER);
// register ourselves as listener for upload events
upload.addListener((StartedListener) this);
upload.addListener((FailedListener) this);
upload.addListener((FinishedListener) this);
upload.addListener((ProgressListener) this);
}
代码示例来源:origin: org.aperteworkflow/base-widgets
public FileUploadComponent(I18NSource i18NSource) {
this.i18NSource = i18NSource;
uploadFile.addStyleName("default");
uploadFile.setButtonCaption(i18NSource.getMessage(UPLOAD_START));
uploadFile.addListener((FailedListener) this);
uploadFile.addListener((FinishedListener) this);
uploadFile.addListener((ProgressListener) this);
uploadFile.addListener((StartedListener) this);
uploadFile.addListener((SucceededListener) this);
mainPanel.setMargin(true);
initView();
setCompositionRoot(mainPanel);
}
代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui
void buildLayout() {
final HorizontalLayout horizontalLayout = new HorizontalLayout();
upload = new Upload();
upload.setEnabled(false);
upload.setButtonCaption(i18n.getMessage("caption.bulk.upload"));
upload.setReceiver(this);
upload.setImmediate(true);
upload.setWidthUndefined();
upload.addSucceededListener(this);
upload.addFailedListener(this);
upload.addStartedListener(this);
horizontalLayout.addComponent(upload);
horizontalLayout.setComponentAlignment(upload, Alignment.BOTTOM_RIGHT);
setCompositionRoot(horizontalLayout);
}
代码示例来源:origin: eclipse/hawkbit
void buildLayout() {
final HorizontalLayout horizontalLayout = new HorizontalLayout();
upload = new Upload();
upload.setEnabled(false);
upload.setButtonCaption(i18n.getMessage("caption.bulk.upload"));
upload.setReceiver(this);
upload.setImmediate(true);
upload.setWidthUndefined();
upload.addSucceededListener(this);
upload.addFailedListener(this);
upload.addStartedListener(this);
horizontalLayout.addComponent(upload);
horizontalLayout.setComponentAlignment(upload, Alignment.BOTTOM_RIGHT);
setCompositionRoot(horizontalLayout);
}
代码示例来源:origin: org.aperteworkflow/cmis-widget
if (hasPermission("EDIT")) {
Upload upload = new Upload();
upload.setButtonCaption(getI18NSource().getMessage("pt.ext.cmis.list.update.button"));
upload.setReceiver(new UpdateReceiver(doc));
upload.setImmediate(true);
Upload upload = new Upload();
upload.setImmediate(true);
upload.setButtonCaption(getI18NSource().getMessage("pt.ext.cmis.list.upload.button"));
upload.setReceiver(new Upload.Receiver() {
@Override
代码示例来源:origin: nz.co.senanque/madura-workflow-vaadin
public void load(final long pid) {
panel.removeAllComponents();
final Upload upload = new Upload(null, receiver);
upload.setImmediate(true);
upload.setButtonCaption(m_messageSourceAccessor.getMessage("upload.file", "Upload File"));
checkbox = new CheckBox(m_messageSourceAccessor.getMessage("upload.protected", "Protected"));
comment = new TextField(m_messageSourceAccessor.getMessage("upload.comment", "Comment"));
panel.addComponent(comment);
panel.addComponent(checkbox);
panel.addComponent(upload);
upload.addFinishedListener(new Upload.FinishedListener() {
private static final long serialVersionUID = 1L;
public void uploadFinished(FinishedEvent event) {
Attachment attachment = receiver.getWrapper().getCurrentAttachment();
attachment.setProcessInstanceId(pid);
attachment.setComment((String)comment.getValue());
attachment.setProtectedDocument((boolean)checkbox.getValue());
m_workflowDAO.addAttachment(attachment);
close();
}
});
if (getParent() == null) {
UI.getCurrent().addWindow(this);
this.center();
}
}
public void close() {
内容来源于网络,如有侵权,请联系作者删除!