@StudioFacet(xmlElement="notification", caption="Notification", description="Prepares and shows notifications", defaultProperty="caption", category="Facets", icon="icon/notification.svg", documentationURL="https://doc.cuba-platform.com/manual-%VERSION%/gui_NotificationFacet.html") public interface NotificationFacet extends Facet
Modifier and Type | Interface and Description |
---|---|
static class |
NotificationFacet.CloseEvent
Event that is fired when notification is closed.
|
Modifier and Type | Method and Description |
---|---|
Subscription |
addCloseListener(java.util.function.Consumer<NotificationFacet.CloseEvent> listener)
Adds the given
Consumer as notification NotificationFacet.CloseEvent listener. |
java.lang.String |
getActionTarget() |
java.lang.String |
getButtonTarget() |
java.lang.String |
getCaption() |
java.util.function.Supplier<java.lang.String> |
getCaptionProvider() |
ContentMode |
getContentMode() |
int |
getDelay() |
java.lang.String |
getDescription() |
java.util.function.Supplier<java.lang.String> |
getDescriptionProvider() |
Notifications.Position |
getPosition() |
java.lang.String |
getStyleName() |
Notifications.NotificationType |
getType() |
boolean |
isHtmlSanitizerEnabled() |
void |
setActionTarget(java.lang.String actionId)
Sets that notification should be shown when action with id
actionId
is performed. |
void |
setButtonTarget(java.lang.String buttonId)
Sets that notification should be shown when button with id
actionId
is clicked. |
void |
setCaption(java.lang.String caption)
Sets notification caption.
|
void |
setCaptionProvider(java.util.function.Supplier<java.lang.String> captionProvider)
Sets the given
Supplier as notification caption provider. |
void |
setContentMode(ContentMode contentMode)
Sets notification content mode.
|
void |
setDelay(int delayMs)
Sets the delay before the notification disappears.
|
void |
setDescription(java.lang.String description)
Sets notification description.
|
void |
setDescriptionProvider(java.util.function.Supplier<java.lang.String> descriptionProvider)
Sets the given
Supplier as notification description provider. |
void |
setHtmlSanitizerEnabled(boolean htmlSanitizerEnabled)
Sets whether html sanitizer is enabled or not for notification content.
|
void |
setPosition(Notifications.Position position)
Sets notification position.
|
void |
setStyleName(java.lang.String styleName)
Sets notification style name.
|
void |
setType(Notifications.NotificationType type)
Sets notification type.
|
void |
show()
Shows notification.
|
@StudioProperty(type=LOCALIZED_STRING) void setCaption(java.lang.String caption)
caption
- captionjava.lang.String getCaption()
@StudioProperty(type=LOCALIZED_STRING) void setDescription(java.lang.String description)
description
- descriptionjava.lang.String getDescription()
@StudioProperty @PositiveOrZero void setDelay(int delayMs)
delayMs
- the desired delay in millisecondsint getDelay()
@StudioProperty(type=ENUMERATION, defaultValue="HUMANIZED") void setType(Notifications.NotificationType type)
type
- typeNotifications.NotificationType getType()
@StudioProperty(type=ENUMERATION, defaultValue="TEXT", options={"HTML","TEXT"}) void setContentMode(ContentMode contentMode)
contentMode
- content modeContentMode getContentMode()
@StudioProperty(type=STRING) void setStyleName(java.lang.String styleName)
styleName
- style namejava.lang.String getStyleName()
@StudioProperty void setPosition(Notifications.Position position)
position
- positionNotifications.Position getPosition()
java.lang.String getActionTarget()
@StudioProperty(name="onAction", type=COMPONENT_REF, options="com.haulmont.cuba.gui.components.Action") void setActionTarget(java.lang.String actionId)
actionId
is performed.actionId
- action idjava.lang.String getButtonTarget()
@StudioProperty(name="onButton", type=COMPONENT_REF, options="com.haulmont.cuba.gui.components.Button") void setButtonTarget(java.lang.String buttonId)
actionId
is clicked.buttonId
- button id@StudioProperty(type=BOOLEAN) void setHtmlSanitizerEnabled(boolean htmlSanitizerEnabled)
htmlSanitizerEnabled
- specifies whether html sanitizer is enabledboolean isHtmlSanitizerEnabled()
void show()
void setCaptionProvider(java.util.function.Supplier<java.lang.String> captionProvider)
Supplier
as notification caption provider.captionProvider
- notification caption providerjava.util.function.Supplier<java.lang.String> getCaptionProvider()
void setDescriptionProvider(java.util.function.Supplier<java.lang.String> descriptionProvider)
Supplier
as notification description provider.descriptionProvider
- notification description providerjava.util.function.Supplier<java.lang.String> getDescriptionProvider()
Subscription addCloseListener(java.util.function.Consumer<NotificationFacet.CloseEvent> listener)
Consumer
as notification NotificationFacet.CloseEvent
listener.listener
- close event listener