Class Index | File Index

Classes


Class M.ViewManager


Extends M.Object.
The ViewManager manages and knows all views that are used in the application. The ViewManager is part of M.Application. It is used by various other components (e.g. controller: switchToPage) to connect from javascript objects to their HTML representation.
Defined in: view_manager.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
 
A reference to the currently rendered page.
 
A reference to the currently displayed page.
 
A reference to the latest found view which is necessary for the findView() method.
 
Prefix for Id.
 
The nextId delivered to a view (used as html id attribute value) with prefix m_.
 
An associative array containing all pages used in the application.
 
The type of this object.
 
An associative array containing all views used in the application.
Method Summary
Method Attributes Method Name and Description
 
findView(parentView, targetView)
Searches for a certain view within a given parent view.
 
another naming for getViewById - same same as getViewById
 
Returns the currently displayed page.
 
Returns the id for a given view.
 
Returns the next Id build from nextId property incremented by 1 and the prefix.
 
getPage(pageName)
Returns the page object from the view list array identified by its name.
 
getView(parentView, targetView)
Returns the view object from the view list array identified by the view's name and its surrounding view.
 
Returns the view object from the view list array identified by the value of its id attribute.
 
register(view)
Adds the view to the viewlist array.
 
Sets the currently displayed page.
 
unregister(view)
Unregisters the view from the viewlist array.
Methods borrowed from class M.Object:
bindToCaller, create, destroy, extend, get, include, set
Class Detail
M.ViewManager()
Field Detail
{Object} currentlyRenderedPage
A reference to the currently rendered page.

{Object} currentPage
A reference to the currently displayed page.

{Object} foundView
A reference to the latest found view which is necessary for the findView() method.

{String} idPrefix
Prefix for Id.

{Number} nextId
The nextId delivered to a view (used as html id attribute value) with prefix m_. Initial state is 0, will be incremeneted by 1 on each call.

{Object} pageList
An associative array containing all pages used in the application. The key for a page is its id.

{String} type
The type of this object.

{Object} viewList
An associative array containing all views used in the application. The key for a view is its id.
Method Detail
{Object} findView(parentView, targetView)
Searches for a certain view within a given parent view. If it is found, the result is returned. Otherwise the search algorithm checks for possible child views and then recursively searches within these child views for the target view. This method is mainly used by the getView() method to find a view within a page.
Parameters:
{Object} parentView
The parent view to search in.
{String} targetView
The name of the view to be returned.
Returns:
{Object} The last found view.

{Object} findViewById(id)
another naming for getViewById - same same as getViewById
Parameters:
{String} id
The DOM id of the corresponding view object.
Returns:
{Object} The view object from the view list identified by id.

{Object} getCurrentPage()
Returns the currently displayed page.
Returns:
{Object} The currently displayed page.

{String} getIdByView(view)
Returns the id for a given view.
Parameters:
{Object} view
The view for which the id value is wanted.
Returns:
{String} The id of a view object.

{String} getNextId()
Returns the next Id build from nextId property incremented by 1 and the prefix. The id is used as the value for the HTML attribute id.
Returns:
{String} The next id for a view, e.g. 'm_123' (if last id was 'm_122').

{Object} getPage(pageName)
Returns the page object from the view list array identified by its name. If there are multiple pages with the same name, the first result is returned. Note: Try to use unique names for your pages!
Parameters:
{String} pageName
The name of the page to be returned.
Returns:
{Object} M.Page object identified by its name.

{Object} getView(parentView, targetView)
Returns the view object from the view list array identified by the view's name and its surrounding view. If there are multiple views with the same name on the same surrounding view, the first result is returned. Note: Try to use unique names for your views within the same surrounding view!
Parameters:
{String|Object} parentView
The name of the parent view (if it is a page) or the parent view itself.
{String} targetView
The name of the view to be returned.
Returns:
{Object} The view object from the view list identified by the view's name and the page where it's on.

{Object} getViewById(id)
Returns the view object from the view list array identified by the value of its id attribute.
Parameters:
{String} id
The DOM id of the corresponding view object.
Returns:
{Object} The view object from the view list identified by id.

register(view)
Adds the view to the viewlist array.
Parameters:
{Object} view
The view to be registered in the viewlist.

setCurrentPage(page)
Sets the currently displayed page.
Parameters:
{Object} page
The page to be set as current page.

unregister(view)
Unregisters the view from the viewlist array.
Parameters:
{Object} view
The view to be unregistered from the viewlist.

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Jan 25 2012 20:41:11 GMT+0100 (MEZ)