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.View

Extends M.Object.
M.View defines the prototype for any view within The M-Project. It implements lots of basic properties and methods that are used in many derived views. M.View specifies a default behaviour for functionalities like rendering, theming, delegating updates etc.
Defined in: view.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| M.View()

Field Summary
Field Attributes | Field Name and Description
--- | ---
| childViews An array specifying the view's children.
| contentBinding The path to a content that is bind to the view's value.
| cssClass This property can be used to assign a css class to the view to get a custom styling.
| cssClassOnError This property can be used to assign a css class to the view if an error occurs.
| cssClassOnInit This property can be used to assign a css class to the view on its initialization.
| cssStyle This property can be used to assign a css style to the view.
| hasFocus Indicates whether this view currently has the focus or not.
| html This property is used internally to recursively build the pages html representation.
| id The id of the view used for the html attribute id.
| isInline Indicates whether the view should be displayed inline or not.
| isView A boolean value to definitely recognize a view as a view, independent on its concrete type, e.g.
| modelId If a view represents a model, e.g.
| parentView This property can be used to save a reference to the view's parent view.
| triggerActionOnChange Determines whether an onChange event will trigger a defined action or not.
| triggerActionOnEnter Determines whether an onKeyUp event with the enter button will trigger a defined action or not.
| triggerActionOnKeyUp Determines whether an onKeyUp event will trigger a defined action or not.
| type The type of this object.
| value The value property is a generic property for all values.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| addCssClass(cssClass) Adds a css class to the view's DOM representation.
| attachToObservable(contentBinding) This method attaches the view to an observable to be later notified once the observable's state did change.
| clearHtml() Clears the html property of a view and triggers the same method on all of its child views.
| computeValue() If the view's computedValue property is set, compute the value.
| contentDidChange() The contentDidChange method is automatically called by the observable when the observable's state did change.
| delegateValueUpdate() This method delegates any value changes to a controller, if the 'contentBindingReverse' property is specified.
| design(obj) This method encapsulates the 'extend' method of M.Object for better reading of code syntax.
| gotFocus() This method is called whenever the view got the focus and basically only sets the view's hasFocus property to YES.
| lostFocus() This method is called whenever the view lost the focus and basically only sets the view's hasFocus property to NO.
| nl2br(str) This method parses a given string, replaces any new line, '\n', with a line break, ' ', and returns the modified string.
| removeCssClass(cssClass) Removes a css class to the view's DOM representation.
| removeCssProperty(key) Removes a css property from the view's DOM representation.
| renderUpdate()
| secure(str) This method secure the passed string.
| setCssProperty(key, value) Adds or updates a css property to the view's DOM representation.
| setValueFromDOM()
| style()
| theme() This method is a basic implementation for theming a view.
| themeChildViews() This method triggers the theme method on all children.

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

Class Detail
M.View()
Field Detail
{Array} childViews
An array specifying the view's children.

contentBinding
The path to a content that is bind to the view's value.

{String} cssClass
This property can be used to assign a css class to the view to get a custom styling.

{String} cssClassOnError
This property can be used to assign a css class to the view if an error occurs. The applying of this class is automatically triggered if the validation of the view goes wrong. This property is mainly used by input views, e.g. M.TextFieldView.

{String} cssClassOnInit
This property can be used to assign a css class to the view on its initialization. This property is mainly used for input ui elements like text fields, that might have a initial value that should be rendered in a different style than the later value entered by the user. This property is mainly used by input views, e.g. M.TextFieldView.

{String} cssStyle
This property can be used to assign a css style to the view. This allows you to create your custom styles inline.

{Boolean} hasFocus
Indicates whether this view currently has the focus or not.

{String} html
This property is used internally to recursively build the pages html representation. It is once set within the render method and then eventually updated within the renderUpdate method.

id
The id of the view used for the html attribute id. Every view gets its own unique id during the rendering process.

isInline
Indicates whether the view should be displayed inline or not. This property isn't supported by all views, but e.g. by M.LabelView or M.ButtonView.

{Boolean} isView
A boolean value to definitely recognize a view as a view, independent on its concrete type, e.g. M.ButtonView or M.LabelView.

modelId
If a view represents a model, e.g. within a list view, this property is used to save the model's id. So the view can be used to get to the record.

parentView
This property can be used to save a reference to the view's parent view.

{Boolean} triggerActionOnChange
Determines whether an onChange event will trigger a defined action or not. This property is basically interesting for input ui elements, e.g. for text fields.

{Boolean} triggerActionOnEnter
Determines whether an onKeyUp event with the enter button will trigger a defined action or not. This property is basically interesting for input ui elements, e.g. for text fields.

{Boolean} triggerActionOnKeyUp
Determines whether an onKeyUp event will trigger a defined action or not. This property is basically interesting for input ui elements, e.g. for text fields.

{String} type
The type of this object.

value
The value property is a generic property for all values. Even if not all views really use it, e.g. the wrapper views like M.ButtonGroupView, most of it do.
Method Detail
addCssClass(cssClass)
Adds a css class to the view's DOM representation.

Parameters:
{String} cssClass
  The css class to be added.

attachToObservable(contentBinding)
This method attaches the view to an observable to be later notified once the observable's state did change.

Parameters:
{String} contentBinding
  The path to the observable property.

clearHtml()
Clears the html property of a view and triggers the same method on all of its child views.

computeValue()
If the view's computedValue property is set, compute the value. This allows you to apply a method to a dynamically set value. E.g. you can provide your value with an toUpperCase().

contentDidChange()
The contentDidChange method is automatically called by the observable when the observable's state did change. It then updates the view's value property based on the specified content binding.

delegateValueUpdate()
This method delegates any value changes to a controller, if the 'contentBindingReverse' property is specified.

design(obj)
This method encapsulates the 'extend' method of M.Object for better reading of code syntax. It triggers the content binding for this view, gets an ID from and registers itself at the ViewManager.

Parameters:
{Object} obj
  The mixed in object for the extend call.

gotFocus()
This method is called whenever the view got the focus and basically only sets the view's hasFocus property to YES. If a more complex behaviour is desired, a view has to overwrite this method.

lostFocus()
This method is called whenever the view lost the focus and basically only sets the view's hasFocus property to NO. If a more complex behaviour is desired, a view has to overwrite this method.

{String} nl2br(str)
This method parses a given string, replaces any new line, '\n', with a line break, '
', and returns the modified string. This can be useful especially for input views, e.g. it is used in context with the M.TextFieldView.

Parameters:
{String} str
  The string to be modified.

Returns:
  {String} The modified string.

removeCssClass(cssClass)
Removes a css class to the view's DOM representation.

Parameters:
{String} cssClass
  The css class to be added.

removeCssProperty(key)
Removes a css property from the view's DOM representation.

Parameters:
{String} key
  The property's name.

renderUpdate()

{String} secure(str)
This method secure the passed string. It is mainly used for securing input elements like M.TextFieldView but since it is part of M.View it can be used and called out of any view. So far we only replace '<' and '>' with their corresponding html entity. The functionality of this method will be extended in the future. If a more complex behaviour is desired, any view using this method has to overwrite it.

Parameters:
{String} str
  The string to be secured.

Returns:
  {String} The secured string.

setCssProperty(key, value)
Adds or updates a css property to the view's DOM representation.

Parameters:
{String} key
  The property's name.
{String} value
  The property's value.

setValueFromDOM()

style()

theme()
This method is a basic implementation for theming a view. It simply calls the themeChildViews method. Most views overwrite this method with a custom theming behaviour.

themeChildViews()
This method triggers the theme method on all children.

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