Class Index | File Index

## Classes

- _global_
- M
- M.ActionSheetDialogView
- M.AlertDialogView
- M.Application
- M.Base64
- M.ButtonGroupView
- M.ButtonView
- M.ConfirmDialogView
- M.ContainerView
- M.Controller
- M.Cypher
- M.DataProvider
- M.Date
- M.DateValidator
- M.EmailValidator
- M.Environment
- M.EventDispatcher
- M.FormView
- M.GridView
- M.I18N
- M.ImageView
- M.LabelView
- M.ListItemView
- M.ListView
- M.LoaderView
- M.LocalStorageProvider
- M.Logger
- M.Math
- M.Model
- M.ModelAttribute
- M.ModelRegistry
- M.NotMinusValidator
- M.NumberValidator
- M.Object
- M.Observable
- M.PageView
- M.PhoneValidator
- M.PresenceValidator
- M.RecordManager
- M.RemoteStorageProvider
- M.Request
- M.ScrollView
- M.SearchBarView
- M.SelectionListItemView
- M.SelectionListView
- M.SHA256
- M.TabBarItemView
- M.TabBarView
- M.TextFieldView
- M.ToggleView
- M.ToolbarView
- M.UrlValidator
- M.Validator
- M.View
- M.ViewManager
- M.WebSqlProvider

# 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
--- | ---
| M.ViewManager()

Field Summary
Field Attributes | Field Name and Description
--- | ---
| currentPage A reference to the currently displayed page.
| foundView A reference to the latest found view which is necessary for the findView() method.
| idPrefix Prefix for Id.
| nextId The nextId delivered to a view (used as html id attribute value) with prefix m_.
| type The type of this object.
| viewList Array containing all views used in the application.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| findView() Searches for a certain view within a given parent view.
| getCurrentPage() Returns the currently displayed page.
| getIdByView() Returns the id for a given view.
| getNextId() Returns the next Id build from nextId property incremented by 1 and the prefix.
| getPage() Returns the page object from the view list array identified by its name.
| getView() Returns the view object from the view list array identified by the view's name and its page.
| getViewById(id) 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.
| setCurrentPage(page) Sets the currently displayed page.

Methods borrowed from class M.Object:
  bindToCaller, create, destroy, extend, get, include, set

Class Detail
M.ViewManager()
Field Detail
{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.

{String} type
The type of this object.

{Object} viewList
Array containing all views used in the application.
Method Detail
{Object} findView()
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} getCurrentPage()
Returns the currently displayed page.

Returns:
  {Object} The currently displayed page.

{String} getIdByView()
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()
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()
Returns the view object from the view list array identified by the view's name and its page. If there are multiple views with the same name on the same page, the first result is returned. Note: Try to use unique names for your views within the same page!

Parameters:
{String|Object} parentView.
  The name of the parent view 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

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.

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Dec 08 2010 15:07:35 GMT+0100 (MEZ)