Package org.zkoss.zk.ui.util

## Class Notification

- java.lang.Object
- - org.zkoss.zk.ui.util.Notification

-     public class Notification
      extends java.lang.Object

  Utilities to send Notification 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.
  Since:
    9.0.0
  Author:
    rudyhuang

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `TYPE_ERROR` | Notification type: error
    `static java.lang.String` | `TYPE_INFO` | Notification type: information
    `static java.lang.String` | `TYPE_WARNING` | Notification type: warning

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Notification()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static void` | `show​(java.lang.String msg)` | Shows a message at the center of the browser window.
    `static void` | `show​(java.lang.String msg, boolean closable)` | Shows a message at the center of the browser window.
    `static void` | `show​(java.lang.String msg, java.lang.String type, Component ref, int x, int y, int duration)` | Displays a message.
    `static void` | `show​(java.lang.String msg, java.lang.String type, Component ref, int x, int y, int duration, boolean closable)` | Displays a message.
    `static void` | `show​(java.lang.String msg, java.lang.String type, Component ref, java.lang.String position, int duration)` | Displays a message.
    `static void` | `show​(java.lang.String msg, java.lang.String type, Component ref, java.lang.String position, int duration, boolean closable)` | Displays a message.
    `static void` | `show​(java.lang.String msg, Component ref)` | Shows a message at the right side of the given component.
    `static void` | `show​(java.lang.String msg, Component ref, boolean closable)` | Shows a message at the right side of the given component.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### TYPE_INFO

          public static final java.lang.String TYPE_INFO

      Notification type: information
      See Also:
        Constant Field Values

    - #### TYPE_WARNING

          public static final java.lang.String TYPE_WARNING

      Notification type: warning
      See Also:
        Constant Field Values

    - #### TYPE_ERROR

          public static final java.lang.String TYPE_ERROR

      Notification type: error
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Notification

          public Notification()

  - ### Method Detail

    - #### show

          public static void show​(java.lang.String msg,
                                  java.lang.String type,
                                  Component ref,
                                  java.lang.String position,
                                  int duration,
                                  boolean closable)

      Displays a message.
      Parameters:
        `msg` - the message to show
        `type` - available types are "info", "warning", "error"
        `ref` - the referenced component, null to be based on browser window
        `position` - predefined positions.

        Available options are:

        - before_start
          the message appears above the anchor, aligned to the left.
        - before_center
          the message appears above the anchor, aligned to the center.
        - before_end
          the message appears above the anchor, aligned to the right.
        - after_start
          the message appears below the anchor, aligned to the left.
        - after_center
          the message appears below the anchor, aligned to the center.
        - after_end
          the message appears below the anchor, aligned to the right.
        - start_before
          the message appears to the left of the anchor, aligned to the top.
        - start_center
          the message appears to the left of the anchor, aligned to the middle.
        - start_after
          the message appears to the left of the anchor, aligned to the bottom.
        - end_before
          the message appears to the right of the anchor, aligned to the top.
        - end_center
          the message appears to the right of the anchor, aligned to the middle.
        - end_after
          the message appears to the right of the anchor, aligned to the bottom.
        - overlap/top_left
          the message overlaps the anchor, with anchor and message aligned at top-left.
        - top_center
          the message overlaps the anchor, with anchor and message aligned at top-center.
        - overlap_end/top_right
          the message overlaps the anchor, with anchor and message aligned at top-right.
        - middle_left
          the message overlaps the anchor, with anchor and message aligned at middle-left.
        - middle_center
          the message overlaps the anchor, with anchor and message aligned at middle-center.
        - middle_right
          the message overlaps the anchor, with anchor and message aligned at middle-right.
        - overlap_before/bottom_left
          the message overlaps the anchor, with anchor and message aligned at bottom-left.
        - bottom_center
          the message overlaps the anchor, with anchor and message aligned at bottom-center.
        - overlap_after/bottom_right
          the message overlaps the anchor, with anchor and message aligned at bottom-right.
        - at_pointer
          the message appears with the upper-left aligned with the mouse cursor.
        - after_pointer
          the message appears with the top aligned with the bottom of the mouse cursor, with the left side of the message at the horizontal position of the mouse cursor.
        `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,
                                  Component ref,
                                  int x,
                                  int y,
                                  int duration,
                                  boolean closable)

      Displays a message.
      Parameters:
        `msg` - the message to show
        `type` - available types are "info", "warning", "error"
        `ref` - the referenced component, null to be based on browser window
        `x` - the horizontal position of the notification, aligned at top-left (in pixel)
        `y` - the vertical position of the notification, aligned at top-left (in pixel)
        `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,
                                  Component ref,
                                  int x,
                                  int y,
                                  int duration)

      Displays a message.
      Parameters:
        `msg` - the message to show
        `type` - available types are "info", "warning", "error"
        `ref` - the referenced component, null to be based on browser window
        `x` - the horizontal position of the notification, aligned at top-left (in pixel)
        `y` - the vertical position of the notification, aligned at top-left (in pixel)
        `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.

    - #### show

          public static void show​(java.lang.String msg,
                                  java.lang.String type,
                                  Component ref,
                                  java.lang.String position,
                                  int duration)

      Displays a message.
      Parameters:
        `msg` - the message to show
        `type` - available types are "info", "warning", "error"
        `ref` - the referenced component, null to be based on browser window
        `position` - predefined positions.

        Available options are:

        - before_start
          the message appears above the anchor, aligned to the left.
        - before_center
          the message appears above the anchor, aligned to the center.
        - before_end
          the message appears above the anchor, aligned to the right.
        - after_start
          the message appears below the anchor, aligned to the left.
        - after_center
          the message appears below the anchor, aligned to the center.
        - after_end
          the message appears below the anchor, aligned to the right.
        - start_before
          the message appears to the left of the anchor, aligned to the top.
        - start_center
          the message appears to the left of the anchor, aligned to the middle.
        - start_after
          the message appears to the left of the anchor, aligned to the bottom.
        - end_before
          the message appears to the right of the anchor, aligned to the top.
        - end_center
          the message appears to the right of the anchor, aligned to the middle.
        - end_after
          the message appears to the right of the anchor, aligned to the bottom.
        - overlap/top_left
          the message overlaps the anchor, with anchor and message aligned at top-left.
        - top_center
          the message overlaps the anchor, with anchor and message aligned at top-center.
        - overlap_end/top_right
          the message overlaps the anchor, with anchor and message aligned at top-right.
        - middle_left
          the message overlaps the anchor, with anchor and message aligned at middle-left.
        - middle_center
          the message overlaps the anchor, with anchor and message aligned at middle-center.
        - middle_right
          the message overlaps the anchor, with anchor and message aligned at middle-right.
        - overlap_before/bottom_left
          the message overlaps the anchor, with anchor and message aligned at bottom-left.
        - bottom_center
          the message overlaps the anchor, with anchor and message aligned at bottom-center.
        - overlap_after/bottom_right
          the message overlaps the anchor, with anchor and message aligned at bottom-right.
        - at_pointer
          the message appears with the upper-left aligned with the mouse cursor.
        - after_pointer
          the message appears with the top aligned with the bottom of the mouse cursor, with the left side of the message at the horizontal position of the mouse cursor.
        `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.

    - #### show

          public static void show​(java.lang.String msg,
                                  Component ref,
                                  boolean closable)

      Shows a message at the right side of the given component.
      Parameters:
        `msg` - the message to show
        `ref` - the referenced component, null to be based on browser window
        `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,
                                  Component ref)

      Shows a message at the right side of the given component.
      Parameters:
        `msg` - the message to show
        `ref` - the referenced component, null to be based on browser window

    - #### show

          public static void show​(java.lang.String msg)

      Shows a message at the center of the browser window.
      Parameters:
        `msg` - the message to show

    - #### show

          public static void show​(java.lang.String msg,
                                  boolean closable)

      Shows a message at the center of the browser window.
      Parameters:
        `msg` - the message to show
        `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.