Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

消息视图定义消息如何在Pulse信息中心里显示,并且用户可以对这个消息做什么。Magnolia的default消息视图可以显示任何系统消息,并允许用户删除它们。在/modules/workflow/messageViews/workflow路径下workflow消息视图为一个比较高级的样例。

Table of Contents

定义

以下就是在/modules/ui-admincentral/messageViews/default里如何定义default消息视图。您可以拷贝或扩展为您自己的视图的起始点。

Advanced Tables - Table Plus
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
节点名

modules

 

ui-admincentral

 

messageViews

 

default

 

actions

 

delete

 

Paragraph

class

 info.magnolia.ui.admincentral.shellapp.pulse.message.action.DeleteMessageActionDefinition

Paragraph

icon

 icon-delete

Paragraph

label

Delete

form

 

tabs

 

message

 

fields

 

sender

 

Paragraph

class

 info.magnolia.ui.form.field.definition.TextFieldDefinition

Paragraph

label

Sender

message

 

Paragraph

class

 info.magnolia.ui.form.field.definition.TextFieldDefinition

Paragraph

label

Message text

Paragraph

rows

7

actionbar

 

sections

 

messageActions

 

groups

 

deleteActions

 

items

 

delete

 

Paragraph

label

Message actions

节点:

  • actions动作定义定义用户可以执行什么样的动作。例如,用户可以准许或拒绝一个已发布的页面。
  • form表单定义定义什么样的消息细节会在视图里显示,如发送者和对象。表单字段在消息视图里被绘制成静态文字,而不是可填写的字段。
  • actionbar动作栏定义引用在消息视图或其他地方定义的动作。动作栏在消息视图的旁边显示。

以下为default视图里消息看起来的样子。

在代码里使用视图

如果要在代码里使用您定制的消息视图,需要先在

Javadoc
0info.magnolia.ui.api.message.Message
对象上设置视图再发送它。

Code Block
languagejava
private sendMessageWithCustomView(String messageText) {
   final Message message = new Message();
   message.setMessage(messageText);
   message.setType(MessageType.INFO);
 
   // Name of the view as defined in the configuration
   message.setView("myCustomView");

   messagesManager.sendLocalMessage(message);
}