Class NotificationPopup.Builder

  • Enclosing class:
    NotificationPopup

    public static class NotificationPopup.Builder
    extends Object
    The Builder to create NotificationPopup instances. It has a fluent API (every method returns the same builder instance).
    Since:
    0.4
    • Method Detail

      • content

        public NotificationPopup.Builder content​(Function<Composite,​Control> contentCreator)
        Sets the function to create the main content of the notification popup in the given composite. Is called when the content is created.
        Parameters:
        contentCreator - the content creation function
        Returns:
        this
      • text

        public NotificationPopup.Builder text​(String text)
        Sets the content text. A label is created to show the given text.
        Parameters:
        text - the content text
        Returns:
        this
      • title

        public NotificationPopup.Builder title​(Function<Composite,​Control> titleCreator,
                                               boolean hasCloseButton)
        Sets the function to create the title area's content of the notification popup in the given composite. Is called when the title is created.
        Parameters:
        titleCreator - the title creation function
        hasCloseButton - whether to show or not to show a close image
        Returns:
        this
      • title

        public NotificationPopup.Builder title​(String title,
                                               boolean hasCloseButton)
        Sets the title text. A label is created to show the given title.
        Parameters:
        title - the title text
        hasCloseButton - whether to show or not to show a close image
        Returns:
        this
      • delay

        public NotificationPopup.Builder delay​(long delay)
        Sets the visible time of the popup before it disappears.
        Parameters:
        delay - the time in milliseconds
        Returns:
        this
      • fadeIn

        public NotificationPopup.Builder fadeIn​(boolean fadeIn)
        Sets whether the popup should fade in or just appear.
        Parameters:
        fadeIn - whether or not to fade in
        Returns:
        this
      • open

        public int open()
        Creates and opens the popup. This is a shorthand for:
         NotificationPopup popup = builder.build();
         int open = popup.open();
         
        Returns:
        the return code of open()
      • build

        public NotificationPopup build()
        Creates the notification popup with all parameters set in the builder.
        Returns:
        the notification popup