Package org.zkoss.zk.ui.util
Class Notification
java.lang.Object
org.zkoss.zk.ui.util.Notification
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidShows a message at the center of the browser window.static voidShows a message at the center of the browser window.static voidDisplays a message.static voidDisplays a message.static voidDisplays a message.static voidDisplays a message.static voidShows a message at the right side of the given component.static voidShows a message at the right side of the given component.
-
Field Details
-
TYPE_INFO
Notification type: information- See Also:
-
TYPE_WARNING
Notification type: warning- See Also:
-
TYPE_ERROR
Notification type: error- See Also:
-
-
Constructor Details
-
Notification
public Notification()
-
-
Method Details
-
show
public static void show(String msg, String type, Component ref, String position, int duration, boolean closable) Displays a message.- Parameters:
msg- the message to showtype- available types are "info", "warning", "error"ref- the referenced component, null to be based on browser windowposition- 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.
- before_start
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(String msg, String type, Component ref, int x, int y, int duration, boolean closable) Displays a message.- Parameters:
msg- the message to showtype- available types are "info", "warning", "error"ref- the referenced component, null to be based on browser windowx- 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
Displays a message.- Parameters:
msg- the message to showtype- available types are "info", "warning", "error"ref- the referenced component, null to be based on browser windowx- 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
Displays a message.- Parameters:
msg- the message to showtype- available types are "info", "warning", "error"ref- the referenced component, null to be based on browser windowposition- 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.
- before_start
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
Shows a message at the right side of the given component.- Parameters:
msg- the message to showref- the referenced component, null to be based on browser windowclosable- 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
Shows a message at the right side of the given component.- Parameters:
msg- the message to showref- the referenced component, null to be based on browser window
-
show
Shows a message at the center of the browser window.- Parameters:
msg- the message to show
-
show
Shows a message at the center of the browser window.- Parameters:
msg- the message to showclosable- 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.
-