mmir.PresentationManager
Requires
- module:dialogManager
Members
-
_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.
-
constantpageIndexInteger
-
Methods
-
addLayout(layout)
-
Name Type Description layoutmmir.view.Layout the layout to add -
addPartial(ctrlName, partial)
-
Name Type Description ctrlNameString | Controller partialString | mmir.view.Partial -
addView(ctrlName, view)
-
Name Type Description ctrlNameString | Controller viewString | mmir.view.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). -
getLayout(layoutName, doUseDefaultIfMissing){mmir.view.Layout}
-
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:
Type Description mmir.view.Layout The requested layout, "false" if not found -
getPartial(controllerName, viewName){mmir.view.Partial}
-
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:
Type Description mmir.view.Partial The requested partial, "false" if not found -
getView(controllerName, viewName){mmir.view.View}
-
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:
Type Description mmir.view.View The requested view, false if not found -
hideCurrentDialog()
-
Closes a modal window / dialog (if one is open).
-
hideWaitDialog()
-
Hides / closes the "wait" dialog.
-
asyncinit(){Promise}
-
Returns:
Type Description Promise a deferred promise that gets fulfilled when initialization is completed. -
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:
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) -
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:
Type Description Object the 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