Main Content

mlreportgen.dom.MessageEventData class

Package: 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

example

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.

Input Arguments

expand all

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

Properties

expand all

ID for this document element, specified as a character vector or string scalar. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

Attributes:

GetAccess
public
SetAccess
public
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 this document element, specified as a character vector or string scalar.

The DOM 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. Specifying your own tag value can help you to identify where an issue occurred during document generation.

Attributes:

GetAccess
public
SetAccess
public
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