Class ToastOptionsBuilder

  • All Implemented Interfaces:
    IsBuilder

    public final class ToastOptionsBuilder
    extends AbstractBaseBuilder
    Comfortable object to create Toaster options by a builder.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • create

        public static ToastOptionsBuilder create()
        Returns new builder instance.
        Returns:
        new builder instance
      • create

        public static ToastOptionsBuilder create​(IsToastType type)
        Returns new builder instance, setting the toast type.
        Parameters:
        type - the type of the toast
        Returns:
        new builder instance
      • build

        public ToastOptions build()
        Returns a configured toast options.
        Returns:
        a configured toast options.
      • setTitleColor

        public ToastOptionsBuilder setTitleColor​(IsColor color)
        Sets the font color of title.
        Parameters:
        color - font color of title
        Returns:
        toast options builder instance
      • setTitleColor

        public ToastOptionsBuilder setTitleColor​(String color)
        Sets the font color of title.
        Parameters:
        color - font color of title
        Returns:
        toast options builder instance
      • setTitleFontSize

        public ToastOptionsBuilder setTitleFontSize​(int size)
        Sets the font size of title.
        Parameters:
        size - the font size of title.
        Returns:
        toast options builder instance
      • setTitleFontStyle

        public ToastOptionsBuilder setTitleFontStyle​(FontStyle style)
        Sets the font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit) of title.
        Parameters:
        style - Font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit) of title.
        Returns:
        toast options builder instance
      • setTitleFontFamily

        public ToastOptionsBuilder setTitleFontFamily​(String family)
        Sets the font family, follows CSS font-family options of title.
        Parameters:
        family - Font family, follows CSS font-family options of title.
        Returns:
        toast options builder instance
      • setTitleFontWeight

        public ToastOptionsBuilder setTitleFontWeight​(Weight weight)
        Sets the font weight, follows CSS font-style-weight options of title.
        Parameters:
        weight - font weight, follows CSS font-style-weight options of title.
        Returns:
        toast options builder instance
      • setTitleFontLineHeight

        public ToastOptionsBuilder setTitleFontLineHeight​(double lineHeight)
        Sets the line height of title.
        Parameters:
        lineHeight - the line height of title.
        Returns:
        toast options builder instance
      • setTitleFontLineHeight

        public ToastOptionsBuilder setTitleFontLineHeight​(String lineHeight)
        Sets the line height of title.
        Parameters:
        lineHeight - the line height of title.
        Returns:
        toast options builder instance
      • setLabelColor

        public ToastOptionsBuilder setLabelColor​(IsColor color)
        Sets the font color of label.
        Parameters:
        color - font color of label
        Returns:
        toast options builder instance
      • setLabelColor

        public ToastOptionsBuilder setLabelColor​(String color)
        Sets the font color of label.
        Parameters:
        color - font color of label
        Returns:
        toast options builder instance
      • setLabelFontSize

        public ToastOptionsBuilder setLabelFontSize​(int size)
        Sets the font size of label.
        Parameters:
        size - the font size of label.
        Returns:
        toast options builder instance
      • setLabelFontStyle

        public ToastOptionsBuilder setLabelFontStyle​(FontStyle style)
        Sets the font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit) of label.
        Parameters:
        style - Font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit) of label.
        Returns:
        toast options builder instance
      • setLabelFontFamily

        public ToastOptionsBuilder setLabelFontFamily​(String family)
        Sets the font family, follows CSS font-family options of label.
        Parameters:
        family - Font family, follows CSS font-family options of label.
        Returns:
        toast options builder instance
      • setLabelFontWeight

        public ToastOptionsBuilder setLabelFontWeight​(Weight weight)
        Sets the font weight, follows CSS font-style-weight options of label.
        Parameters:
        weight - font weight, follows CSS font-style-weight options of label.
        Returns:
        toast options builder instance
      • setLabelFontLineHeight

        public ToastOptionsBuilder setLabelFontLineHeight​(double lineHeight)
        Sets the line height of label.
        Parameters:
        lineHeight - the line height of label.
        Returns:
        toast options builder instance
      • setLabelFontLineHeight

        public ToastOptionsBuilder setLabelFontLineHeight​(String lineHeight)
        Sets the line height of label.
        Parameters:
        lineHeight - the line height of label.
        Returns:
        toast options builder instance
      • setActionColor

        public ToastOptionsBuilder setActionColor​(IsColor color)
        Sets the font color of action.
        Parameters:
        color - font color of action
        Returns:
        toast options builder instance
      • setActionColor

        public ToastOptionsBuilder setActionColor​(String color)
        Sets the font color of action.
        Parameters:
        color - font color of action
        Returns:
        toast options builder instance
      • setActionFontSize

        public ToastOptionsBuilder setActionFontSize​(int size)
        Sets the font size of action.
        Parameters:
        size - the font size of action.
        Returns:
        toast options builder instance
      • setActionFontStyle

        public ToastOptionsBuilder setActionFontStyle​(FontStyle style)
        Sets the font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit) of action.
        Parameters:
        style - Font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit) of action.
        Returns:
        toast options builder instance
      • setActionFontFamily

        public ToastOptionsBuilder setActionFontFamily​(String family)
        Sets the font family, follows CSS font-family options of action.
        Parameters:
        family - Font family, follows CSS font-family options of action.
        Returns:
        toast options builder instance
      • setActionFontWeight

        public ToastOptionsBuilder setActionFontWeight​(Weight weight)
        Sets the font weight, follows CSS font-style-weight options of action.
        Parameters:
        weight - font weight, follows CSS font-style-weight options of action.
        Returns:
        toast options builder instance
      • setActionFontLineHeight

        public ToastOptionsBuilder setActionFontLineHeight​(double lineHeight)
        Sets the line height of action.
        Parameters:
        lineHeight - the line height of action.
        Returns:
        toast options builder instance
      • setActionFontLineHeight

        public ToastOptionsBuilder setActionFontLineHeight​(String lineHeight)
        Sets the line height of action.
        Parameters:
        lineHeight - the line height of action.
        Returns:
        toast options builder instance
      • setActionBackgroundColor

        public ToastOptionsBuilder setActionBackgroundColor​(IsColor backgroundColor)
        Sets the background color of action.
        Parameters:
        backgroundColor - the background color of action.
        Returns:
        toast options builder instance
      • setActionBackgroundColor

        public ToastOptionsBuilder setActionBackgroundColor​(String backgroundColor)
        Sets the background color of action.
        Parameters:
        backgroundColor - the background color of action.
        Returns:
        toast options builder instance
      • setActionBorderWidth

        public ToastOptionsBuilder setActionBorderWidth​(int borderWidth)
        Sets the border width of action.
        Parameters:
        borderWidth - the border width of action.
        Returns:
        toast options builder instance
      • setActionBorderColor

        public ToastOptionsBuilder setActionBorderColor​(IsColor borderColor)
        Sets the border color of action.
        Parameters:
        borderColor - the border color of action.
        Returns:
        toast options builder instance
      • setActionBorderColor

        public ToastOptionsBuilder setActionBorderColor​(String borderColor)
        Sets the border color of action.
        Parameters:
        borderColor - the border color of action.
        Returns:
        toast options builder instance
      • setActionBorderRadius

        public ToastOptionsBuilder setActionBorderRadius​(int borderRadius)
        Sets the border radius (in pixels) of toast action.
        Parameters:
        borderRadius - the border radius (in pixels) of toast action
        Returns:
        toast options builder instance
      • setActionBorderStyle

        public ToastOptionsBuilder setActionBorderStyle​(BorderStyle style)
        Sets the border style set for the action element.
        Parameters:
        style - the border styles set for the action element.
        Returns:
        toast options builder instance
      • setType

        public ToastOptionsBuilder setType​(IsToastType type)
        Sets the type of the toast.
        Parameters:
        type - the type of the toast
        Returns:
        toast options builder instance
      • setProgressBarType

        public ToastOptionsBuilder setProgressBarType​(IsProgressBarType type)
        Sets the type of the toast progress bar.
        Parameters:
        type - the type of the toast progress bar
        Returns:
        toast options builder instance
      • setHideProgressBar

        public ToastOptionsBuilder setHideProgressBar​(boolean hide)
        Sets true whether to hide the progress bar.
        Parameters:
        hide - true whether to hide the progress bar
        Returns:
        toast options builder instance
      • setAutoHide

        public ToastOptionsBuilder setAutoHide​(boolean hide)
        Sets whether to make the toast notification sticky, which means that the toast notification will never auto dismiss until clicked.
        Parameters:
        hide - whether to make the toast notification sticky, which means that the toast notification will never auto dismiss until clicked
        Returns:
        toast options builder instance
      • setTimeout

        public ToastOptionsBuilder setTimeout​(int timeout)
        Sets how long the toast notification should last.
        Parameters:
        timeout - how long the toast notification should last
        Returns:
        toast options builder instance
      • setIcon

        public ToastOptionsBuilder setIcon​(Img icon)
        Sets the icon image set for toast.
        Parameters:
        icon - the icon image set for toast
        Returns:
        toast options builder instance
      • setBorderRadius

        public ToastOptionsBuilder setBorderRadius​(int borderRadius)
        Sets the border radius (in pixels) of toast container.
        Parameters:
        borderRadius - the border radius (in pixels) of toast container
        Returns:
        toast options builder instance
      • setActions

        public ToastOptionsBuilder setActions​(ActionItem... actions)
        Sets the actions to the toast.
        Parameters:
        actions - the actions to the toast
        Returns:
        toast options builder instance
      • setActions

        public ToastOptionsBuilder setActions​(List<ActionItem> actions)
        Sets the actions to the toast.
        Parameters:
        actions - the actions to the toast
        Returns:
        toast options builder instance
      • setProgressBarHeight

        public ToastOptionsBuilder setProgressBarHeight​(int height)
        Sets the height (in pixels) of the toast progress bar.
        Parameters:
        height - the height (in pixels) of the toast progress bar
        Returns:
        toast options builder instance
      • setHideShadow

        public ToastOptionsBuilder setHideShadow​(boolean hide)
        Sets true whether to hide the shadow of toast.
        Parameters:
        hide - true whether the shadow of toast
        Returns:
        toast options builder instance
      • setModifierKey

        public ToastOptionsBuilder setModifierKey​(ModifierKey modifierKey)
        Sets the modifier key to close the toast by clicking on it.
        Parameters:
        modifierKey - the modifier key to close the toast by clicking on it
        Returns:
        toast options builder instance
      • setAlign

        public ToastOptionsBuilder setAlign​(Align align)
        Sets the alignment of the toast action.
        Parameters:
        align - the alignment of the toast action
        Returns:
        toast options builder instance
      • setClickEventHandler

        public ToastOptionsBuilder setClickEventHandler​(ClickEventHandler clickEventHandler)
        Sets the CLICK event hander.
        Parameters:
        clickEventHandler - the CLICK event hander.
        Returns:
        toast options builder instance
      • setOpenHandler

        public ToastOptionsBuilder setOpenHandler​(OpenHandler openHandler)
        Sets the OPEN hander.
        Parameters:
        openHandler - the OPEN hander.
        Returns:
        toast options builder instance
      • setCloseHandler

        public ToastOptionsBuilder setCloseHandler​(CloseHandler closeHandler)
        Sets the CLOSE hander.
        Parameters:
        closeHandler - the CLOSE hander.
        Returns:
        toast options builder instance