public final class Notification
extends java.lang.Object
If some browser instance has been disposed or reloaded than all notifications that were created in the scope of this browser instance context would be marked as closed and all notification event listeners associated with this notification would be informed about it.
Modifier and Type | Method and Description |
---|---|
void |
addNotificationListener(NotificationListener listener)
Adds new notification listener to listen events related to this notification instance.
添加新的通知侦听器以侦听与此通知实例有关的事件。 |
void |
click()
Informs browser that this notification was clicked by user.
通知浏览器该通知已被用户单击。 |
void |
close()
Informs browser that this notification was closed by user and marks it as
通知浏览器该通知已被用户关闭,并将其标记为已关闭。 closed .
|
java.lang.String |
getMessage()
Returns notification message or empty string if notification doesn't have message.
返回通知消息或空字符串(如果通知中没有消息)。 |
java.util.List<NotificationListener> |
getNotificationListeners()
Returns collection of notification listeners associated with this notification.
返回与此通知关联的通知侦听器的集合。 |
java.lang.String |
getTitle()
Returns notification title or empty string if notification doesn't have title.
返回通知标题或空字符串(如果通知没有标题)。 |
NotificationType |
getType()
Returns notification type.
返回通知类型。 |
java.lang.String |
getURL()
Returns notification URL.
返回通知URL。 |
boolean |
isClosed()
Informs about the state of the notification.
通知有关通知状态的信息。 |
void |
removeNotificationListener(NotificationListener listener)
Removes notification listener from the list of registered notification listeners.
从注册的通知侦听器列表中删除通知侦听器。 |
public NotificationType getType()
NotificationType
value describing type of the notification.
描述通知类型的值。
public java.lang.String getTitle()
public java.lang.String getMessage()
public java.lang.String getURL()
String
containing URL of the web page that displays this notification. Will not return
null
or empty string.
包含显示此通知的网页的URL。不会返回或为空字符串。
public boolean isClosed()
close()
method or via JavaScript code
Notification.close()
.
true
if this notification is closed.
如果此通知已关闭。
public java.util.List<NotificationListener> getNotificationListeners()
MULTIPLE
of
NotificationListener
instances. Will not return
null
. If no listeners were registered returns empty
MULTIPLE
实例。不会返回。如果未注册任何侦听器,则返回空
public void addNotificationListener(NotificationListener listener)
listener
-
NotificationListener
instance.
null
value will be ignored.
-实例。值将被忽略。
public void removeNotificationListener(NotificationListener listener)
listener
-
NotificationListener
instance that will not further receive events related to this notification instance.
null
value will be ignored.
-不会进一步接收与此通知实例相关事件的实例。值将被忽略。
public void close()
closed
. See
isClosed()
Does nothing if this notification has been already closed or if browser instance in which context this notification was created has been disposed or reloaded.
public void click()
java.lang.IllegalStateException
- if this notification has been already closed or if browser instance in which context this notification was created has been disposed or reloaded.