Namespace mmir.PresentationManager
Defined in: presentationManager.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
<private> |
The currently displayed dialog object, if a dialog is displayed.
|
<private> |
An object containing data for the currently displayed view.
|
<private> |
Array of layouts of the application
|
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.
|
|
<private> |
Array of all the partials of the application
|
<private> |
An object containing data for the previously displayed view - the one
displayed before the current view.
|
<private> |
Default implementation for the rendering-engine:
does nothing but writing an error message to the console,
if any of its functions is invoked.
|
<private> |
Array of all the views of the application
|
<private> <constant> |
Name of the configuration property that specifies whether or not to use
pre-compiled views, i.e.
|
<private> <constant> |
Name for the default layout.
|
<constant> | |
<private> | |
<private> |
Method Attributes | Method Name and Description |
---|---|
addPartial(ctrlName, partial)
|
|
addView(ctrlName, view)
|
|
callRenderEngine(funcName, args)
This function allows to call custom functions of the rendering-engine
that was set via #setRenderEngine.
|
|
<private> |
createLookupKey(ctrl, viewObj, separator)
|
<private> |
createPartialKey(ctrl, partial)
|
<private> |
createViewKey(ctrl, view)
|
getLayout(layoutName, doUseDefaultIfMissing)
This function returns a layout object by name.
|
|
getPartial(controllerName, viewName)
This function returns a partial object by name.
|
|
getView(controllerName, viewName)
This function returns a view object by name.
|
|
Closes a modal window / dialog (if one is open).
|
|
Hides / closes the "wait" dialog.
|
|
init()
|
|
Renders the previous view again, using the
mmir.DialogManager#render method.
|
|
renderView(ctrlName, viewName, data)
Gets the view for a controller, then executes helper methods on
the view data.
|
|
Renders the current view again, using the
#renderView method.
|
|
setRenderEngine(theRenderEngine)
Sets the rendering engine for the views.
|
|
showDialog(ctrlName, dialogId, data)
Opens the dialog for ID
dialogId . |
|
showWaitDialog(text, data)
Shows a "wait" dialog, i.e.
|
Namespace Detail
mmir.PresentationManager
- Requires:
- document (DOM object)
- jQuery.Deferred
- jQuery.ajax
- jQuery.each
Field Detail
<private>
{Object}
_currentDialog
The currently displayed dialog object, if a dialog is displayed. Used
mainly to close the dialog.
<private>
{View}
_currentView
An object containing data for the currently displayed view.
It contains: name of the corresponding controller, name of the view and optionally data for the view
It contains: name of the corresponding controller, name of the view and optionally data for the view
<private>
{Dictionary}
_layouts
Array of layouts of the application
{Integer}
_pageIndex
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>
{Dictionary}
_partials
Array of all the partials of the application
<private>
{View}
_previousView
An object containing data for the previously displayed view - the one
displayed before the current view.
It contains: name of the corresponding controller, name of the view and optionally data for the view
It contains: name of the corresponding controller, name of the view and optionally data for the view
- Deprecated:
- do not use
<private>
{RenderEngine}
_renderEngine
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>
{Dictionary}
_views
Array of all the views of the application
<private> <constant>
{String}
CONFIG_PRECOMPILED_VIEWS_MODE
Name of the configuration property that specifies whether or not to use
pre-compiled views, i.e. whether to use generated JavaScript files
instead of parsing & compiling the "raw" templates (eHTML files).
NOTE: the configuration value, that can be retrieved by querying this configuration-property
has is either a Boolean, or a String representation of a Boolean value:
[true|false|"true"|"false"]
NOTE2: There may be no value set at all in the configuration for this property.
In this case you should assume that it was set to false
.
var isUsePrecompiledViews = mmir.Constants.get(CONFIG_PRECOMPILED_VIEWS_MODE);
<private> <constant>
{String}
DEFAULT_LAYOUT_NAME
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 be default.ehtml
.
<constant>
{Integer}
pageIndex
<private>
{String}
partialSeparator
<private>
viewSeparator
Method Detail
addPartial(ctrlName, partial)
- Parameters:
- {String|Controller} ctrlName
- {String|Partial} partial
addView(ctrlName, view)
- Parameters:
- {String|Controller} ctrlName
- {String|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.
NOTE that calling non-existing functions on the rendering-engine will cause an error.
this
references will refer to rendering-engine
and not to the PresentationManager instance.
For example, when mmir.PresentationManager.callRenderEngine('hideWaitDialog')
is called, any this
references within the hideWaitDialog
implementation would refer to object, that was set in setRenderEngine(object)
.
In comparison, when called as mmir.PresentationManager.hideWaitDialog()
the
this
references refer to the mmir.PresentationManager instance.
NOTE that calling non-existing functions on the rendering-engine will cause an error.
- Parameters:
- {String} funcName
- the name of the function, that should be invoked on the rendering engine.
-
{Array
} args 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).
<private>
createLookupKey(ctrl, viewObj, separator)
- Parameters:
- ctrl
- viewObj
- separator
<private>
createPartialKey(ctrl, partial)
- Parameters:
- ctrl
- partial
<private>
createViewKey(ctrl, view)
- Parameters:
- ctrl
- view
getInstance()
- Deprecated:
- instead: use mmir.PresentationManager directly
{Object}
getLayout(layoutName, doUseDefaultIfMissing)
This function returns a layout object by name.
- Parameters:
- {String} layoutName
- Name of the layout which should be returned
- {Boolean} doUseDefaultIfMissing Optional
- if supplied and
true
, the default controller's layout will be used as a fallback, in case no corresponding layout could be found
- Returns:
- {Object} The requested layout, "false" if not found
{Object}
getPartial(controllerName, viewName)
This function returns a partial object by name.
- Parameters:
- {String} controllerName
- Name of the controller for the view
- {String} viewName
- Name of the partial which should be returned
- Returns:
- {Object} The requested partial, "false" if not found
{Object}
getView(controllerName, viewName)
This function returns a view object by name.
- Parameters:
- {String} controllerName
- Name of the controller for the view
- {String} viewName
- Name of the view which should be returned
- Returns:
- {Object} The requested view, false if not found
hideCurrentDialog()
Closes a modal window / dialog (if one is open).
hideWaitDialog()
Hides / closes the "wait" dialog.
init()
renderPreviousView()
Renders the previous view again, using the
mmir.DialogManager#render method.
- Deprecated:
- you should use #renderView with appropriate parameters instead.
- Requires:
- mmir.DialogManager
renderView(ctrlName, viewName, data)
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.
- Parameters:
- {String} ctrlName
- Name of the controller
- {String} viewName
- Name of the view to render
- {Object} data Optional
- optional data for the view.
Currently same jQuery Mobile specific properties are supported:
When these are present, they will be used for animating the page transition upon rendering.{transition: STRING, reverse: BOOLEAN}
where
transition
: the name for the transition (see jQuery Mobile Doc for possible values) DEFAULT: "none".reverse
: whether the animation should in "forward" (FALSE) direction, or "backwards" (TRUE) DEFAULT: FALSE
reRenderView()
Renders the current view again, using the
#renderView method.
- Deprecated:
- you should use #renderView with appropriate parameters instead.
- Requires:
- mmir.DialogManager
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:
By default, the rendering-engine as defined by the module ID/path in
The implementation of the default view-engine is at
- theRenderEngine.
render(ctrlName : String, viewName : String, view : View, ctrl : Controller, data : Object) : void
- 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 via #callRenderEngine.
By default, the rendering-engine as defined by the module ID/path in
core.viewEngine
will be loaded and set during initialization
of the DialogManager.
The implementation of the default view-engine is at
mmirf/env/view/presentation/jqmViewEngine.js
.
- Parameters:
- {Object} theRenderEngine
- the render-engine for views
- See:
- mmir.PresentationManager#renderView
- mmir.PresentationManager#showDialog
- mmir.PresentationManager#hideCurrentDialog
- mmir.PresentationManager#showWaitDialog
- mmir.PresentationManager#hideWaitDialog
- mmir.PresentationManager#callRenderEngine
{Object}
showDialog(ctrlName, dialogId, data)
Opens the dialog for ID
dialogId
.
- Parameters:
- {String} ctrlName
- the Name of the controller
- {String} dialogId
- the ID of the dialog
- {Object} data Optional
- OPTIONAL a data / options object
- Returns:
- {Object} the instance of the opened dialog (void or falsy dialog was not opened)
showWaitDialog(text, data)
Shows a "wait" dialog, i.e. "work in progress" notification.
- Parameters:
- {String} text Optional
- OPTIONAL
the text that should be displayed.
If omitted the language setting for
loadingText
will be used instead (from dictionary.json) - {Object} data Optional
- OPTIONAL a data / options object