Class: DialogManager

DialogManager

new mmir.compat.v4.DialogManager()

Backwards compatibility for DialogManager (<= version 4.x): (re-)adds the following methods/functionality to the DialogManager instance: * perform(ctrlName, actionName, data) * performHelper(ctrlName, helperActionName, data) * showDialog(ctrlName, dialogId, data) * hideCurrentDialog() * showWaitDialog(text, theme) * hideWaitDialog() * render(ctrlName, viewName, data) * getOnPageRenderedHandler() * setOnPageRenderedHandler(handlerFunction) * _setControllerManager(controllerManager) * _setPresentationManager(presentationManager)
Example
//extend DialogManager with helper/shortcut functions (e.g for <= v4.x backwards compatibility):
var dialogManager = require('mmirf/dialogManager');
//or: var dialogManager = mmir.dialog;
require('mmirf/dialogManager4Compatibility')(dialogManager);
dialogManager.render('Application', 'welcome').then(function(){ console.log('rendered welcome view') })

Requires

  • module:mmir.ControllerManager
  • module:mmir.PresentationManager

Methods

Get the current on-page-rendered hook function (if it was set).
Name Type Description
the function onPageRendered handler (NOTE: this may not be set, i.e. undefined)
This function closes a dialog of a controller by calling the method mmir.PresentationManager#hideCurrentDialog of the mmir.PresentationManager
Hides / closes the "wait" dialog. This is a shortcut for calling mmir.PresentationManager#hideWaitDialog (see documentation in PresentationManager for parameters).
See:

perform(ctrlName, actionName, data){Object}

This function performs an action of a controller by calling the method mmir.ControllerManager#perform of the mmir.ControllerManager
Name Type Description
ctrlName String Name of the controller to which the action belongs
actionName String Name of the action that should be performed
data Object optional data that can be submitted to the action
Returns:
Type Description
Object the return object of the performed action

performHelper(ctrlName, helper_method_name, data){Object}

This function performs an action of a helper-class for a controller by calling the method mmir.ControllerManager#performHelper of the mmir.ControllerManager
Name Type Description
ctrlName String Name of the controller to which the helper action belongs
helper_method_name String Name of the action that should be performed by the helper
data Object optional data that can be submitted to the action
Returns:
Type Description
Object the return object of the performed action

render(ctrlName, viewName, data){void|Promise}

This function displays a view of a controller by calling the method mmir.PresentationManager#renderView of the mmir.PresentationManager.
And after rendering, the function set via #setOnPageRenderedHandler will called in context of the controller instance with arguments: Controller.onPageRenderedFunc(ctrlName, viewName, data)
Name Type Description
ctrlName String Name of the controller to which the view belongs
viewName String Name of the view that should be rendered
data Object Optional data that can be submitted to the generation of the view
Returns:
Type Description
void | Promise if void/undefined is returned, the view is rendered synchronously, i.e. the view is rendered, when this method returns. If a Promise is returned, the view is rendered asynchronously (rendering is finished, when the promise is resolved)

setOnPageRenderedHandler(onPageRenderedHook)

Set the on_page_loaded callback function. If onPageRenderedHook is a function object, it will be executed after a view is rendered and after the view's controller on_page_load function(s) has/have been executed.

This function will be executed after the view's on_page_load()-function.
The onPageRenderedHook function takes 3 arguments that refer to the parameters with which the render-function was invoked:
{String} ctrlName Name of the controller to which the view belongs
{String} viewName Name of the view that should be rendered
{Object} [data] Optional data that can be submitted to the generation of the view

Name Type Description
onPageRenderedHook function a callback function that will be executed after a view was rendered i.e. after a page was loaded.

showDialog(ctrlName, dialogId, data)

This function displays a dialog of a controller by calling the method mmir.PresentationManager#showDialog of the mmir.PresentationManager
Name Type Description
ctrlName String Name of the controller to which the dialog belongs
dialogId String Id of the dialog that should be displayed
data Object Optional data that can be submitted to the dialog
Shows a "wait" dialog, indicating work-in-progress. This is a shortcut for calling mmir.PresentationManager#showWaitDialog (see documentation in PresentationManager for parameters).
See: