From 4565558afff6fb07db3b5165042e028f467ac41b Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Thu, 21 Jun 2012 15:46:26 -0700 Subject: Binding View :Requested Changes for Pull Request Signed-off-by: Armen Kesablyan --- js/controllers/objects-controller.js | 6 - js/data/tools-data.js | 2 +- js/document/templates/html/index.html | 5 +- js/document/views/design.js | 3 +- .../objects/objects-panel.reel/objects-panel.js | 15 --- .../non-visual-component.css | 5 - .../non-visual-component.html | 27 ----- .../non-visual-component.js | 18 --- node_modules/montage/core/event/binding.js | 134 +++++++++------------ 9 files changed, 59 insertions(+), 156 deletions(-) delete mode 100755 js/stage/binding-view.reel/non-visual-component.reel/non-visual-component.css delete mode 100755 js/stage/binding-view.reel/non-visual-component.reel/non-visual-component.html delete mode 100755 js/stage/binding-view.reel/non-visual-component.reel/non-visual-component.js diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 54ff14ba..3e35ef5f 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -47,12 +47,6 @@ var objectsController = exports.ObjectsController = Montage.create(Montage, { Object.deleteBinding(this, 'objects'); this._isBoundToModelObjects = true; } - -// Object.defineBinding(this, 'objects', { -// boundObject: this.currentDocument.model, -// boundObjectPropertyPath: 'mObjects', -// oneway: false -// }); } }, diff --git a/js/data/tools-data.js b/js/data/tools-data.js index fb195bd3..8ed6433e 100755 --- a/js/data/tools-data.js +++ b/js/data/tools-data.js @@ -47,7 +47,7 @@ exports.ToolsData = Montage.create(Montage, { value: 12 }, bindingToolIndex: { - value: 12 + value: 13 }, // NOTE: additions or removal of any tools, or any changes in the order of these entries requires updating the constant index properties above. diff --git a/js/document/templates/html/index.html b/js/document/templates/html/index.html index bee2e557..8fc0d82f 100755 --- a/js/document/templates/html/index.html +++ b/js/document/templates/html/index.html @@ -113,10 +113,7 @@ diff --git a/js/document/views/design.js b/js/document/views/design.js index 6a6f565d..4a75a1b4 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -454,8 +454,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { initMontage: { value: function (scripttags) { var self = this; - // - //debugger; + this.iframe.contentWindow.document.body.addEventListener('mjsTemplateReady', function () { //Initializing template with user's seriliazation var template = this.iframe.contentWindow.mjsTemplate.create(); diff --git a/js/panels/objects/objects-panel.reel/objects-panel.js b/js/panels/objects/objects-panel.reel/objects-panel.js index a1c381a2..727a09aa 100644 --- a/js/panels/objects/objects-panel.reel/objects-panel.js +++ b/js/panels/objects/objects-panel.reel/objects-panel.js @@ -23,13 +23,6 @@ exports.ObjectsPanel = Montage.create(Component, { } }, - - templateDidLoad: { - value: function() { - console.log('objects panel loaded'); - } - }, - prepareForDraw : { value: function() { @@ -40,14 +33,6 @@ exports.ObjectsPanel = Montage.create(Component, { }); } - }, - draw : { - value: function() { - console.log("objects panel draw"); - if(this.objects) { - - } - } } }); \ No newline at end of file diff --git a/js/stage/binding-view.reel/non-visual-component.reel/non-visual-component.css b/js/stage/binding-view.reel/non-visual-component.reel/non-visual-component.css deleted file mode 100755 index 018448f1..00000000 --- a/js/stage/binding-view.reel/non-visual-component.reel/non-visual-component.css +++ /dev/null @@ -1,5 +0,0 @@ -/* - This file contains proprietary software owned by Motorola Mobility, Inc.
- No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
- (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ diff --git a/js/stage/binding-view.reel/non-visual-component.reel/non-visual-component.html b/js/stage/binding-view.reel/non-visual-component.reel/non-visual-component.html deleted file mode 100755 index 10abb38d..00000000 --- a/js/stage/binding-view.reel/non-visual-component.reel/non-visual-component.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - -
Label for options
- - diff --git a/js/stage/binding-view.reel/non-visual-component.reel/non-visual-component.js b/js/stage/binding-view.reel/non-visual-component.reel/non-visual-component.js deleted file mode 100755 index 2ff2e2f7..00000000 --- a/js/stage/binding-view.reel/non-visual-component.reel/non-visual-component.js +++ /dev/null @@ -1,18 +0,0 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -/** -@requires montage/core/core -@requires montage/ui/component -*/ -var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component; - -exports.NonVisualComponent = Montage.create(Component, { - title: { - value: "value" - } -}); \ No newline at end of file diff --git a/node_modules/montage/core/event/binding.js b/node_modules/montage/core/event/binding.js index 4206e1c2..4091fe6a 100755 --- a/node_modules/montage/core/event/binding.js +++ b/node_modules/montage/core/event/binding.js @@ -5,13 +5,13 @@ */ /** - @module montage/core/event/binding - @requires montage/core/core - @requires montage/core/event/mutable-event - @requires montage/core/serializer - @requires montage/core/deserializer - @requires montage/core/event/event-manager -*/ + @module montage/core/event/binding + @requires montage/core/core + @requires montage/core/event/mutable-event + @requires montage/core/serializer + @requires montage/core/deserializer + @requires montage/core/event/event-manager + */ var Montage = require("montage").Montage, ChangeNotification = require("core/change-notification").ChangeNotification, @@ -23,14 +23,14 @@ var Montage = require("montage").Montage, UNDERSCORE = "_"; /** - @class module:montage/core/event/binding.ChangeEventDispatchingArray -*/ + @class module:montage/core/event/binding.ChangeEventDispatchingArray + */ var ChangeEventDispatchingArray = exports.ChangeEventDispatchingArray = []; /** - @class module:montage/core/event/binding.PropertyChangeBindingListener - @extends module:montage/core/core.Montage -*/ + @class module:montage/core/event/binding.PropertyChangeBindingListener + @extends module:montage/core/core.Montage + */ var PropertyChangeBindingListener = exports.PropertyChangeBindingListener = Object.create(Montage, /** module:montage/core/event/binding.PropertyChangeBindingListener# */ { useCapture: {value:false, writable: true}, @@ -86,11 +86,11 @@ var PropertyChangeBindingListener = exports.PropertyChangeBindingListener = Obje value:function (notification) { var bindingOriginTriggeredChange, - // Left + // Left bindingOrigin = this.bindingOrigin, bindingOriginPropertyPath = this.bindingPropertyPath, bindingOriginValue = bindingOrigin.getProperty(bindingOriginPropertyPath), - // Right + // Right boundObject = this.target, boundObjectPropertyPath = this.targetPropertyPath, boundObjectValue; @@ -162,14 +162,14 @@ var PropertyChangeBindingListener = exports.PropertyChangeBindingListener = Obje }); /** - @function external:Object#propertyChangeBindingListener - @param {string} type The event type to listen for. - @param {function} listener The event listener object. - @param {boolean} useCapture Specifies whether to listen for the property change during the capture or bubble event phases. - @param {object} bindingOrigin The source of the binding. - @param {string} bindingPropertyPath The key path of the property on the source object. - @param {object} bindingDescriptor A property descriptor object that specifies the bound object and the bound object property path. -*/ + @function external:Object#propertyChangeBindingListener + @param {string} type The event type to listen for. + @param {function} listener The event listener object. + @param {boolean} useCapture Specifies whether to listen for the property change during the capture or bubble event phases. + @param {object} bindingOrigin The source of the binding. + @param {string} bindingPropertyPath The key path of the property on the source object. + @param {object} bindingDescriptor A property descriptor object that specifies the bound object and the bound object property path. + */ Object.defineProperty(Object.prototype, "propertyChangeBindingListener", { value: function(type, listener, useCapture, atSignIndex, bindingOrigin, bindingPropertyPath, bindingDescriptor) { @@ -203,41 +203,41 @@ Object.defineProperty(Object.prototype, "propertyChangeBindingListener", { Binding descriptor keys @class module:montage/core/event/binding.BindingDescriptor @extends module:montage/core/core.Montage -*/ + */ var BindingDescriptor = exports.BindingDescriptor = Montage.create(Montage, /** @lends module:montage/core/event/binding.BindingDescriptor */ { -/** - The object sourceObject will be bound to -*/ + /** + The object sourceObject will be bound to + */ boundObject: { enumerable: false, serializable: true, value: null }, -/** + /** - The key path of boundObject which sourceObject's sourceObjectBindingPath is bound to + The key path of boundObject which sourceObject's sourceObjectBindingPath is bound to -*/ + */ boundObjectPropertyPath: { enumerable: false, serializable: true, value: null }, -/** - Specifies whether the source Object will push value back to it's boundObject's boundObjectPropertyPath or not. Default is false. -*/ + /** + Specifies whether the source Object will push value back to it's boundObject's boundObjectPropertyPath or not. Default is false. + */ oneway: { enumerable: false, serializable: true, value: null }, -/** + /** If true, PropertyChangeBindingListener will buffer the value until it's told to execute binding. Setting this value to false allows for some runtime optimizations.deferred. Default is false, binding values propagate immediately. -*/ + */ deferred: { enumerable: false, serializable: true, @@ -257,31 +257,9 @@ var BindingDescriptor = exports.BindingDescriptor = Montage.create(Montage, /** }); Serializer.defineSerializationUnit("bindings", function(object) { - var bindingDescriptors = object._bindingDescriptors, - bindingDescriptorsCopy; - - // TODO: Hacked this function to create copy of object literal - // TODO: Remove when montage finds out how to identify object literals - // TODO: in a different way - function cloneObject(object, level) { - var clone = {}; - - for (var key in object) { - if (level > 0) { - clone[key] = cloneObject(object[key], level - 1); - } else { - clone[key] = object[key]; - } - } - - return clone; - } + var bindingDescriptors = object._bindingDescriptors; if (bindingDescriptors) { - if (Object.getPrototypeOf(bindingDescriptors) !== Object.prototype) { - bindingDescriptors = cloneObject(bindingDescriptors , 1); - } - return bindingDescriptors; } }); @@ -320,12 +298,12 @@ Deserializer.defineDeserializationUnit("bindings", function(object, bindings, de }); /** - @function external:Object.defineBinding - @param {object} sourceObject The source object of the data binding. This object establishes the binding between itself and the "bound object" specified by the bindingDescriptor parameter. - @param {string} sourceObjectPropertyBindingPath The key path to the source object's property that is being bound. - @param {object} bindingDescriptor An object that describes the bound object, the bound object's property path, and other properties. - @see [BindingDescriptor object]{@link module:montage/core/event/binding#BindingDescriptor} -*/ + @function external:Object.defineBinding + @param {object} sourceObject The source object of the data binding. This object establishes the binding between itself and the "bound object" specified by the bindingDescriptor parameter. + @param {string} sourceObjectPropertyBindingPath The key path to the source object's property that is being bound. + @param {object} bindingDescriptor An object that describes the bound object, the bound object's property path, and other properties. + @see [BindingDescriptor object]{@link module:montage/core/event/binding#BindingDescriptor} + */ Object.defineProperty(Object, "defineBinding", {value: function(sourceObject, sourceObjectPropertyBindingPath, bindingDescriptor) { var _bindingDescriptors = sourceObject._bindingDescriptors, oneway = typeof bindingDescriptor.oneway === "undefined" ? false : bindingDescriptor.oneway, @@ -442,11 +420,11 @@ Object.defineProperty(Object.prototype, "_deserializeProperty_bindingDescriptors }); /** - Deletes a single binding on the specified object. - @function external:Object.deleteBinding - @param {object} sourceObject The source object that defined the binding. - @param {string} sourceObjectPropertyBindingPath The key path to the bound object's bound property. -*/ + Deletes a single binding on the specified object. + @function external:Object.deleteBinding + @param {object} sourceObject The source object that defined the binding. + @param {string} sourceObjectPropertyBindingPath The key path to the bound object's bound property. + */ Object.defineProperty(Object, "deleteBinding", {value: function(sourceObject, sourceObjectPropertyBindingPath) { var _bindingDescriptors = sourceObject._bindingDescriptors, bindingDescriptor, @@ -470,10 +448,10 @@ Object.defineProperty(Object, "deleteBinding", {value: function(sourceObject, so }}); /** - Deletes all bindings on the specified object. - @function external:Object.deleteBindings - @param {object} object The object to delete bindings from. -*/ + Deletes all bindings on the specified object. + @function external:Object.deleteBindings + @param {object} object The object to delete bindings from. + */ Object.defineProperty(Object, "deleteBindings", {value: function(object) { var bindingDescriptors = object._bindingDescriptors; @@ -512,17 +490,17 @@ Object.defineProperty(Object, "applyBindingsDeferredValues", {value: function(ob Montage.defineProperty(Object.prototype, "_bindingsDisabled", {enumerable: false, value: null}); /** - Temporarily disables bindings on the specified object. To re-enable bindings, call [Object.enableBindings()]{@link external:Object.enableBindings}. - @function external:Object.disableBindings -*/ + Temporarily disables bindings on the specified object. To re-enable bindings, call [Object.enableBindings()]{@link external:Object.enableBindings}. + @function external:Object.disableBindings + */ Object.defineProperty(Object, "disableBindings", {value: function(object) { object._bindingsDisabled = true; }}); /** - Re-enables data binding on the object after being disabled with [Object.disableBindings()]{@link external:Object.disableBindings}, applying any deferred bindings that were queued during the interval. - @function external:Object#enableBindings -*/ + Re-enables data binding on the object after being disabled with [Object.disableBindings()]{@link external:Object.disableBindings}, applying any deferred bindings that were queued during the interval. + @function external:Object#enableBindings + */ Object.defineProperty(Object, "enableBindings", {value: function(object) { object._bindingsDisabled = false; Object.applyBindingsDeferredValues(object, true); -- cgit v1.2.3