Notifications are banner-type messages that inform the user about system
and app events. Notifications are displayed prominently at the top of
the Magnolia UI. They capture the user’s attention effectively but do
not interrupt what the user is currently working on. Notifications are
the only persistent message type. The user can safely close the
notification banner and read the full message in the
Notifications app later.
Showing a notification message in app code
To show a notification message:
Inject MessagesManager into your class so that you can
access the messaging convenience methods. Create a new info.magnolia.ui.api.message.Message
object. Pass info.magnolia.ui.api.message.MessageType
only if you want to create your own message types.
@InjectpublicMyClass(MessagesManager messagesManager){
this.messagesManager = messagesManager
}
publicvoidhandleGroupMessage(final String group, final MessageType type, final String subject, final String message){
messagesManager.sendGroupMessage(group, new Message(type, subject, message));
}Copy
Showing a notification to a named user
MessagesManager provides convenience methods for sending messages. The user
will be notified instantly with a notification banner if they are
currently signed in. In any case, the message is stored in the
Notifications app.
The users in the group will be notified instantly with a notification
banner if they are currently signed in. In any case, the message is
stored in the Notifications app.
The current user will be notified with a notification banner.
voidsendLocalMessage(Message message);
}Copy
Broadcast a notification message to all users
The users will be notified instantly with a notification banner if they
are currently signed in. In any case, the message will be stored in the
Notifications app.
voidbroadcastMessage(Message message);Copy
See info.magnolia.ui.framework.message.MessagesManager for more information.
Sending a notification using the Messages app
The Messages app is a tool that
allows you to send notifications to individual users, groups or all
users. This app is only available to the superuser role by default, as
configured in app
launcher permissions.