本文整理了Java中com.vaadin.ui.Notification.setCaption()
方法的一些代码示例,展示了Notification.setCaption()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Notification.setCaption()
方法的具体详情如下:
包路径:com.vaadin.ui.Notification
类名称:Notification
方法名:setCaption
[英]Sets the caption part of the notification message.
[中]
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Creates a notification message of the specified type, with a bigger
* caption and smaller description.
*
* Care should be taken to to avoid XSS vulnerabilities if html is allowed.
*
* @param caption
* The message caption
* @param description
* The message description
* @param type
* The type of message
* @param htmlContentAllowed
* Whether html in the caption and description should be
* displayed as html or as plain text
*/
public Notification(String caption, String description, Type type,
boolean htmlContentAllowed) {
registerRpc(rpc);
setCaption(caption);
setDescription(description);
setHtmlContentAllowed(htmlContentAllowed);
setType(type);
}
代码示例来源:origin: com.holon-platform.vaadin7/holon-vaadin
@Override
public void validationStatusChange(ValidationStatusEvent<?> statusChangeEvent) {
if (statusChangeEvent.isInvalid()) {
String error = showAllErrors
? statusChangeEvent.getErrorMessages().stream().collect(Collectors.joining("<br/>"))
: statusChangeEvent.getErrorMessage();
if (error == null || error.trim().equals("")) {
error = "Validation error";
}
if (notification != null) {
notification.setCaption(error);
notification.show(Page.getCurrent());
} else {
Notification.show(error, Type.ERROR_MESSAGE);
}
}
}
代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin
@Override
public void validationStatusChange(ValidationStatusEvent<?> statusChangeEvent) {
if (statusChangeEvent.isInvalid()) {
String error = showAllErrors
? statusChangeEvent.getErrorMessages().stream().collect(Collectors.joining("<br/>"))
: statusChangeEvent.getErrorMessage();
if (error == null || error.trim().equals("")) {
error = "Validation error";
}
if (notification != null) {
notification.setCaption(error);
notification.show(Page.getCurrent());
} else {
Notification.show(error, Type.ERROR_MESSAGE);
}
}
}
代码示例来源:origin: OpenNMS/opennms
/**
* Method for displaying notification for the user.
*
* @param message the message to be displayed
* @param description the description of this message
*/
public void notifyMessage(String message, String description) {
final Notification notification = new Notification("Message", Notification.Type.TRAY_NOTIFICATION);
notification.setCaption(message);
notification.setDescription(description);
notification.setDelayMsec(1000);
if (getUI() != null) {
if (getPage() != null) {
notification.show(getUI().getPage());
}
}
}
}
代码示例来源:origin: OpenNMS/opennms
/**
* Method for displaying notification for the user.
*
* @param message the message to be displayed
* @param description the description of this message
* @param type the type of this notification
*/
public void notifyMessage(String message, String description, Notification.Type type) {
Notification notification = new Notification("Message", type);
notification.setCaption(message);
notification.setDescription(description);
notification.setDelayMsec(1000);
if (getUI() != null) {
if (getPage() != null) {
notification.show(getUI().getPage());
}
}
}
代码示例来源:origin: org.opennms.features/vaadin-surveillance-views
/**
* Method for displaying notification for the user.
*
* @param message the message to be displayed
* @param description the description of this message
* @param type the type of this notification
*/
public void notifyMessage(String message, String description, Notification.Type type) {
Notification m_notification = new Notification("Message", type);
m_notification.setCaption(message);
m_notification.setDescription(description);
m_notification.setDelayMsec(1000);
if (getUI() != null) {
if (getPage() != null) {
m_notification.show(getUI().getPage());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!