new mmir.PresentationManager()
Requires
- module:dialogManager
Members
-
private_currentDialogObject
-
The currently displayed dialog object, if a dialog is displayed. Used mainly to close the dialog.
-
private_layoutsDictionary
-
Array of layouts of the application
-
_pageIndexInteger
-
Counter that keeps track of the number of times, that a view is rendered NOTE: for implementation specific reasons, jQuery Mobile requires that each page has a different ID. This pageIndex is used to generating such a unique ID, by increasing the number on each page-change (i.e. by rendering a view) and appending it to the page's ID/name.
-
private_partialsDictionary
-
Array of all the partials of the application
-
private_renderEngineRenderEngine
-
Default implementation for the rendering-engine: does nothing but writing an error message to the console, if any of its functions is invoked. The rendering engine can be set via
mmir.PresentationManager#setRenderEngine. -
private_viewsDictionary
-
Array of all the views of the application
-
private,constantCONFIG_DEFAULT_LAYOUT_NAMEString
-
Name of the configuration property that specifies a custom name for the default layout.
NOTE: if FALSY (other than
undefined) no default layout will be loaded. Rendering views may fail, if they rely on aLayout!Example
var defaultLayout = mmir.const.get(mmir.presentation.CONFIG_DEFAULT_LAYOUT_NAME); -
private,constantDEFAULT_LAYOUT_NAMEString
-
Name for the default layout.
There must exist a layout definition by this name, i.e.
views/layout/
NOTE: while the name begins with an upper case letter, the file name for the layout must start with a lower case letter, e.g. for name.ehtml Default, the file name must bedefault.ehtml.Example
var defaultLayoutName = mmir.const.get(mmir.presentation.CONFIG_DEFAULT_LAYOUT); -
privateloggerLogger
-
The logger for the PresentationManager.
-
constantpageIndexInteger
-
-
privatepartialSeparatorString
-
-
privateviewSeparator
-
Methods
-
addLayout(layout)
-
Name Type Description layoutLayout the layout to add -
addPartial(ctrlName, partial)
-
Name Type Description ctrlNameString | Controller partialString | Partial -
addView(ctrlName, view)
-
Name Type Description ctrlNameString | Controller viewString | View -
callRenderEngine(funcName, args)
-
This function allows to call custom functions of the rendering-engine that was set via
setRenderEngine. IMPORTANT: note that the function will be invoked in context of rendering-engine (i.e.thisreferences will refer to rendering-engine and not to the PresentationManager instance. For example, whenmmir.PresentationManager.callRenderEngine('hideWaitDialog')is called, anythisreferences within thehideWaitDialogimplementation would refer to object, that was set insetRenderEngine(object). In comparison, when called asmmir.PresentationManager.hideWaitDialog()thethisreferences refer to the mmir.PresentationManager instance.
NOTE that calling non-existing functions on the rendering-engine will cause an error.Name Type Description funcNameString the name of the function, that should be invoked on the rendering engine. argsArray.<any> optional OPTIONAL the arguments for funcNameinvoked viaFunction.apply(renderingEngine, args), e.g. forargs = [param1, param2, param3]the function will be called withfuncName(param1, param2, param3)(note that the function receives 3 arguments, and not 1 Array-argument). -
privatecreateLookupKey()
-
-
privatecreatePartialKey()
-
-
privatecreateViewKey()
-
-
getLayout(layoutName, doUseDefaultIfMissing){Object}
-
This function returns a layout object by name.
Name Type Description layoutNameString Name of the layout which should be returned doUseDefaultIfMissingBoolean optional if supplied and true, the default controller's layout will be used as a fallback, in case no corresponding layout could be foundReturns:
requested layout, "false" if not found
-
getPartial(controllerName, viewName){Object}
-
This function returns a partial object by name.
Name Type Description controllerNameString Name of the controller for the view viewNameString Name of the partial which should be returned Returns:
requested partial, "false" if not found
-
getView(controllerName, viewName){Object}
-
This function returns a view object by name.
Name Type Description controllerNameString Name of the controller for the view viewNameString Name of the view which should be returned Returns:
requested view, false if not found
-
hideCurrentDialog()
-
Closes a modal window / dialog (if one is open).
-
hideWaitDialog()
-
Hides / closes the "wait" dialog.
-
-
render(ctrlName, viewName, data){void|Promise}
-
Gets the view for a controller, then executes helper methods on the view data. The Rendering of the view is done by the
doRenderViewmethod. Also stores the previous and current view with parameters.
Name Type Description ctrlNameString Name of the controller viewNameString Name of the view to render dataObject optional optional data for the view. Returns:
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)
-
setRenderEngine(theRenderEngine)
-
Sets the rendering engine for the views. The render engine must implement a function render and may implement functions showDialog, hideCurrentDialog, showWaitDialog, and hideWaitDialog:
- theRenderEngine.
render(ctrlName : String, viewName : String, view : View, ctrl : Controller, data : Object) : void|Promise - theRenderEngine.
showDialog(ctrlName : String, dialogId : String, data : Object) : Dialog - theRenderEngine.
hideCurrentDialog(): void - theRenderEngine.
showWaitDialog(text : String, data : Object): void - theRenderEngine.
hideWaitDialog(): void
theRenderEnginewill be called in context of the PresentationManager. Custom functions of the specific rendering engine implementation (i.e. non-standard functions) can be call viacallRenderEngine.
By default, the rendering-engine as defined by the module ID/path incore.viewEnginewill be loaded and set during initialization of the DialogManager.
The implementation of the default view-engine is atmmirf/env/view/presentation/simpleViewEngine.js.Name Type Description theRenderEngineObject the render-engine for views - theRenderEngine.
-
showDialog(ctrlName, dialogId, data){Object}
-
Opens the dialog for ID
dialogId.
Name Type Description ctrlNameString the Name of the controller dialogIdString the ID of the dialog dataObject optional OPTIONAL a data / options object Returns:
instance of the opened dialog (void or falsy if dialog was not opened)
-
showWaitDialog(text, data)
-
Shows a "wait" dialog, i.e. "work in progress" notification.
Name Type Description textString optional OPTIONAL the text that should be displayed. If omitted the language setting for loadingTextwill be used instead (from dictionary.json)dataObject optional OPTIONAL a data / options object