Studio Developer Manual / Version 2101
Table Of ContentsFor displaying notifications in CoreMedia Studio, three levels are distinguished:
- 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.
- 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.
- 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 or 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 = Resource(key='start_publication_workflow', bundle='com.coremedia.icons.CollaborationIcons') Notification_publicationWorkflow_offered_msg = The publication workflow "[u]{0}[/u]" 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:
<local:MyStudioPlugin ...> <fx:Metadata> ... </fx:Metadata> <fx:Script><![CDATA[ ... ]]></fx:Script> <local:configuration> <editor:CopyResourceBundleProperties destination="{ResourceManager.getInstance(). getResourceBundle( null, 'com.coremedia.cms.editor.notification.Notifications')}" source="{ResourceManager.getInstance().getResourceBundle( null, 'com.mycompany.WorkflowNotifications')}"/> </local:configuration> </local:MyStudioPlugin>
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:
<local:MyStudioPlugin ...> <fx:Metadata> ... </fx:Metadata> <fx:Script><![CDATA[ ... ]]></fx:Script> <local:configuration> <notifications:RegisterNotificationDetailsPlugin notificationType="publicationWorkflow"> <notifications:notificationDetailsComponentConfig> <collab:PublicationWorkflowNotificationDetails/> </notifications:notificationDetailsComponentConfig> </notifications:RegisterNotificationDetailsPlugin> </local:configuration> </local:MyStudioPlugin>
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.
<notifications:DefaultNotificationDetails ...> <fx:Metadata> ... </fx:Metadata> <fx:Script><![CDATA[ ... ]]></fx:Script> <notifications:baseAction> <local:MyNotificationAction/> </notifications:baseAction> </notifications:DefaultNotificationDetails>
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.