public interface NotificationService
Modifier and Type | Method and Description |
---|---|
void |
addActionHandler(NotificationHandler handler)
Adds an object that executes the actual action of a notification action.
|
void |
addNotificationChangeListener(NotificationChangeListener listener)
Registers a listener that would be notified of changes that have occurred
in the registered event notifications.
|
NotificationData |
fireNotification(java.lang.String eventType)
Fires all notifications registered for the specified eventType
using the default message specified upon registration as a notification
message wherever appropriate.
|
NotificationData |
fireNotification(java.lang.String eventType,
java.lang.String messageTitle,
java.lang.String message,
byte[] icon)
Fires all notifications registered for the specified eventType
using message as a notification message wherever appropriate
(e.g.
|
NotificationData |
fireNotification(java.lang.String eventType,
java.lang.String messageTitle,
java.lang.String message,
byte[] icon,
java.util.Map<java.lang.String,java.lang.Object> extras)
Fires all notifications registered for the specified eventType
using message as a notification message wherever appropriate
(e.g.
|
java.lang.Iterable<NotificationHandler> |
getActionHandlers(java.lang.String actionType)
Gets at list of handler for the specified action type.
|
NotificationAction |
getEventNotificationAction(java.lang.String eventType,
java.lang.String actionType)
Returns the NotificationAction corresponding to the given event
and action type.
|
java.lang.Iterable<java.lang.String> |
getRegisteredEvents()
Returns an iterator over a list of all events registered in this
notification service.
|
boolean |
isActive(java.lang.String eventType)
Indicates whether or not actions for the specified eventType
are activated.
|
boolean |
isPlayingNotification(NotificationData data)
Tells if the given sound notification is currently played.
|
void |
registerDefaultNotificationForEvent(java.lang.String eventType,
NotificationAction handler)
Registers a default notification for the given eventType by
specifying the action to be performed when a notification is fired for
this event.
|
void |
registerDefaultNotificationForEvent(java.lang.String eventType,
java.lang.String actionType,
java.lang.String actionDescriptor,
java.lang.String defaultMessage)
Registers a default notification for the given eventType by
specifying the type of the action to be performed when a notification is
fired for this event, the actionDescriptor for sound and command
actions and the defaultMessage for popup and log actions.
|
void |
registerNotificationForEvent(java.lang.String eventType,
NotificationAction action)
Registers a notification for the given eventType by specifying
the action to be performed when a notification is fired for this event.
|
void |
registerNotificationForEvent(java.lang.String eventType,
java.lang.String actionType,
java.lang.String actionDescriptor,
java.lang.String defaultMessage)
Registers a notification for the given eventType by specifying
the type of the action to be performed when a notification is fired for
this event, the actionDescriptor for sound and command actions
and the defaultMessage for popup and log actions.
|
void |
removeActionHandler(java.lang.String actionType)
Removes an object that executes the actual action of notification action.
|
void |
removeEventNotification(java.lang.String eventType)
Removes the given eventType from the list of event
notifications.
|
void |
removeEventNotificationAction(java.lang.String eventType,
java.lang.String actionType)
Removes the event notification corresponding to the specified
actionType and eventType.
|
void |
removeNotificationChangeListener(NotificationChangeListener listener)
Remove the specified listener so that it won't receive further
notifications of changes that occur with actions registered for events
stored by this service.
|
void |
restoreDefaults()
Deletes all registered events and actions
and registers and saves the default events as current.
|
void |
setActive(java.lang.String eventType,
boolean isActive)
Activates or deactivates all notification actions related to the
specified eventType.
|
void |
stopNotification(NotificationData data)
Stops a notification if notification is continuous, like playing sounds
in loop.
|
void registerNotificationForEvent(java.lang.String eventType, NotificationAction action)
eventType
- the name of the event (as defined by the plug-in that's
registering it) that we are setting an action for.action
- the NotificationAction, which would be
used to perform the notification action.void registerDefaultNotificationForEvent(java.lang.String eventType, NotificationAction handler)
eventType
- the name of the event (as defined by the plug-in that's
registering it) that we are setting an action for.handler
- the NotificationActionHandler, which would be
used to perform the notification action.void registerDefaultNotificationForEvent(java.lang.String eventType, java.lang.String actionType, java.lang.String actionDescriptor, java.lang.String defaultMessage)
The method allows registering more than one actionType for a specific event. Setting the same actionType for the same eventType twice however would cause the first setting to be overridden. Default events are stored or executed at first run or when they are missing in the configuration. Also the registered default events are used when restoreDefaults is called.
eventType
- the name of the event (as defined by the plug-in that's
registering it) that we are setting an action for.actionType
- the type of the action that is to be executed when the
specified event occurs (could be one of the ACTION_XXX
fields).actionDescriptor
- a String containing a description of the action
(a URI to the sound file for audio notifications or a command
line for exec action types) that should be executed when the
action occurs.defaultMessage
- the default message to use if no specific message
has been provided when firing the notification.void registerNotificationForEvent(java.lang.String eventType, java.lang.String actionType, java.lang.String actionDescriptor, java.lang.String defaultMessage)
The method allows registering more than one actionType for a specific event. Setting the same actionType for the same eventType twice however would cause the first setting to be overridden.
eventType
- the name of the event (as defined by the plug-in that's
registering it) that we are setting an action for.actionType
- the type of the action that is to be executed when the
specified event occurs (could be one of the ACTION_XXX
fields).actionDescriptor
- a String containing a description of the action
(a URI to the sound file for audio notifications or a command
line for exec action types) that should be executed when the
action occurs.defaultMessage
- the default message to use if no specific message
has been provided when firing the notification.void restoreDefaults()
void removeEventNotification(java.lang.String eventType)
This method does nothing if the given eventType is not contained in the list of registered event types.
eventType
- the name of the event (as defined by the plugin that's
registering it) to be removed.void removeEventNotificationAction(java.lang.String eventType, java.lang.String actionType)
This method does nothing if the given eventType or actionType are not contained in the list of registered types.
eventType
- the name of the event (as defined by the plugin that's
registering it) for which we'll remove the notification.actionType
- the type of the action that is to be executed when the
specified event occurs (could be one of the ACTION_XXX
fields).java.lang.Iterable<java.lang.String> getRegisteredEvents()
NotificationAction getEventNotificationAction(java.lang.String eventType, java.lang.String actionType)
This method returns null if the given eventType or actionType are not contained in the list of registered types.
eventType
- the type of the event that we'd like to retrieve.actionType
- the type of the action that we'd like to retrieve a
descriptor for.void addNotificationChangeListener(NotificationChangeListener listener)
listener
- the listener that we'd like to register for changes in
the event notifications stored by this service.void removeNotificationChangeListener(NotificationChangeListener listener)
listener
- the listener to remove.void addActionHandler(NotificationHandler handler)
handler
- The handler that executes the action.void removeActionHandler(java.lang.String actionType)
actionType
- The handler type to remove.java.lang.Iterable<NotificationHandler> getActionHandlers(java.lang.String actionType)
actionType
- the type for which the list of handlers should be
retrieved or null if all handlers shall be returned.NotificationData fireNotification(java.lang.String eventType, java.lang.String messageTitle, java.lang.String message, byte[] icon)
This method does nothing if the given eventType is not contained in the list of registered event types.
eventType
- the type of the event that we'd like to fire a
notification for.messageTitle
- the message title to use if and where appropriate
(e.g. with systray)message
- the message to use if and where appropriate (e.g. with
systray or log notification.)icon
- the icon to show in the notification if and where appropriateNotificationData fireNotification(java.lang.String eventType, java.lang.String messageTitle, java.lang.String message, byte[] icon, java.util.Map<java.lang.String,java.lang.Object> extras)
This method does nothing if the given eventType is not contained in the list of registered event types.
eventType
- the type of the event that we'd like to fire a
notification for.messageTitle
- the message title to use if and where appropriate
(e.g. with systray)message
- the message to use if and where appropriate (e.g. with
systray or log notification.)icon
- the icon to show in the notification if and where appropriateextras
- additional/extra NotificationHandler
-specific data
to be provided to the firing of the specified notification(s). The
well-known keys are defined by the NotificationData
XXX_EXTRA constants.NotificationData fireNotification(java.lang.String eventType)
This method does nothing if the given eventType is not contained in the list of registered event types.
eventType
- the type of the event that we'd like to fire a
notification for.void stopNotification(NotificationData data)
data
- the data that has been returned when firing the event..void setActive(java.lang.String eventType, boolean isActive)
eventType
- the name of the event, which actions should be activated
/deactivated.isActive
- indicates whether to activate or deactivate the actions
related to the specified eventType.boolean isActive(java.lang.String eventType)
false
if the given
eventType is not contained in the list of registered event types.eventType
- the name of the event (as defined by the plugin that's
registered it) that we are checking.true
if actions for the specified eventType
are activated, false
- otherwise. If the given
eventType is not contained in the list of registered event
types - returns false
.boolean isPlayingNotification(NotificationData data)
data
- Additional data for the event.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.