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
FieldsModifier and TypeFieldDescriptionprotected Stringprotected static final Stringprotected Booleanprotected static final Stringprotected static final Stringprotected com.vaadin.flow.component.Componentprotected static final Stringprotected intprotected Stringprotected static final Stringprotected com.vaadin.flow.component.notification.Notificationprotected com.vaadin.flow.component.notification.Notification.Positionprotected Stringprotected static final Stringprotected com.vaadin.flow.component.notification.NotificationVariantprotected Stringprotected static final Stringprotected Notifications.Typeprotected static final String -
Constructor Summary
ConstructorsConstructorDescriptionNotificationBuilder(com.vaadin.flow.component.Component component) NotificationBuilder(String text) NotificationBuilder(String title, String message) -
Method Summary
Modifier and TypeMethodDescriptionprotected Notifications.NotificationBuilderapplyDefaults(FlowuiComponentProperties properties) com.vaadin.flow.component.notification.Notificationbuild()Creates the notification.protected com.vaadin.flow.component.Componentprotected Stringprotected com.vaadin.flow.component.HasComponentsprotected com.vaadin.flow.component.button.Buttonprotected com.vaadin.flow.component.ComponentcreateMessageComponent(String message) protected com.vaadin.flow.component.notification.Notificationprotected com.vaadin.flow.component.ComponentcreateTextComponent(String text) protected com.vaadin.flow.component.HasComponentsprotected com.vaadin.flow.component.ComponentcreateTitleComponent(String title) com.vaadin.flow.component.Componentintcom.vaadin.flow.component.notification.Notification.PositiongetText()com.vaadin.flow.component.notification.NotificationVariantgetTitle()getType()booleanprotected booleanprotected voidonCloseButtonClick(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event) voidshow()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:
-
CLOSEABLE_TEXT_LAYOUT_CLASS_NAME
- See Also:
-
TITLE_CLASS_NAME
- See Also:
-
MESSAGE_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-positionproperty 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-durationproperty 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() -
createTextComponent
-
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
-