Package io.jmix.flowui
Class Notifications.NotificationBuilder
java.lang.Object
io.jmix.flowui.Notifications.NotificationBuilder
- Enclosing class:
- Notifications
A builder that configures and displays notifications.
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected static final String
protected Boolean
protected static final String
protected com.vaadin.flow.component.Component
protected static final String
protected int
protected String
protected static final String
protected com.vaadin.flow.component.notification.Notification
protected com.vaadin.flow.component.notification.Notification.Position
protected String
protected static final String
protected static final String
protected com.vaadin.flow.component.notification.NotificationVariant
protected String
protected static final String
protected Notifications.Type
protected static final String
-
Constructor Summary
ConstructorDescriptionNotificationBuilder
(com.vaadin.flow.component.Component component) NotificationBuilder
(String text) NotificationBuilder
(String title, String message) -
Method Summary
Modifier and TypeMethodDescriptionprotected Notifications.NotificationBuilder
applyDefaults
(FlowuiComponentProperties properties) com.vaadin.flow.component.notification.Notification
build()
Creates the notification.protected com.vaadin.flow.component.Component
protected String
protected com.vaadin.flow.component.HasComponents
protected com.vaadin.flow.component.button.Button
protected com.vaadin.flow.component.Component
createMessageComponent
(String message) protected com.vaadin.flow.component.notification.Notification
protected com.vaadin.flow.component.HasComponents
protected com.vaadin.flow.component.Component
createTitleComponent
(String title) com.vaadin.flow.component.Component
int
com.vaadin.flow.component.notification.Notification.Position
getText()
com.vaadin.flow.component.notification.NotificationVariant
getTitle()
getType()
boolean
protected boolean
protected void
onCloseButtonClick
(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event) void
show()
Creates and shows the notification.withClassName
(String className) Sets a CSS class name to the notification.withCloseable
(boolean closeable) Sets whether to show the button for closing the notification.withDuration
(int duration) Sets notification duration in milliseconds to show the notification.withPosition
(com.vaadin.flow.component.notification.Notification.Position position) Sets notification position.withThemeVariant
(com.vaadin.flow.component.notification.NotificationVariant themeVariant) Sets a theme variant to the notification.withType
(Notifications.Type type) Sets notification type.
-
Field Details
-
CLOSEABLE_LAYOUT_CLASS_NAME
- See Also:
-
CLOSE_BUTTON_CLASS_NAME
- See Also:
-
TEXT_LAYOUT_CLASS_NAME
- See Also:
-
TITLE_CLASS_NAME
- See Also:
-
MESSAGE_CLASS_NAME
- See Also:
-
TEXT_CONTENT_CLASS_NAME
- See Also:
-
COMPONENT_CONTENT_CLASS_NAME
- See Also:
-
WARNING_THEME_NAME
- See Also:
-
notification
protected com.vaadin.flow.component.notification.Notification notification -
text
-
title
-
message
-
component
protected com.vaadin.flow.component.Component component -
position
protected com.vaadin.flow.component.notification.Notification.Position position -
duration
protected int duration -
type
-
closeable
-
themeVariant
protected com.vaadin.flow.component.notification.NotificationVariant themeVariant -
className
-
-
Constructor Details
-
NotificationBuilder
- Parameters:
text
- notification text
-
NotificationBuilder
- Parameters:
title
- notification titlemessage
- notification message
-
NotificationBuilder
public NotificationBuilder(com.vaadin.flow.component.Component component) - Parameters:
component
- component to show in notification
-
-
Method Details
-
withPosition
public Notifications.NotificationBuilder withPosition(com.vaadin.flow.component.notification.Notification.Position position) Sets notification position.Default position is specified in the
jmix.flowui.component.default-notification-position
property which is MIDDLE by default, seeFlowuiComponentProperties.getDefaultNotificationPosition()
. -
withDuration
Sets notification duration in milliseconds to show the notification. Set to 0 or a negative number to disable the notification auto-closing.Default duration is specified in the
jmix.flowui.component.default-notification-duration
property which is 3000 by default, seeFlowuiComponentProperties.getDefaultNotificationDuration()
. -
withType
Sets notification type. -
withCloseable
Sets whether to show the button for closing the notification. -
withThemeVariant
public Notifications.NotificationBuilder withThemeVariant(com.vaadin.flow.component.notification.NotificationVariant themeVariant) Sets a theme variant to the notification. -
withClassName
Sets a CSS class name to the notification. -
getPosition
public com.vaadin.flow.component.notification.Notification.Position getPosition() -
getDuration
public int getDuration() -
getType
-
isCloseable
public boolean isCloseable() -
getText
-
getTitle
-
getMessage
-
getThemeVariant
@Nullable public com.vaadin.flow.component.notification.NotificationVariant getThemeVariant() -
getClassName
-
getComponent
@Nullable public com.vaadin.flow.component.Component getComponent() -
build
public com.vaadin.flow.component.notification.Notification build()Creates the notification.Use
Notification.open()
to show created notification. -
show
public void show()Creates and shows the notification. -
applyDefaults
-
buildNotificationContent
@Nullable protected com.vaadin.flow.component.Component buildNotificationContent() -
createTextLayout
protected com.vaadin.flow.component.HasComponents createTextLayout() -
createTitleComponent
-
createMessageComponent
-
createCloseableLayout
protected com.vaadin.flow.component.HasComponents createCloseableLayout() -
createCloseButton
protected com.vaadin.flow.component.button.Button createCloseButton() -
onCloseButtonClick
protected void onCloseButtonClick(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event) -
isInternalCloseable
protected boolean isInternalCloseable() -
createNotification
protected com.vaadin.flow.component.notification.Notification createNotification() -
convertTypeToThemeName
-