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 layout
mmir.view.Layout the layout to add -
addPartial(ctrlName, partial)
-
Name Type Description ctrlName
String | Controller partial
String | mmir.view.Partial -
addView(ctrlName, view)
-
Name Type Description ctrlName
String | Controller view
String | 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.this
references will refer to rendering-engine and not to the PresentationManager instance. For example, whenmmir.PresentationManager.callRenderEngine('hideWaitDialog')
is called, anythis
references within thehideWaitDialog
implementation would refer to object, that was set insetRenderEngine(object)
. In comparison, when called asmmir.PresentationManager.hideWaitDialog()
thethis
references refer to the mmir.PresentationManager instance.
NOTE that calling non-existing functions on the rendering-engine will cause an error.Name Type Description funcName
String the name of the function, that should be invoked on the rendering engine. args
Array.<any> optional OPTIONAL the arguments for funcName
invoked 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 layoutName
String Name of the layout which should be returned doUseDefaultIfMissing
Boolean 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 controllerName
String Name of the controller for the view viewName
String 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 controllerName
String Name of the controller for the view viewName
String 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
doRenderView
method. Also stores the previous and current view with parameters.
Name Type Description ctrlName
String Name of the controller viewName
String Name of the view to render data
Object 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
theRenderEngine
will 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.viewEngine
will 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 theRenderEngine
Object the render-engine for views - theRenderEngine.
-
showDialog(ctrlName, dialogId, data){Object}
-
Opens the dialog for ID
dialogId
.
Name Type Description ctrlName
String the Name of the controller dialogId
String the ID of the dialog data
Object 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 text
String optional OPTIONAL the text that should be displayed. If omitted the language setting for loadingText
will be used instead (from dictionary.json)data
Object optional OPTIONAL a data / options object