public class NotificationFacetImpl extends AbstractFacet implements NotificationFacet
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
actionId |
protected java.lang.String |
buttonId |
protected java.lang.String |
caption |
protected java.util.function.Supplier<java.lang.String> |
captionProvider |
protected java.util.List<java.util.function.Consumer<Notifications.CloseEvent>> |
closeListeners |
protected ContentMode |
contentMode |
protected int |
delayMs |
protected java.lang.String |
description |
protected java.util.function.Supplier<java.lang.String> |
descriptionProvider |
protected boolean |
htmlSanitizerEnabled |
protected Notifications.Position |
position |
protected java.lang.String |
styleName |
protected Notifications.NotificationType |
type |
id, owner
Constructor and Description |
---|
NotificationFacetImpl() |
Modifier and Type | Method and Description |
---|---|
io.jmix.core.common.event.Subscription |
addCloseListener(java.util.function.Consumer<Notifications.CloseEvent> listener)
Adds the given
Consumer as notification Notifications.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() |
protected void |
internalRemoveCloseListener(java.util.function.Consumer<Notifications.CloseEvent> listener) |
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 |
setOwner(Frame owner)
|
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.
|
protected void |
subscribe() |
protected void |
subscribeOnAction(Frame owner) |
protected void |
subscribeOnButton(Frame owner) |
getEventHub, getId, getOwner, hasSubscriptions, publish, setId, unsubscribe
protected java.lang.String caption
protected java.lang.String description
protected int delayMs
protected java.lang.String styleName
protected Notifications.NotificationType type
protected ContentMode contentMode
protected Notifications.Position position
protected java.util.function.Supplier<java.lang.String> captionProvider
protected java.util.function.Supplier<java.lang.String> descriptionProvider
protected java.util.List<java.util.function.Consumer<Notifications.CloseEvent>> closeListeners
protected java.lang.String actionId
protected java.lang.String buttonId
protected boolean htmlSanitizerEnabled
public void setCaption(@Nullable java.lang.String caption)
NotificationFacet
setCaption
in interface NotificationFacet
caption
- caption@Nullable public java.lang.String getCaption()
getCaption
in interface NotificationFacet
public void setDescription(@Nullable java.lang.String description)
NotificationFacet
setDescription
in interface NotificationFacet
description
- description@Nullable public java.lang.String getDescription()
getDescription
in interface NotificationFacet
public void setType(Notifications.NotificationType type)
NotificationFacet
setType
in interface NotificationFacet
type
- typepublic Notifications.NotificationType getType()
getType
in interface NotificationFacet
public void setDelay(int delayMs)
NotificationFacet
setDelay
in interface NotificationFacet
delayMs
- the desired delay in millisecondspublic int getDelay()
getDelay
in interface NotificationFacet
public void setContentMode(ContentMode contentMode)
NotificationFacet
setContentMode
in interface NotificationFacet
contentMode
- content modepublic ContentMode getContentMode()
getContentMode
in interface NotificationFacet
public void setStyleName(java.lang.String styleName)
NotificationFacet
setStyleName
in interface NotificationFacet
styleName
- style name@Nullable public java.lang.String getStyleName()
getStyleName
in interface NotificationFacet
public void setPosition(Notifications.Position position)
NotificationFacet
setPosition
in interface NotificationFacet
position
- positionpublic Notifications.Position getPosition()
getPosition
in interface NotificationFacet
public io.jmix.core.common.event.Subscription addCloseListener(java.util.function.Consumer<Notifications.CloseEvent> listener)
NotificationFacet
Consumer
as notification Notifications.CloseEvent
listener.addCloseListener
in interface NotificationFacet
listener
- close event listenerprotected void internalRemoveCloseListener(java.util.function.Consumer<Notifications.CloseEvent> listener)
public void setCaptionProvider(@Nullable java.util.function.Supplier<java.lang.String> captionProvider)
NotificationFacet
Supplier
as notification caption provider.setCaptionProvider
in interface NotificationFacet
captionProvider
- notification caption provider@Nullable public java.util.function.Supplier<java.lang.String> getCaptionProvider()
getCaptionProvider
in interface NotificationFacet
public void setDescriptionProvider(@Nullable java.util.function.Supplier<java.lang.String> descriptionProvider)
NotificationFacet
Supplier
as notification description provider.setDescriptionProvider
in interface NotificationFacet
descriptionProvider
- notification description provider@Nullable public java.util.function.Supplier<java.lang.String> getDescriptionProvider()
getDescriptionProvider
in interface NotificationFacet
@Nullable public java.lang.String getActionTarget()
getActionTarget
in interface NotificationFacet
public void setActionTarget(@Nullable java.lang.String actionId)
NotificationFacet
actionId
is performed.setActionTarget
in interface NotificationFacet
actionId
- action id@Nullable public java.lang.String getButtonTarget()
getButtonTarget
in interface NotificationFacet
public void setButtonTarget(@Nullable java.lang.String buttonId)
NotificationFacet
actionId
is clicked.setButtonTarget
in interface NotificationFacet
buttonId
- button idpublic void setHtmlSanitizerEnabled(boolean htmlSanitizerEnabled)
NotificationFacet
setHtmlSanitizerEnabled
in interface NotificationFacet
htmlSanitizerEnabled
- specifies whether html sanitizer is enabledpublic boolean isHtmlSanitizerEnabled()
isHtmlSanitizerEnabled
in interface NotificationFacet
public void setOwner(@Nullable Frame owner)
Facet
setOwner
in interface Facet
setOwner
in class AbstractFacet
owner
- owner framepublic void show()
NotificationFacet
show
in interface NotificationFacet
protected void subscribe()
protected void subscribeOnAction(Frame owner)
protected void subscribeOnButton(Frame owner)