Main Content

mlreportgen.dom.MessageEventData Class

Namespace: mlreportgen.dom

Holds message triggering message event

Description

Contains the message that triggered a message event.

The mlreportgen.dom.MessageEventData class is a handle class.

Creation

Description

messageEventDataObj = MessageEventData(msg) creates a message event data object that contains a DOM message (for example, a message of type mlreportgen.dom.ProgressMessage).

The DOM message dispatcher attaches an object of this type to a message event when it dispatches a message. This enables message event listeners to retrieve the dispatched message. You need to create instances of this type only if you want to create your own message dispatcher.

example

Input Arguments

expand all

A message object, such as an mlreportgen.dom.ProgressMessage object, that triggers a message event.

Properties

expand all

Object identifier for the mlreportgen.dom.MessageEventData object, specified as a character vector or string scalar. The DOM API generates a session-unique identifier when it creates the document element object. You can specify your own value for Id.

Attributes:

NonCopyable
true

Data Types: char | string

The value of this read-only property is a DOM message object, such as an mlreportgen.dom.ProgressMessage object, that triggers a message event.

Tag for the mlreportgen.dom.MessageEventData object, specified as a character vector or string scalar. The DOM API generates a session-unique tag as part of the creation of this object. The generated tag has the form CLASS:ID, where CLASS is the object class and ID is the value of the Id property of the object. Specify your own tag value to help you identify where to look when an issue occurs during document generation.

Attributes:

NonCopyable
true

Data Types: char | string

Examples

collapse all

When you add a dispatcher, the DOM API creates the evtdata object, which is an mlreportgen.dom.MessageEventData object.

import mlreportgen.dom.*;
doctype = 'html';
d = Document('test', doctype);
d.Tag = 'My report';
     
dispatcher = MessageDispatcher.getTheDispatcher;
l = addlistener(dispatcher, 'Message', ...
   @(src, evtdata) disp(evtdata.Message.formatAsText));
     
open(d);
dispatch(dispatcher, ProgressMessage('starting chapter', d));
p = Paragraph('Chapter ');
p.Tag = 'chapter title';
p.Style = { CounterInc('chapter'), CounterReset('table'), WhiteSpace('pre') };
append(p, AutoNumber('chapter'));
append(d, p);
     
close(d);
rptview('test', doctype);

Delete the listener to avoid duplicate reporting of message objects during a MATLAB® session.

delete(l);

Version History

Introduced in R2014b