Main Content

mlreportgen.dom.MessageDispatcher Class

Namespace: mlreportgen.dom

DOM message dispatcher

Description

Dispatcher for document generation status messages.

Note

When you create a message dispatcher, the DOM API keeps the dispatcher until the end of the current MATLAB® session. Delete message event listeners to avoid duplicate reporting of message objects during a MATLAB session.

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

Properties

expand all

Message filter that determines the types of messages the dispatcher dispatches, specified as a character vector or a string scalar. You can control the types of messages that are dispatched by setting the properties of the filter.

Attributes:

GetAccess
public
SetAccess
protected
NonCopyable
true
Transient
true

Data Types: char | string

Tag, 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. Use this value to help identify where an issue occurs during document generation.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

Object identifier, specified as a character vector or string scalar. The DOM API generates a session-unique identifier when it creates the document element object.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

Methods

expand all

Examples

collapse all

This example shows how to add a progress message to display when generating a report.

Add a dispatcher and listener to the report.

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";
append(d,p);
     
close(d);
rptview("test",doctype);

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

delete(l);

Check the progress messages in the MATLAB Command Window. The starting chapter message appears, in addition to the predefined DOM progress messages.

Version History

Introduced in R2014b