public final class NotificationHelper extends Object
ServerNotificationHandler
.Constructor and Description |
---|
NotificationHelper(ServerNotificationHandler defaultNotificationHandler,
Class<? extends Notification> notificationClass,
boolean dynamicNotifications)
Creates a new
NotificationHelper that emits instances of notificationClass class. |
Modifier and Type | Method and Description |
---|---|
void |
fireNotification(Component source,
CoreEvent event,
ComponentLocation location,
int action)
Fires a
ConnectorMessageNotification for the given arguments using the ServerNotificationHandler associated
to the given event and based on a ComponentLocation . |
void |
fireNotification(Notification notification)
Fires the given
notification using the defaultNotificationHandler . |
boolean |
isNotificationEnabled()
Checks if the
defaultNotificationHandler is enabled to fire instances of notificationClass . |
public NotificationHelper(ServerNotificationHandler defaultNotificationHandler, Class<? extends Notification> notificationClass, boolean dynamicNotifications)
NotificationHelper
that emits instances of notificationClass
class.defaultNotificationHandler
- The ServerNotificationHandler
to be used on notifications which don't relate to a
CoreEvent
notificationClass
- The Class
of the notifications to be fired by this helperdynamicNotifications
- If true
, notifications will be fired directly to a ServerNotificationHandler
responsible to decide to emit it or not. If false
the notification will be checked to be enable or not at
creation timepublic boolean isNotificationEnabled()
defaultNotificationHandler
is enabled to fire instances of notificationClass
.true
if defaultNotificationHandler
is enabled for notificationClass
public void fireNotification(Component source, CoreEvent event, ComponentLocation location, int action)
ConnectorMessageNotification
for the given arguments using the ServerNotificationHandler
associated
to the given event
and based on a ComponentLocation
.source
- event
- a CoreEvent
location
- the location of the component that generated the notificationaction
- the action code for the notificationpublic void fireNotification(Notification notification)
notification
using the defaultNotificationHandler
.notification
- a Notification
Copyright © 2018. All rights reserved.