Package io.jmix.ui.component
Interface NotificationFacet
- All Superinterfaces:
Facet
- All Known Implementing Classes:
NotificationFacetImpl
@StudioFacet(xmlElement="notification",
caption="Notification",
description="Prepares and shows notifications",
defaultProperty="caption",
category="Facets",
icon="io/jmix/ui/icon/facet/notification.svg",
documentationURL="https://docs.jmix.io/jmix/%VERSION%/ui/facets/notification-facet.html")
public interface NotificationFacet
extends Facet
Prepares and shows notifications.
-
Method Summary
Modifier and TypeMethodDescriptionaddCloseListener(Consumer<Notifications.CloseEvent> listener) Adds the givenConsumeras notificationNotifications.CloseEventlistener.intgetDelay()getType()booleanvoidsetActionTarget(String actionId) Sets that notification should be shown when action with idactionIdis performed.voidsetButtonTarget(String buttonId) Sets that notification should be shown when button with idactionIdis clicked.voidsetCaption(String caption) Sets notification caption.voidsetCaptionProvider(Supplier<String> captionProvider) Sets the givenSupplieras notification caption provider.voidsetContentMode(ContentMode contentMode) Sets notification content mode.voidsetDelay(int delayMs) Sets the delay before the notification disappears.voidsetDescription(String description) Sets notification description.voidsetDescriptionProvider(Supplier<String> descriptionProvider) Sets the givenSupplieras notification description provider.voidsetHtmlSanitizerEnabled(boolean htmlSanitizerEnabled) Sets whether html sanitizer is enabled or not for notification content.voidsetPosition(Notifications.Position position) Sets notification position.voidsetStyleName(String styleName) Sets notification style name.voidSets notification type.voidshow()Shows notification.
-
Method Details
-
setCaption
Sets notification caption.- Parameters:
caption- caption
-
getCaption
- Returns:
- notification caption
-
setDescription
Sets notification description.- Parameters:
description- description
-
getDescription
- Returns:
- notification description
-
setDelay
Sets the delay before the notification disappears.- Parameters:
delayMs- the desired delay in milliseconds
-
getDelay
int getDelay()- Returns:
- the delay before the notification disappears
-
setType
@StudioProperty(type=ENUMERATION, defaultValue="HUMANIZED") void setType(Notifications.NotificationType type) Sets notification type.- Parameters:
type- type
-
getType
Notifications.NotificationType getType()- Returns:
- notification type
-
setContentMode
@StudioProperty(type=ENUMERATION, defaultValue="TEXT", options={"HTML","TEXT"}) void setContentMode(ContentMode contentMode) Sets notification content mode.- Parameters:
contentMode- content mode
-
getContentMode
ContentMode getContentMode()- Returns:
- notification content mode
-
setStyleName
Sets notification style name.- Parameters:
styleName- style name
-
getStyleName
- Returns:
- notification style name
-
setPosition
@StudioProperty(type=ENUMERATION, defaultValue="DEFAULT") void setPosition(Notifications.Position position) Sets notification position.- Parameters:
position- position
-
getPosition
Notifications.Position getPosition()- Returns:
- notification position
-
getActionTarget
- Returns:
- id of action that triggers notification
-
setActionTarget
@StudioProperty(name="onAction", type=COMPONENT_REF, options="io.jmix.ui.action.Action") void setActionTarget(@Nullable String actionId) Sets that notification should be shown when action with idactionIdis performed.- Parameters:
actionId- action id
-
getButtonTarget
- Returns:
- id of button that triggers notification
-
setButtonTarget
@StudioProperty(name="onButton", type=COMPONENT_REF, options="io.jmix.ui.component.Button") void setButtonTarget(@Nullable String buttonId) Sets that notification should be shown when button with idactionIdis clicked.- Parameters:
buttonId- button id
-
setHtmlSanitizerEnabled
@StudioProperty(type=BOOLEAN, defaultValue="true") void setHtmlSanitizerEnabled(boolean htmlSanitizerEnabled) Sets whether html sanitizer is enabled or not for notification content.- Parameters:
htmlSanitizerEnabled- specifies whether html sanitizer is enabled
-
isHtmlSanitizerEnabled
boolean isHtmlSanitizerEnabled()- Returns:
- html sanitizer is enabled for notification content
-
show
void show()Shows notification. -
setCaptionProvider
Sets the givenSupplieras notification caption provider.- Parameters:
captionProvider- notification caption provider
-
getCaptionProvider
- Returns:
- notification caption provider
-
setDescriptionProvider
Sets the givenSupplieras notification description provider.- Parameters:
descriptionProvider- notification description provider
-
getDescriptionProvider
- Returns:
- notification description provider
-
addCloseListener
Adds the givenConsumeras notificationNotifications.CloseEventlistener.- Parameters:
listener- close event listener- Returns:
- close event subscription
-