Class pvr.widget.View


Extends dijit.layout._LayoutWidget, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin.
Represents a view composed of an arbitrary containment of container and pvr.widget.Property widgets.

There are three ways to compose the view.

After composing the view, you must call the {@pvr.widget.View#bind} method to bind each pvr.widget.Property object defined in the view with its associated prv.controller._PropertyController object in the pvr.controller.PropertyCollectionController object. Each property has a "binding" setting that references its associated property controller. When the binding is resolved, an editor widget for the property is created, configured and populated based on the settings in both the property and the property controller. If the binding cannot be resolved, the property is removed from the view. Any empty containers are also removed from the view, provided they are not configured to remain in the view when empty.

The pvr.widget.registry.Registry object passed to the {@pvr.widget.View#bind} method is used to guide each property in selecting the appropriate editor widget to render. If the configured editor widget is invalid or if the view is system-generated, the registry will recommend an appropriate default editor widget for the property.


Defined in: <pvr\widget\View.js>.

Constructor Summary

Constructor Attributes Constructor Name and Description
 

Field Summary

Field Attributes Field Name and Description
 
A comparator function that provides the sort order of the properties included in a system-generated view.
 
The pvr.controller.PropertyCollectionController object provided in the binding.
 
Indicates whether the view is disabled.
 
filter 
A filter function that indicates which properties should be included in a system-generated view.
 
Indicates whether lazy loading will be supported in the view.
 
markup 
The markup associated with the view definition.
 
The collection of pvr.widget.Property objects contained in the view that were bound to a pvr.controller._PropertyController object.
 
An array of binding references for each property to be be included a system-generated view.
 
Indicates whether the view is read-only.
 
The pvr.widget.registry.Registry object provided in the binding.
 
The resources associated with the view definition.
 
The settings provided in the binding.
 
Indicates whether the progress dialog should be displayed when loading the view.
 
state 
The state of the view.

Method Summary

Method Attributes Method Name and Description
 
bind(controller, registry, settings, callback)
Binds the view to the specified pvr.controller.PropertyCollectionController object and calls the specified callback function when complete.
 
 
everyProperty(options)
Calls the specified callback function for the pvr.widget.Property objects included by the options.
 
forEachProperty(options)
Process each of the pvr.widget.Property objects included by the options.
 
getProperties(options)
Returns the pvr.view.Property objects included by the options.
 
getProperty(collectionId, propertyId)
Returns the pvr.widget.Property objects whose binding matches the specified property reference.
 
Indicates whether any property's value was modified.
 
 
mapProperty(options)
Creates a new array by processing the pvr.widget.Property objects included by the options.
 
An event called with the view is loaded.
 
 
Resets the modified state of every property.
 
someProperty(options)
Calls the specified callback function for the pvr.widget.Property objects included by the options.
 
Releases the binding of the view to the property collection controller.
 
Validates the properties and returns an array of pvr.widget.Property objects whose editors failed validation.

Constructor Detail

pvr.widget.View()

Field Detail

comparator

A comparator function that provides the sort order of the properties included in a system-generated view.

{object} controller

The pvr.controller.PropertyCollectionController object provided in the binding.

disabled

Indicates whether the view is disabled.

Use this setting to temporarily disable user input when loading the view, for example.


filter

A filter function that indicates which properties should be included in a system-generated view.

lazyLoad

Indicates whether lazy loading will be supported in the view.

markup

The markup associated with the view definition.

{object} properties

The collection of pvr.widget.Property objects contained in the view that were bound to a pvr.controller._PropertyController object.

propertyIds

An array of binding references for each property to be be included a system-generated view.

readOnly

Indicates whether the view is read-only.

Use this setting for a view that is for display only.


{object} registry

The pvr.widget.registry.Registry object provided in the binding.

resources

The resources associated with the view definition.

{object} settings

The settings provided in the binding.

showProgress

Indicates whether the progress dialog should be displayed when loading the view.

state

The state of the view. This value is determined internally and should never be set explicitly.

Method Detail

bind(controller, registry, settings, callback)

Binds the view to the specified pvr.controller.PropertyCollectionController object and calls the specified callback function when complete.

The specified pvr.widget.registry.Registry object is used to guide each property in selecting the appropriate editor widget to render.

A settings object provides extra guidance in the configuration of the view.

For every call to pvr.widget.View#bind there must be a matching call to pvr.widget.View#unbind to prevent memory leaks.

Parameters:
controller
The property collection controller.
registry
The registry.
settings
The settings.
callback
the callback function.

destroy()


everyProperty(options)

Calls the specified callback function for the pvr.widget.Property objects included by the options. Returns true if the callback function returns true for every pvr.view.Property object. Returns false and aborts on the first callback function that return false.
Parameters:
options
The options.
options.callback
The callback function to be called for each pvr.widgetProperty object that meets the criteria specified by the other options. The callback should return true if the processing should continue or false to abort the processing. (required)
options.filter
A filter function that indicates which properties should be included. (optional)
options.comparator
A comparator function that provides the sort order of the properties included. (optional)
Returns:
true if the callback function returns true for every pvr.view.Property object.

forEachProperty(options)

Process each of the pvr.widget.Property objects included by the options.
Parameters:
options
The options.
options.callback
The callback function to be called for each pvr.widgetProperty object that meets the criteria specified by the other options. (required)
options.filter
A filter function that indicates which properties should be included. (optional)
options.comparator
A comparator function that provides the sort order of the properties included. (optional)

getProperties(options)

Returns the pvr.view.Property objects included by the options.
Parameters:
options
The options.
options.filter
A filter function that indicates which properties should be included. (optional)
options.comparator
A comparator function that provides the sort order of the properties included. (optional)
Returns:
The array of pvr.view.Property objects.

getProperty(collectionId, propertyId)

Returns the pvr.widget.Property objects whose binding matches the specified property reference.

May return multiple pvr.widget.Property objects since the same property can be added to the view more than once.

The following method signatures are supported.

getProperty(collectionId, propertyId)
getProperty(binding)
getProperty({
	collectionId: collectionId,
	id: propertyId
})

Parameters:
collectionId
The identifier for the property collection.
propertyId
The identifier for the property.
Returns:
An array of pvr.view.Property objects.

isModified()

Indicates whether any property's value was modified.

Returns true even if the new value was not committed to the controller because of invalid data.

Returns:
true if any property's value was modified.

layout()


mapProperty(options)

Creates a new array by processing the pvr.widget.Property objects included by the options.
Parameters:
options
The options.
options.callback
The callback function to be called for each pvr.widgetProperty object that meets the criteria specified by the other options. The callback returns the corresponding value for the new array. (required)
options.filter
A filter function that indicates which properties should be included. (optional)
options.comparator
A comparator function that provides the sort order of the properties included. (optional)
Returns:
The new array.

onLoaded()

An event called with the view is loaded.

postMixInProperties()


resetModified()

Resets the modified state of every property.

someProperty(options)

Calls the specified callback function for the pvr.widget.Property objects included by the options. Returns true and aborts on the first callback function that returns true for any pvr.view.Property object. Returns false otherwise.
Parameters:
options
The options.
options.callback
The callback function to be called for each pvr.widgetProperty object that meets the criteria specified by the other options. The callback should return true to abort the processing or false if the processing should continue.(required)
options.filter
A filter function that indicates which properties should be included. (optional)
options.comparator
A comparator function that provides the sort order of the properties included. (optional)
Returns:
true if the callback function returns true for any pvr.view.Property object.

unbind()

Releases the binding of the view to the property collection controller.

For every call to pvr.widget.View#bind there must be a matching call to pvr.widget.View#unbind to prevent memory leaks.


validate()

Validates the properties and returns an array of pvr.widget.Property objects whose editors failed validation.

An empty array indicates that the data is valid.

Unbound Property objects are not included in the search.

Returns:
An array of invalid properties.