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 givenConsumer
as notificationNotifications.CloseEvent
listener.int
getDelay()
getType()
boolean
void
setActionTarget
(String actionId) Sets that notification should be shown when action with idactionId
is performed.void
setButtonTarget
(String buttonId) Sets that notification should be shown when button with idactionId
is clicked.void
setCaption
(String caption) Sets notification caption.void
setCaptionProvider
(Supplier<String> captionProvider) Sets the givenSupplier
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
(String description) Sets notification description.void
setDescriptionProvider
(Supplier<String> descriptionProvider) Sets the givenSupplier
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
(String styleName) Sets notification style name.void
Sets notification type.void
show()
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 idactionId
is 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 idactionId
is 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 givenSupplier
as notification caption provider.- Parameters:
captionProvider
- notification caption provider
-
getCaptionProvider
- Returns:
- notification caption provider
-
setDescriptionProvider
Sets the givenSupplier
as notification description provider.- Parameters:
descriptionProvider
- notification description provider
-
getDescriptionProvider
- Returns:
- notification description provider
-
addCloseListener
Adds the givenConsumer
as notificationNotifications.CloseEvent
listener.- Parameters:
listener
- close event listener- Returns:
- close event subscription
-