loading table of contents...

7.17.4. Displaying Notifications (Client Side)

For displaying notifications in CoreMedia Studio, three levels are distinguished:

  1. Simply displaying the notification in terms of a text message and an icon. For example, the notification might inform the user that a new publication workflow has arrived in its inbox.
  2. The same as in 1. but with an additional click action handler. For example, clicking the publication workflow notification might open the publication workflow inbox in the Studio Control Room.
  3. Completely customizing the display and controls of the notification.

Levels 1 and 2 are considered as the typical cases for displaying notifications. For these, CoreMedia offers default components. However, in certain cases it might be necessary/desired to develop a more refined notification UI.

Level 1: Simple Notification Display

For just displaying a notification in terms of an icon and a text message, you simply have to provide an icon class property and a text key property. These properties must match the patterns Notification_{notificationType}_iconCls and Notification_{notificationType}_{notificationKey}_msg respectively. For the example of a publication workflow notification from above, the properties look as follows:

Notification_publicationWorkflow_iconCls =
                publication-workflow-notification-icon
Notification_publicationWorkflow_offered_msg =
                 The workflow {0} is new in your inbox.

In this example, the message property has a placeholder. By default, the parameters of the notification (see notification creation above) are inserted in the placeholders one after the other. Consequently, the parameters have to be Strings. However, it is also possible to compute the placeholder insertions from the notification's parameters (for example, if you have a complex bean as a parameter that should be the basis for all placeholder insertions). In this case your notification's Studio component (see below) has to implement the interface com.coremedia.cms.editor.notification.components.TextParametersPreProcessor.

You define your properties in your own resource bundle (WorkflowNotifications_properties, for instance) and have to make sure to copy it onto the resource bundle com.coremedia.cms.editor.notification.Notifications_properties which is provided by us:

<editor:studioPlugin>
  <editor:configuration>
    <editor:copyResourceBundleProperties
            destination="{Notifications_properties}"
            source="{WorkflowNotifications_properties}"/>
  </editor:configuration>
</editor:studioPlugin>
Level 2: Simple Notification Display with Click Action

In many cases it is not enough to just display a notification. Normally, a notification is a request to the user to do something. So it should be possible to click the notification and be directed to the part of Studio where the user can do something about it.

In order to add an action click handler to your notification, you have to register your own notification component. You always register a notification component for a specific notification type:

<editor:studioPlugin>
  <editor:configuration>
    <notifications:registerNotificationDetailsPlugin
          notificationType="publicationWorkflow">
      <notifications:notificationDetailsComponentConfig>
        <wfnotifications:workflowNotificationDetailsComponent/>
      </notifications:notificationDetailsComponentConfig>
    </notifications:registerNotificationDetailsPlugin>
  </editor:configuration>
</editor:studioPlugin>

You do not have to do any component developing for level 2. You can simply let your notification component extend defaultNotificationDetails and add your notification action as its baseAction. You need to let your action extend NotificationAction. This yields numerous benefits like accessing the notification via the method NotificationAction.getNotification(). Consequently, you have also access to all the notification's parameters.

<exml:component ... >

  <notifications:defaultNotificationDetails>
    <baseAction>
      <wfnotifications:showInboxForWorkflowNotificationAction/>
    </baseAction>
  </notifications:defaultNotificationDetails>
</exml:component>
Level 3: Custom Notification Display

You are free to develop your own notification component that does not inherit from defaultNotificationDetails. CoreMedia gives no further guidelines here but point out that your component at least has to inherit from notificationDetails. You register your custom component just as it was described above.