Class Notifications.NotificationBuilder

java.lang.Object
io.jmix.flowui.Notifications.NotificationBuilder
Enclosing class:
Notifications

public static class Notifications.NotificationBuilder extends Object
A builder that configures and displays notifications.
  • Field Details

    • CLOSEABLE_LAYOUT_CLASS_NAME

      protected static final String CLOSEABLE_LAYOUT_CLASS_NAME
      See Also:
    • CLOSE_BUTTON_CLASS_NAME

      protected static final String CLOSE_BUTTON_CLASS_NAME
      See Also:
    • TEXT_LAYOUT_CLASS_NAME

      protected static final String TEXT_LAYOUT_CLASS_NAME
      See Also:
    • CLOSEABLE_TEXT_LAYOUT_CLASS_NAME

      protected static final String CLOSEABLE_TEXT_LAYOUT_CLASS_NAME
      See Also:
    • TITLE_CLASS_NAME

      protected static final String TITLE_CLASS_NAME
      See Also:
    • MESSAGE_CLASS_NAME

      protected static final String MESSAGE_CLASS_NAME
      See Also:
    • COMPONENT_CONTENT_CLASS_NAME

      protected static final String COMPONENT_CONTENT_CLASS_NAME
      See Also:
    • notification

      protected com.vaadin.flow.component.notification.Notification notification
    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
    • text

      protected String text
    • title

      protected String title
    • message

      protected String message
    • component

      protected com.vaadin.flow.component.Component component
    • position

      protected com.vaadin.flow.component.notification.Notification.Position position
    • duration

      protected int duration
    • fireOpenedChangeEvents

      protected boolean fireOpenedChangeEvents
    • type

      protected Notifications.Type type
    • closeable

      protected Boolean closeable
    • themeVariant

      protected com.vaadin.flow.component.notification.NotificationVariant themeVariant
    • className

      protected String className
  • Constructor Details

    • NotificationBuilder

      public NotificationBuilder(String text)
      Parameters:
      text - notification text
    • NotificationBuilder

      public NotificationBuilder(String title, String message)
      Parameters:
      title - notification title
      message - 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, see UiComponentProperties.getDefaultNotificationPosition().

    • withDuration

      public Notifications.NotificationBuilder withDuration(int duration)
      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, see UiComponentProperties.getDefaultNotificationDuration().

    • withType

      Sets notification type.
    • withCloseable

      public Notifications.NotificationBuilder withCloseable(boolean closeable)
      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

      public Notifications.NotificationBuilder withClassName(String className)
      Sets a CSS class name to the notification.
    • getPosition

      public com.vaadin.flow.component.notification.Notification.Position getPosition()
    • getDuration

      public int getDuration()
    • getType

      public Notifications.Type getType()
    • isCloseable

      public boolean isCloseable()
    • getText

      @Nullable public String getText()
    • getTitle

      @Nullable public String getTitle()
    • getMessage

      @Nullable public String getMessage()
    • getThemeVariant

      @Nullable public com.vaadin.flow.component.notification.NotificationVariant getThemeVariant()
    • getClassName

      @Nullable public String 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

      protected Notifications.NotificationBuilder applyDefaults(UiComponentProperties properties)
    • applyApplicationContext

      protected Notifications.NotificationBuilder applyApplicationContext(org.springframework.context.ApplicationContext applicationContext)
    • buildNotificationContent

      @Nullable protected com.vaadin.flow.component.Component buildNotificationContent()
    • createTextLayout

      protected com.vaadin.flow.component.HasComponents createTextLayout()
    • createTextComponent

      protected com.vaadin.flow.component.Component createTextComponent(String text)
    • createTitleComponent

      protected com.vaadin.flow.component.Component createTitleComponent(String title)
    • createMessageComponent

      protected com.vaadin.flow.component.Component createMessageComponent(String message)
    • 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

      protected String convertTypeToThemeName(Notifications.Type type)
    • fireNotificationOpenedChangeEvent

      protected void fireNotificationOpenedChangeEvent(com.vaadin.flow.component.notification.Notification.OpenedChangeEvent openedChangeEvent)