Class Toast


  • public class Toast
    extends java.lang.Object
    Utilities to send Toast to the client. Note: this class makes accessing 'client-side' more directly. Methods such as show(String) will not encode the strings passed into them, thus the formatting of messages at 'client-side' is allowed. User input should be escaped carefully.

    Custom Attributes

    org.zkoss.zkmax.ui.util.Toast.animationSpeed
    Specifies the duration of Toast opening and closing animation in milliseconds.
    The default value is 500(ms).
    Since:
    9.0.0
    Author:
    rudyhuang
    • Constructor Summary

      Constructors 
      Constructor Description
      Toast()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void show​(java.lang.String msg)
      Display a five-second toast notification message at the top-center of the browser window.
      static void show​(java.lang.String msg, java.lang.String type, java.lang.String position)
      Display a five-second toast notification message.
      static void show​(java.lang.String msg, java.lang.String type, java.lang.String position, int duration, boolean closable)
      Display a toast notification message.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Toast

        public Toast()
    • Method Detail

      • show

        public static void show​(java.lang.String msg,
                                java.lang.String type,
                                java.lang.String position,
                                int duration,
                                boolean closable)
        Display a toast notification message.
        Parameters:
        msg - the message to show (HTML is accepted)
        type - available types are "info", "warning", "error". default "info".
        position - predefined positions. Available options
        left center right
        top top_left top_center top_right
        middle middle_left middle_center middle_right
        bottom bottom_left bottom_center bottom_right
        default "top_center".
        duration - the duration of notification in millisecond. If zero or negative the notification does not dismiss until user left-clicks outside of the notification box.
        closable - whether to close notification manually or not. If true there will be a close button on notification message and won't close until user click the button or duration time up, default false.
      • show

        public static void show​(java.lang.String msg,
                                java.lang.String type,
                                java.lang.String position)
        Display a five-second toast notification message.
        Parameters:
        msg - the message to show (HTML is accepted)
        type - available types are "info", "warning", "error". default "info".
        position - predefined positions. Available options see show(String, String, String, int, boolean). default "top_center".
      • show

        public static void show​(java.lang.String msg)
        Display a five-second toast notification message at the top-center of the browser window.
        Parameters:
        msg - the message to show (HTML is accepted)