public class Notification extends BaseDominoElement<elemental2.dom.HTMLDivElement,Notification> implements org.jboss.elemento.IsElement<elemental2.dom.HTMLDivElement>
Customize the component can be done by overwriting classes provided by NotificationStyles
For example:
Notification.createSuccess("Everything is okay");
BaseDominoElement| Modifier and Type | Class and Description |
|---|---|
static interface |
Notification.CloseHandler
functional interface to handle close event
|
static interface |
Notification.Position
An interface for the required API to implement new position classes for notifications
|
BaseDominoElement.ElementHandler<T>, BaseDominoElement.ResizeHandler<T>, BaseDominoElement.StyleEditor<E extends elemental2.dom.HTMLElement,T extends org.jboss.elemento.IsElement<E>>, BaseDominoElement.WavesStyler| Modifier and Type | Field and Description |
|---|---|
static Notification.Position |
BOTTOM_CENTER
Bottom center position
|
static Notification.Position |
BOTTOM_LEFT
Bottom left position
|
static Notification.Position |
BOTTOM_RIGHT
Bottom right position
|
static Notification.Position |
TOP_CENTER
Top center position
|
static Notification.Position |
TOP_LEFT
Top left position
|
static Notification.Position |
TOP_RIGHT
Top right position
|
| Constructor and Description |
|---|
Notification() |
| Modifier and Type | Method and Description |
|---|---|
Notification |
addCloseHandler(Notification.CloseHandler closeHandler)
Add a handler to be called when a notification is closed
|
Notification |
appendContent(elemental2.dom.Node content)
Appends any kind of content to the notification body.
|
void |
close()
Closes the notification based on the applied notification position and apply the close
animation.
|
void |
close(int after)
Closes the notification based on the applied notification position and apply the close
animation after the specified duration.
|
static Notification |
create(String message)
Creates a notification for the message with no specific type and default black bacjground.
|
static Notification |
create(String message,
String type)
Creates a notification for the message with the specified type/style
|
static Notification |
createDanger(String message)
Creates a notification with danger style (red background) indicating a failed operation.
|
static Notification |
createInfo(String message)
Creates a notification with success style (green background) to informative message.
|
static Notification |
createSuccess(String message)
Creates a notification with success style (green background) indicating a success operation.
|
static Notification |
createWarning(String message)
Creates a notification with success style (green background) to show warnings.
|
Notification |
duration(int duration)
for none infinite notifications, the duration defined how long the notification will remain
visible after the show transition is completed before it is automatically closed.
|
elemental2.dom.HTMLDivElement |
element() |
DominoElement<elemental2.dom.HTMLButtonElement> |
getCloseButton() |
List<Notification.CloseHandler> |
getCloseHandlers() |
Notification |
inTransition(Transition inTransition)
Defines the animation transition to be applied to show up the notification when
show() is called. |
boolean |
isClosable() |
boolean |
isInfinite() |
Notification |
outTransition(Transition outTransition)
Defines the animation transition to be applied to close up the notification when
close() is called, or the duration ends. |
Notification |
removeCloseHandler(Notification.CloseHandler closeHandler)
Removes a
Notification.CloseHandler from the currently existing close handlers. |
Notification |
setBackground(Color background)
Apply a custom background color to the notification.
|
Notification |
setClosable(boolean closable)
Use to show or hide the close button.
|
Notification |
setInfinite(boolean infinite)
When true, duration will be ignored, and the notification will only close if the
close() is called or close button is clicked. |
Notification |
setMessage(String message)
The text content of the notification
|
Notification |
setPosition(Notification.Position position)
Defines the location in which the notification will show up when
show() is
called. |
Notification |
setType(String type)
Sets specified type/style
|
Notification |
show()
Show up the notification and apply the IN transtion animation.
|
add, add, addClickListener, addCss, addCss, addEventListener, addEventListener, addEventsListener, addHideListener, addShowListener, alignCenter, alignRight, appendChild, appendChild, apply, attr, blur, childNodes, clearElement, contains, contains, contains, containsCss, css, css, cssClassByIndex, cssClassesCount, cssText, disable, elevate, elevate, enable, firstChild, getAttachObserver, getAttribute, getBoundingClientRect, getChildElementCount, getClickableElement, getCollapsible, getCollapsibleElement, getDetachObserver, getDominoId, getElementsCount, getElevation, getFirstChild, getId, getTextContent, getTooltip, getWavesElement, hasAttribute, hasChildNodes, hasDirectChild, hide, hideOn, id, init, insertAfter, insertAfter, insertAfter, insertAfter, insertBefore, insertBefore, insertBefore, insertBefore, insertFirst, insertFirst, insertFirst, isAttached, isCollapsed, isDisabled, isEmptyElement, isEqualNode, isForceHidden, isHidden, isReadOnly, item, lastChild, length, onAttached, onDetached, onResize, pullLeft, pullRight, querySelector, querySelectorAll, remove, removeAttachObserver, removeAttribute, removeChild, removeChild, removeCss, removeCss, removeCssProperty, removeDetachObserver, removeEventListener, removeEventListener, removeHideListener, removeHideOn, removeShowListener, removeShowOn, removeTooltip, removeWaves, replaceCss, setAlignItems, setAttribute, setAttribute, setAttribute, setBackgroundColor, setBackgroundColor, setBorder, setBorderColor, setBottom, setBottom, setBoxShadow, setCollapseStrategy, setColor, setColor, setContent, setContent, setCssProperty, setCssProperty, setCursor, setCursor, setDisabled, setDisplay, setDisplay, setDropMenu, setFlex, setFloat, setFloat, setFontSize, setFontSize, setForceHidden, setHeight, setHeight, setId, setInnerHtml, setLeft, setLeft, setLineHeight, setLineHeight, setMargin, setMargin, setMarginBottom, setMarginBottom, setMarginLeft, setMarginLeft, setMarginRight, setMarginRight, setMarginTop, setMarginTop, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setOpacity, setOpacity, setOverFlow, setOverFlow, setOverFlowY, setPadding, setPadding, setPaddingBottom, setPaddingBottom, setPaddingLeft, setPaddingLeft, setPaddingRight, setPaddingRight, setPaddingTop, setPaddingTop, setPointerEvents, setPosition, setPosition, setReadOnly, setRight, setRight, setTabIndex, setTextAlign, setTextAlign, setTextContent, setTooltip, setTooltip, setTooltip, setTooltip, setTop, setTop, setTransitionDuration, setWidth, setWidth, setZIndex, showOn, style, style, styler, textContent, toggleDisplay, toggleDisplay, withWaves, withWavesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisExpandedadd, add, remove, remove, removeProperty, replace, setProperty, setPropertypublic static final Notification.Position TOP_LEFT
public static final Notification.Position TOP_CENTER
public static final Notification.Position TOP_RIGHT
public static final Notification.Position BOTTOM_LEFT
public static final Notification.Position BOTTOM_CENTER
public static final Notification.Position BOTTOM_RIGHT
public static Notification createDanger(String message)
message - the content messageNotificationpublic static Notification createSuccess(String message)
message - the content messageNotificationpublic static Notification createWarning(String message)
message - the content messageNotificationpublic static Notification createInfo(String message)
message - the content messageNotificationpublic static Notification create(String message, String type)
message - the content messagetype - the style to be applied on the notification, predefined types ,,,Notificationpublic static Notification create(String message)
message - the content messageNotificationpublic DominoElement<elemental2.dom.HTMLButtonElement> getCloseButton()
DominoElement the close button of the notification.public Notification setClosable(boolean closable)
Notificationpublic boolean isClosable()
public Notification duration(int duration)
duration - in millisecondNotificationpublic Notification inTransition(Transition inTransition)
show() is called.inTransition - TransitionNotificationpublic Notification outTransition(Transition outTransition)
close() is called, or the duration ends.outTransition - TransitionNotificationpublic Notification setMessage(String message)
message - the content messageNotificationpublic Notification setType(String type)
type - the style to be applied on the notification, predefined types ,,,Notificationpublic Notification appendContent(elemental2.dom.Node content)
content - NodeNotificationpublic Notification setPosition(Notification.Position position)
show() is
called.position - Notification.PositionNotificationpublic Notification setBackground(Color background)
background - ColorNotificationpublic Notification setInfinite(boolean infinite)
close() is called or close button is clicked.infinite - true to close manually only, false otherwiseNotificationpublic boolean isInfinite()
public Notification show()
show in interface IsCollapsible<Notification>show in class BaseDominoElement<elemental2.dom.HTMLDivElement,Notification>NotificationCollapsible.show()public final void close()
public final void close(int after)
after - time to wait before starting the close animation in millisecondspublic List<Notification.CloseHandler> getCloseHandlers()
Notification.CloseHandler to be called when a notification is closed.public Notification addCloseHandler(Notification.CloseHandler closeHandler)
closeHandler - Notification.CloseHandlerNotificationpublic Notification removeCloseHandler(Notification.CloseHandler closeHandler)
Notification.CloseHandler from the currently existing close handlers.closeHandler - A Notification.CloseHandlerNotificationpublic elemental2.dom.HTMLDivElement element()
element in interface org.jboss.elemento.IsElement<elemental2.dom.HTMLDivElement>element in class BaseDominoElement<elemental2.dom.HTMLDivElement,Notification>HTMLDivElement the root element that represent this notification instance.Copyright © 2019–2022 Dominokit. All rights reserved.