Class ToastOptions

  • All Implemented Interfaces:
    IsDefaultToastOptions

    public final class ToastOptions
    extends AbstractNode
    Entity to configure the toast to show.
    Author:
    Andrea "Stock" Stocchero
    • Constructor Detail

      • ToastOptions

        public ToastOptions()
        Creates the object with an empty configuration instance.
    • Method Detail

      • getClickEventHandler

        public ClickEventHandler getClickEventHandler()
        Returns the CLICK event hander, if set, otherwise null.
        Returns:
        the CLICK event hander, if set, otherwise null.
      • setClickEventHandler

        public void setClickEventHandler​(ClickEventHandler clickEventHandler)
        Sets the CLICK event hander.
        Parameters:
        clickEventHandler - the CLICK event hander.
      • getOpenHandler

        public OpenHandler getOpenHandler()
        Returns the OPEN hander, if set, otherwise null.
        Returns:
        the OPEN hander, if set, otherwise null.
      • setOpenHandler

        public void setOpenHandler​(OpenHandler openHandler)
        Sets the OPEN hander.
        Parameters:
        openHandler - the OPEN hander.
      • getCloseHandler

        public CloseHandler getCloseHandler()
        Returns the CLOSE hander, if set, otherwise null.
        Returns:
        the CLOSE hander, if set, otherwise null.
      • setCloseHandler

        public void setCloseHandler​(CloseHandler closeHandler)
        Sets the CLOSE hander.
        Parameters:
        closeHandler - the CLOSE hander.
      • setActions

        public void setActions​(ActionItem... actions)
        Sets the actions to the toast.
        Parameters:
        actions - the actions to the toast
      • setActions

        public void setActions​(List<ActionItem> actions)
        Sets the actions to the toast.
        Parameters:
        actions - the actions to the toast
      • getActions

        public List<ActionItem> getActions()
        Returns the actions to the toast.
        Returns:
        the actions to the toast.
      • setType

        public final void setType​(IsToastType type)
        Sets the type of the toast.
        Parameters:
        type - the type of the toast
      • setProgressBarType

        public final void setProgressBarType​(IsProgressBarType type)
        Sets the type of the toast progress bar.
        Parameters:
        type - the type of the toast progress bar
      • setProgressBarHeight

        public final void setProgressBarHeight​(int height)
        Sets the height (in pixels) of the toast progress bar.
        Parameters:
        height - the height (in pixels) of the toast progress bar
      • setHideProgressBar

        public final void setHideProgressBar​(boolean hide)
        Sets true whether to hide the progress bar.
        Parameters:
        hide - true whether to hide the progress bar
      • setHideShadow

        public final void setHideShadow​(boolean hide)
        Sets true whether to hide the shadow of toast.
        Parameters:
        hide - true whether the shadow of toast
      • setAutoHide

        public final void 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
      • setTimeout

        public final void setTimeout​(int timeout)
        Sets how long the toast notification should last.
        Parameters:
        timeout - how long the toast notification should last
      • setIcon

        public final void setIcon​(Img icon)
        Sets the icon image set for toast.
        Parameters:
        icon - the icon image set for toast
      • setBorderRadius

        public final void setBorderRadius​(int borderRadius)
        Sets the border radius (in pixels) of toast container.
        Parameters:
        borderRadius - the border radius (in pixels) of toast container
      • setModifierKey

        public final void 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
      • setAlign

        public final void setAlign​(Align align)
        Sets the alignment of the toast action.
        Parameters:
        align - the alignment of the toast action
      • getProgressBarHeight

        public final int getProgressBarHeight()
        Returns the height (in pixels) of the toast progress bar.
        Specified by:
        getProgressBarHeight in interface IsDefaultToastOptions
        Returns:
        the height (in pixels) of the toast progress bar
      • isHideProgressBar

        public final boolean isHideProgressBar()
        Returns true whether to hide the progress bar.
        Specified by:
        isHideProgressBar in interface IsDefaultToastOptions
        Returns:
        true whether to hide the progress bar
      • isHideShadow

        public final boolean isHideShadow()
        Returns true whether to hide the shadow of toast.
        Specified by:
        isHideShadow in interface IsDefaultToastOptions
        Returns:
        true whether to hide the shadow of toast
      • isAutoHide

        public final boolean isAutoHide()
        Returns whether to make the toast notification sticky, which means that the toast notification will never auto dismiss until clicked.
        Specified by:
        isAutoHide in interface IsDefaultToastOptions
        Returns:
        whether to make the toast notification sticky, which means that the toast notification will never auto dismiss until clicked
      • getTimeout

        public final int getTimeout()
        Returns how long the toast notification should last.
        Specified by:
        getTimeout in interface IsDefaultToastOptions
        Returns:
        how long the toast notification should last
      • getIcon

        public final Img getIcon()
        Returns the icon image set for toast.
        Specified by:
        getIcon in interface IsDefaultToastOptions
        Returns:
        the icon image set for toast
      • getBorderRadius

        public int getBorderRadius()
        Returns the border radius (in pixels).
        Specified by:
        getBorderRadius in interface IsDefaultToastOptions
        Returns:
        the border radius (in pixels).
      • getModifierKey

        public ModifierKey getModifierKey()
        Returns the modifier key to close the toast by clicking on it.
        Specified by:
        getModifierKey in interface IsDefaultToastOptions
        Returns:
        the modifier key to close the toast by clicking on it
      • getAlign

        public final Align getAlign()
        Returns the alignment of the toast action.
        Specified by:
        getAlign in interface IsDefaultToastOptions
        Returns:
        the alignment of the toast action